fix: use host_uuid instead of index number to determine server's host

main
Josue 4 years ago committed by Tsu-ba-me
parent 24e4509c8d
commit 6b2d3700f9
  1. 9
      striker-ui/components/Servers.tsx
  2. 2
      striker-ui/types/AnvilServers.d.ts

@ -88,14 +88,13 @@ const Servers = ({ anvil }: { anvil: AnvilListItem[] }): JSX.Element => {
anvil[ anvil[
anvil.findIndex((a) => a.anvil_uuid === uuid) anvil.findIndex((a) => a.anvil_uuid === uuid)
].hosts.map( ].hosts.map(
( (host: AnvilStatusHost): JSX.Element => (
host: AnvilStatusHost,
index: number,
): JSX.Element => (
<Box p={1} key={host.host_uuid}> <Box p={1} key={host.host_uuid}>
<BodyText <BodyText
text={host.host_name} text={host.host_name}
selected={server.server_host_index === index} selected={
server.server_host_uuid === host.host_uuid
}
/> />
</Box> </Box>
), ),

@ -10,7 +10,7 @@ declare type AnvilServer = {
| 'crashed' | 'crashed'
| 'pmsuspended' | 'pmsuspended'
| 'migrating'; | 'migrating';
server_host_index: number; server_host_uuid: string;
}; };
declare type AnvilServers = { declare type AnvilServers = {

Loading…
Cancel
Save