diff --git a/striker-ui/components/Anvils/index.tsx b/striker-ui/components/Anvils/index.tsx index 3dd6f7ae..a7cc4925 100644 --- a/striker-ui/components/Anvils/index.tsx +++ b/striker-ui/components/Anvils/index.tsx @@ -14,7 +14,7 @@ const Anvils = ({ list }: { list: AnvilList | undefined }): JSX.Element => { ); anvils.push({ ...anvil, - anvil_state: data?.anvil_state, + ...data, }); }); return ( diff --git a/striker-ui/components/Nodes/AnvilNode.tsx b/striker-ui/components/Nodes/AnvilNode.tsx index 385d34ff..983062c7 100644 --- a/striker-ui/components/Nodes/AnvilNode.tsx +++ b/striker-ui/components/Nodes/AnvilNode.tsx @@ -65,7 +65,7 @@ const selectDecorator = (state: string): Colours => { const AnvilNode = ({ nodes, }: { - nodes: Array; + nodes: Array; }): JSX.Element => { const classes = useStyles(); const stateRegex = /^[a-zA-Z]/; @@ -77,11 +77,11 @@ const AnvilNode = ({ nodes.map( (node): JSX.Element => { return ( - + - + @@ -106,7 +106,7 @@ const AnvilNode = ({ checked={node.state === 'ready'} onChange={() => putJSON('/anvils/set_power', { - host_uuid: node.node_uuid, + host_uuid: node.host_uuid, is_on: !(node.state === 'ready'), }) } @@ -121,7 +121,7 @@ const AnvilNode = ({ disabled={!node.removable} onChange={() => putJSON('/anvils/set_membership', { - host_uuid: node.node_uuid, + host_uuid: node.host_uuid, is_member: !(node.state === 'ready'), }) } diff --git a/striker-ui/components/Nodes/index.tsx b/striker-ui/components/Nodes/index.tsx index 145f00be..370e675b 100644 --- a/striker-ui/components/Nodes/index.tsx +++ b/striker-ui/components/Nodes/index.tsx @@ -15,11 +15,11 @@ const Nodes = ({ anvil }: { anvil: AnvilListItem[] }): JSX.Element => { return ( - {anvil.findIndex((a) => a.anvil_uuid === uuid) !== -1 && ( + {anvil.findIndex((a) => a.anvil_uuid === uuid) !== -1 && data && ( a.anvil_uuid === uuid)].nodes.map( (node, index) => { - return { ...node, ...data?.nodes[index] }; + return data.nodes[index]; }, )} /> diff --git a/striker-ui/types/AnvilList.d.ts b/striker-ui/types/AnvilList.d.ts index d0d3b760..e8bcc44d 100644 --- a/striker-ui/types/AnvilList.d.ts +++ b/striker-ui/types/AnvilList.d.ts @@ -1,14 +1,7 @@ -declare type AnvilListItemNode = { - node_name: string; - node_uuid: string; -}; - declare type AnvilListItem = { anvil_name: string; anvil_uuid: string; - anvil_state: string; - nodes: Array; -}; +} & AnvilStatus; declare type AnvilList = { anvils: Array; diff --git a/striker-ui/types/AnvilStatus.d.ts b/striker-ui/types/AnvilStatus.d.ts index 44f54033..b779c9af 100644 --- a/striker-ui/types/AnvilStatus.d.ts +++ b/striker-ui/types/AnvilStatus.d.ts @@ -1,5 +1,7 @@ declare type AnvilStatusNode = { state: 'unknown' | 'off' | 'on' | 'accessible' | 'ready'; + host_uuid: string; + host_name: string; state_percent: number; state_message: string; removable: boolean; @@ -7,7 +9,5 @@ declare type AnvilStatusNode = { declare type AnvilStatus = { anvil_state: 'optimal' | 'not_ready' | 'degraded'; - nodes: Array<{ - AnvilStatusNode; - }>; + nodes: Array; };