main
Josue 4 years ago committed by Tsu-ba-me
parent caae2dd1e7
commit 93d10e0528
  1. 26
      striker-ui/components/Nodes/AnvilNode.tsx
  2. 5
      striker-ui/components/Nodes/index.tsx

@ -60,32 +60,32 @@ const selectDecorator = (
};
const AnvilNode = ({
node,
nodes,
}: {
node: Array<AnvilStatusNode & AnvilListItemNode>;
nodes: Array<AnvilStatusNode & AnvilListItemNode>;
}): JSX.Element => {
const classes = useStyles();
return (
<>
{node &&
node.map(
(n): JSX.Element => {
{nodes &&
nodes.map(
(node): JSX.Element => {
return (
<InnerPanel key={n.node_uuid}>
<InnerPanel key={node.node_uuid}>
<PanelHeader>
<Box display="flex" width="100%">
<Box flexGrow={1}>
<BodyText text={n.node_name} />
<BodyText text={node.node_name} />
</Box>
<Box className={classes.decoratorBox}>
<div
className={`${classes.decorator} ${
classes[selectDecorator(n.state)]
classes[selectDecorator(node.state)]
}`}
/>
</Box>
<Box>
<BodyText text={n.state} />
<BodyText text={node.state} />
</Box>
</Box>
</PanelHeader>
@ -103,19 +103,19 @@ const AnvilNode = ({
<Switch checked />
</Box>
</Box>
{n.state !== 'ready' && (
{node.state !== 'ready' && (
<>
<Box display="flex" width="100%" className={classes.state}>
<Box flexGrow={1}>
<BodyText text={`State: ${n.state}`} />
<BodyText text={`State: ${node.state}`} />
</Box>
<Box>
<BodyText text={n.state_message} />
<BodyText text={node.state_message} />
</Box>
</Box>
<Box display="flex" width="100%" className={classes.bar}>
<Box flexGrow={1}>
<ProgressBar progressPercentage={n.state_percent} />
<ProgressBar progressPercentage={node.state_percent} />
</Box>
</Box>
</>

@ -8,14 +8,13 @@ const Nodes = ({ anvil }: { anvil: AnvilListItem }): JSX.Element => {
`${process.env.NEXT_PUBLIC_API_URL}/anvils/get_status?anvil_uuid=`,
anvil?.anvil_uuid,
);
/* eslint-disable no-param-reassign */
return (
<Panel>
<Text text="Nodes" />
<AnvilNode
node={anvil?.nodes.map((n, index) => {
return { ...n, ...data?.nodes[index] };
nodes={anvil?.nodes.map((node, index) => {
return { ...node, ...data?.nodes[index] };
})}
/>
</Panel>

Loading…
Cancel
Save