fix: use prop names from the specs

main
Josue 4 years ago committed by Tsu-ba-me
parent c3f0a948a6
commit 0e09683d61
  1. 20
      striker-ui/components/Memory.tsx
  2. 2
      striker-ui/types/AnvilMemory.d.ts

@ -13,7 +13,7 @@ const Memory = (): JSX.Element => {
`${process.env.NEXT_PUBLIC_API_URL}/get_memory?anvil_uuid=${uuid}`, `${process.env.NEXT_PUBLIC_API_URL}/get_memory?anvil_uuid=${uuid}`,
); );
const memoryData = isLoading || !data ? { total: 0, free: 0 } : data; const memoryData = isLoading || !data ? { total: 0, allocated: 0 } : data;
return ( return (
<Panel> <Panel>
@ -21,28 +21,26 @@ const Memory = (): JSX.Element => {
<Box display="flex" width="100%"> <Box display="flex" width="100%">
<Box flexGrow={1}> <Box flexGrow={1}>
<BodyText <BodyText
text={`Allocated: ${prettyBytes.default( text={`Allocated: ${prettyBytes.default(memoryData.allocated, {
memoryData.total - memoryData.free,
{
binary: true, binary: true,
}, })}`}
)}`}
/> />
</Box> </Box>
<Box> <Box>
<BodyText <BodyText
text={`Free: ${prettyBytes.default(memoryData.free, { text={`Free: ${prettyBytes.default(
memoryData.total - memoryData.allocated,
{
binary: true, binary: true,
})}`} },
)}`}
/> />
</Box> </Box>
</Box> </Box>
<Box display="flex" width="100%"> <Box display="flex" width="100%">
<Box flexGrow={1}> <Box flexGrow={1}>
<AllocationBar <AllocationBar
allocated={ allocated={(memoryData.allocated / memoryData.total) * 100}
((memoryData.total - memoryData.free) / memoryData.total) * 100
}
/> />
</Box> </Box>
</Box> </Box>

@ -1,4 +1,4 @@
declare type AnvilMemory = { declare type AnvilMemory = {
total: number; total: number;
free: number; allocated: number;
}; };

Loading…
Cancel
Save