From 3db6ca9c559ecd369177a457654d2f9f86928186 Mon Sep 17 00:00:00 2001 From: Josue Date: Mon, 22 Mar 2021 11:39:34 -0400 Subject: [PATCH] feat: add SharedStorageNode component --- striker-ui/components/SharedStorage.tsx | 20 ++++++-- striker-ui/components/SharedStorageNode.tsx | 53 +++++++++++++++++++++ 2 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 striker-ui/components/SharedStorageNode.tsx diff --git a/striker-ui/components/SharedStorage.tsx b/striker-ui/components/SharedStorage.tsx index fa99fb9b..30ba1b8a 100644 --- a/striker-ui/components/SharedStorage.tsx +++ b/striker-ui/components/SharedStorage.tsx @@ -1,9 +1,15 @@ import { Grid } from '@material-ui/core'; -import InnerPanel from './InnerPanel'; import Panel from './Panel'; +import SharedStorageNode from './SharedStorageNode'; import { HeaderText, BodyText } from './Text'; +import PeriodicFetch from '../lib/fetchers/periodicFetch'; + +const SharedStorage = ({ anvil }: { anvil: AnvilListItem }): JSX.Element => { + const { data } = PeriodicFetch( + `${process.env.NEXT_PUBLIC_API_URL}/anvils/get_shared_storage?anvil_uuid=`, + anvil.anvil_uuid, + ); -const SharedStorage = (): JSX.Element => { return ( @@ -14,7 +20,15 @@ const SharedStorage = (): JSX.Element => { - + {data && + data.file_systems[0]?.nodes.map( + (node: AnvilSharedStorageNode, index: number) => ( + + ), + )} diff --git a/striker-ui/components/SharedStorageNode.tsx b/striker-ui/components/SharedStorageNode.tsx new file mode 100644 index 00000000..cd5f67db --- /dev/null +++ b/striker-ui/components/SharedStorageNode.tsx @@ -0,0 +1,53 @@ +import { Grid, Switch } from '@material-ui/core'; +import * as prettyBytes from 'pretty-bytes'; + +import InnerPanel from './InnerPanel'; +import AllocationBar from './AllocationBar'; +import { BodyText } from './Text'; + +const SharedStorageNode = ({ + node, +}: { + node: AnvilSharedStorageNode; +}): JSX.Element => { + return ( + + + + + + + + + + + + + + + + + + + + + + + ); +}; + +export default SharedStorageNode;