diff --git a/striker-ui/components/Anvils/SelectedAnvil.tsx b/striker-ui/components/Anvils/SelectedAnvil.tsx index ae5f1cb7..65fe3687 100644 --- a/striker-ui/components/Anvils/SelectedAnvil.tsx +++ b/striker-ui/components/Anvils/SelectedAnvil.tsx @@ -35,7 +35,7 @@ const selectDecorator = (state: string): Colours => { const isAnvilOn = (anvil: AnvilListItem): boolean => !( - anvil.nodes.findIndex(({ state }: AnvilStatusNode) => state !== 'off') === + anvil.hosts.findIndex(({ state }: AnvilStatusHost) => state !== 'off') === -1 ); diff --git a/striker-ui/components/Nodes/AnvilNode.tsx b/striker-ui/components/Hosts/AnvilHost.tsx similarity index 77% rename from striker-ui/components/Nodes/AnvilNode.tsx rename to striker-ui/components/Hosts/AnvilHost.tsx index 983062c7..01511c70 100644 --- a/striker-ui/components/Nodes/AnvilNode.tsx +++ b/striker-ui/components/Hosts/AnvilHost.tsx @@ -4,7 +4,7 @@ import { InnerPanel, PanelHeader } from '../Panels'; import { ProgressBar } from '../Bars'; import { BodyText } from '../Text'; import Decorator, { Colours } from '../Decorator'; -import NODE_STATUS from '../../lib/consts/NODES'; +import HOST_STATUS from '../../lib/consts/NODES'; import putJSON from '../../lib/fetchers/putJSON'; @@ -43,7 +43,7 @@ const selectStateMessage = (regex: RegExp, message: string): string => { const msg = regex.exec(message); if (msg) { - return NODE_STATUS.get(msg[0]) || 'Error code not recognized'; + return HOST_STATUS.get(msg[0]) || 'Error code not recognized'; } return 'Error code not found'; }; @@ -62,10 +62,10 @@ const selectDecorator = (state: string): Colours => { } }; -const AnvilNode = ({ - nodes, +const AnvilHost = ({ + hosts, }: { - nodes: Array; + hosts: Array; }): JSX.Element => { const classes = useStyles(); const stateRegex = /^[a-zA-Z]/; @@ -73,23 +73,23 @@ const AnvilNode = ({ return ( - {nodes && - nodes.map( - (node): JSX.Element => { + {hosts && + hosts.map( + (host): JSX.Element => { return ( - + - + - + + host?.state?.replace(stateRegex, (c) => c.toUpperCase(), ) || 'Not Available' } @@ -103,11 +103,11 @@ const AnvilNode = ({ putJSON('/anvils/set_power', { - host_uuid: node.host_uuid, - is_on: !(node.state === 'ready'), + host_uuid: host.host_uuid, + is_on: !(host.state === 'ready'), }) } /> @@ -117,32 +117,32 @@ const AnvilNode = ({ putJSON('/anvils/set_membership', { - host_uuid: node.host_uuid, - is_member: !(node.state === 'ready'), + host_uuid: host.host_uuid, + is_member: !(host.state === 'ready'), }) } /> - {node.state !== 'ready' && ( + {host.state !== 'ready' && ( <> - + @@ -155,4 +155,4 @@ const AnvilNode = ({ ); }; -export default AnvilNode; +export default AnvilHost; diff --git a/striker-ui/components/Nodes/index.tsx b/striker-ui/components/Hosts/index.tsx similarity index 63% rename from striker-ui/components/Nodes/index.tsx rename to striker-ui/components/Hosts/index.tsx index 370e675b..802e3166 100644 --- a/striker-ui/components/Nodes/index.tsx +++ b/striker-ui/components/Hosts/index.tsx @@ -1,11 +1,11 @@ import { useContext } from 'react'; import { Panel } from '../Panels'; import { HeaderText } from '../Text'; -import AnvilNode from './AnvilNode'; +import AnvilHost from './AnvilHost'; import PeriodicFetch from '../../lib/fetchers/periodicFetch'; import { AnvilContext } from '../AnvilContext'; -const Nodes = ({ anvil }: { anvil: AnvilListItem[] }): JSX.Element => { +const Hosts = ({ anvil }: { anvil: AnvilListItem[] }): JSX.Element => { const { uuid } = useContext(AnvilContext); const { data } = PeriodicFetch( @@ -14,12 +14,12 @@ const Nodes = ({ anvil }: { anvil: AnvilListItem[] }): JSX.Element => { return ( - + {anvil.findIndex((a) => a.anvil_uuid === uuid) !== -1 && data && ( - a.anvil_uuid === uuid)].nodes.map( - (node, index) => { - return data.nodes[index]; + a.anvil_uuid === uuid)].hosts.map( + (host, index) => { + return data.hosts[index]; }, )} /> @@ -28,4 +28,4 @@ const Nodes = ({ anvil }: { anvil: AnvilListItem[] }): JSX.Element => { ); }; -export default Nodes; +export default Hosts; diff --git a/striker-ui/components/Network/Network.tsx b/striker-ui/components/Network/Network.tsx index d3343173..032813a2 100644 --- a/striker-ui/components/Network/Network.tsx +++ b/striker-ui/components/Network/Network.tsx @@ -72,12 +72,12 @@ const Network = (): JSX.Element => { - {bond.nodes.map( - (node): JSX.Element => ( - + {bond.hosts.map( + (host): JSX.Element => ( + - - + + ), diff --git a/striker-ui/components/Network/processNetwork.ts b/striker-ui/components/Network/processNetwork.ts index 1399ea09..0a321312 100644 --- a/striker-ui/components/Network/processNetwork.ts +++ b/striker-ui/components/Network/processNetwork.ts @@ -2,8 +2,8 @@ const processNetworkData = (data: AnvilNetwork): ProcessedNetwork => { const processedBonds: string[] = []; const displayBonds: ProcessedNetwork = { bonds: [] }; - data?.nodes.forEach((node) => { - node.bonds.forEach((bond) => { + data?.hosts.forEach((host) => { + host.bonds.forEach((bond) => { const index = processedBonds.findIndex( (processed: string) => processed === bond.bond_name, ); @@ -15,18 +15,18 @@ const processNetworkData = (data: AnvilNetwork): ProcessedNetwork => { bond_uuid: bond.bond_uuid, bond_speed: 0, bond_state: 'degraded', - nodes: [ + hosts: [ { - host_name: node.host_name, - host_uuid: node.host_uuid, + host_name: host.host_name, + host_uuid: host.host_uuid, link: bond.links[0].is_active ? bond.links[0] : bond.links[1], }, ], }); } else { - displayBonds.bonds[index].nodes.push({ - host_name: node.host_name, - host_uuid: node.host_uuid, + displayBonds.bonds[index].hosts.push({ + host_name: host.host_name, + host_uuid: host.host_uuid, link: bond.links[0].is_active ? bond.links[0] : bond.links[1], }); } @@ -35,11 +35,11 @@ const processNetworkData = (data: AnvilNetwork): ProcessedNetwork => { /* eslint-disable no-param-reassign */ displayBonds.bonds.forEach((bond) => { - const nodeIndex = - bond.nodes[0].link.link_speed > bond.nodes[1].link.link_speed ? 1 : 0; + const hostIndex = + bond.hosts[0].link.link_speed > bond.hosts[1].link.link_speed ? 1 : 0; - bond.bond_speed = bond.nodes[nodeIndex].link.link_speed; - bond.bond_state = bond.nodes[nodeIndex].link.link_state; + bond.bond_speed = bond.hosts[hostIndex].link.link_speed; + bond.bond_state = bond.hosts[hostIndex].link.link_state; }); return displayBonds; }; diff --git a/striker-ui/components/Servers.tsx b/striker-ui/components/Servers.tsx index 9ea1e6e4..c458d48e 100644 --- a/striker-ui/components/Servers.tsx +++ b/striker-ui/components/Servers.tsx @@ -87,14 +87,14 @@ const Servers = ({ anvil }: { anvil: AnvilListItem[] }): JSX.Element => { server.server_state !== 'crashed' && anvil[ anvil.findIndex((a) => a.anvil_uuid === uuid) - ].nodes.map( + ].hosts.map( ( - node: AnvilListItemNode, + host: AnvilStatusHost, index: number, ): JSX.Element => ( - + diff --git a/striker-ui/components/SharedStorage/SharedStorage.tsx b/striker-ui/components/SharedStorage/SharedStorage.tsx index 1b7dc372..0effc823 100644 --- a/striker-ui/components/SharedStorage/SharedStorage.tsx +++ b/striker-ui/components/SharedStorage/SharedStorage.tsx @@ -4,7 +4,7 @@ import { Box } from '@material-ui/core'; import { makeStyles } from '@material-ui/core/styles'; import { BodyText, HeaderText } from '../Text'; import { Panel, InnerPanel, PanelHeader } from '../Panels'; -import SharedStorageNode from './SharedStorageNode'; +import SharedStorageHost from './SharedStorageHost'; import PeriodicFetch from '../../lib/fetchers/periodicFetch'; import { AnvilContext } from '../AnvilContext'; @@ -44,20 +44,20 @@ const SharedStorage = ({ anvil }: { anvil: AnvilListItem[] }): JSX.Element => { - {fs?.nodes && - fs.nodes.map( + {fs?.hosts && + fs.hosts.map( ( - node: AnvilSharedStorageNode, + host: AnvilSharedStorageHost, index: number, ): JSX.Element => ( - a.anvil_uuid === uuid)] - .nodes[index], + a.anvil_uuid === uuid) + ].hosts[index], }} - key={fs.nodes[index].free} + key={fs.hosts[index].free} /> ), )} diff --git a/striker-ui/components/SharedStorage/SharedStorageNode.tsx b/striker-ui/components/SharedStorage/SharedStorageHost.tsx similarity index 72% rename from striker-ui/components/SharedStorage/SharedStorageNode.tsx rename to striker-ui/components/SharedStorage/SharedStorageHost.tsx index 5d7c342c..63feead0 100644 --- a/striker-ui/components/SharedStorage/SharedStorageNode.tsx +++ b/striker-ui/components/SharedStorage/SharedStorageHost.tsx @@ -20,38 +20,38 @@ const useStyles = makeStyles(() => ({ }, })); -const SharedStorageNode = ({ - node, +const SharedStorageHost = ({ + host, }: { - node: AnvilSharedStorageNode; + host: AnvilSharedStorageHost; }): JSX.Element => { const classes = useStyles(); return ( <> - + - + - + - {node.is_mounted && ( + {host.is_mounted && ( <> @@ -60,13 +60,13 @@ const SharedStorageNode = ({ @@ -77,4 +77,4 @@ const SharedStorageNode = ({ ); }; -export default SharedStorageNode; +export default SharedStorageHost; diff --git a/striker-ui/pages/index.tsx b/striker-ui/pages/index.tsx index 540d8b5d..1d467c6d 100644 --- a/striker-ui/pages/index.tsx +++ b/striker-ui/pages/index.tsx @@ -2,7 +2,7 @@ import { Box } from '@material-ui/core'; import { makeStyles } from '@material-ui/core/styles'; import Anvils from '../components/Anvils'; -import Nodes from '../components/Nodes'; +import Hosts from '../components/Hosts'; import CPU from '../components/CPU'; import SharedStorage from '../components/SharedStorage'; import Memory from '../components/Memory'; @@ -59,7 +59,7 @@ const Home = (): JSX.Element => { - + diff --git a/striker-ui/types/AnvilNetwork.d.ts b/striker-ui/types/AnvilNetwork.d.ts index 2d828f90..2fcb8a49 100644 --- a/striker-ui/types/AnvilNetwork.d.ts +++ b/striker-ui/types/AnvilNetwork.d.ts @@ -6,20 +6,20 @@ declare type AnvilNetworkBondLink = { is_active: boolean; }; -declare type AnvilNetworkNodeBond = { +declare type AnvilNetworkHostBond = { bond_name: string; bond_uuid: string; links: Array; }; -declare type AnvilNetworkNode = { +declare type AnvilNetworkHosts = { host_name: string; host_uuid: string; - bonds: Array; + bonds: Array; }; declare type AnvilNetwork = { - nodes: Array; + hosts: Array; }; declare type ProcessedBond = { @@ -27,7 +27,7 @@ declare type ProcessedBond = { bond_uuid: string; bond_speed: number; bond_state: 'optimal' | 'degraded'; - nodes: Array<{ + hosts: Array<{ host_name: string; host_uuid: string; link: { diff --git a/striker-ui/types/AnvilSharedStorage.d.ts b/striker-ui/types/AnvilSharedStorage.d.ts index 9d493b76..c11fd39b 100644 --- a/striker-ui/types/AnvilSharedStorage.d.ts +++ b/striker-ui/types/AnvilSharedStorage.d.ts @@ -1,13 +1,14 @@ -declare type AnvilSharedStorageNode = { +declare type AnvilSharedStorageHost = { + host_uuid: string; + host_name: string; is_mounted: boolean; total: number; free: number; - nodeInfo?: AnvilListItemNode; }; declare type AnvilSharedStorageFileSystem = { mount_point: string; - nodes: Array; + hosts: Array; }; declare type AnvilSharedStorage = { diff --git a/striker-ui/types/AnvilStatus.d.ts b/striker-ui/types/AnvilStatus.d.ts index b779c9af..4a2e2d49 100644 --- a/striker-ui/types/AnvilStatus.d.ts +++ b/striker-ui/types/AnvilStatus.d.ts @@ -1,4 +1,4 @@ -declare type AnvilStatusNode = { +declare type AnvilStatusHost = { state: 'unknown' | 'off' | 'on' | 'accessible' | 'ready'; host_uuid: string; host_name: string; @@ -9,5 +9,5 @@ declare type AnvilStatusNode = { declare type AnvilStatus = { anvil_state: 'optimal' | 'not_ready' | 'degraded'; - nodes: Array; + hosts: Array; }; diff --git a/striker-ui/types/NodeSet.d.ts b/striker-ui/types/NodeSet.d.ts index 60bb188a..4926f558 100644 --- a/striker-ui/types/NodeSet.d.ts +++ b/striker-ui/types/NodeSet.d.ts @@ -1,11 +1,11 @@ -declare type NodeSet = { +declare type HostSet = { host_uuid: string; }; -declare type NodeSetPower = NodeSet & { +declare type HostSetPower = HostSet & { is_on: boolean; }; -declare type NodeSetMembership = NodeSet & { +declare type HostSetMembership = HostSet & { is_membership: boolean; };