|
|
|
@ -248,84 +248,81 @@ const Servers = ({ anvil }: { anvil: AnvilListItem[] }): JSX.Element => { |
|
|
|
|
{!isLoading ? ( |
|
|
|
|
<Box className={classes.root}> |
|
|
|
|
<List component="nav"> |
|
|
|
|
{data && |
|
|
|
|
data.servers.map((server: AnvilServer) => { |
|
|
|
|
return ( |
|
|
|
|
<> |
|
|
|
|
<ListItem |
|
|
|
|
button |
|
|
|
|
className={classes.button} |
|
|
|
|
key={server.server_uuid} |
|
|
|
|
component="a" |
|
|
|
|
href={`/server?uuid=${server.server_uuid}&server_name=${server.server_name}`} |
|
|
|
|
> |
|
|
|
|
<Box display="flex" flexDirection="row" width="100%"> |
|
|
|
|
{showCheckbox && ( |
|
|
|
|
<Box className={classes.checkbox}> |
|
|
|
|
<Checkbox |
|
|
|
|
style={{ color: TEXT }} |
|
|
|
|
color="secondary" |
|
|
|
|
checked={ |
|
|
|
|
selected.find( |
|
|
|
|
(s) => s === server.server_uuid, |
|
|
|
|
) !== undefined |
|
|
|
|
} |
|
|
|
|
onChange={() => handleChange(server.server_uuid)} |
|
|
|
|
/> |
|
|
|
|
</Box> |
|
|
|
|
)} |
|
|
|
|
<Box p={1}> |
|
|
|
|
<Decorator |
|
|
|
|
colour={selectDecorator(server.server_state)} |
|
|
|
|
/> |
|
|
|
|
</Box> |
|
|
|
|
<Box p={1} flexGrow={1}> |
|
|
|
|
<BodyText text={server.server_name} /> |
|
|
|
|
<BodyText |
|
|
|
|
text={ |
|
|
|
|
serverState.get(server.server_state) || |
|
|
|
|
'Not Available' |
|
|
|
|
{data?.servers.map((server: AnvilServer) => { |
|
|
|
|
return ( |
|
|
|
|
<> |
|
|
|
|
<ListItem |
|
|
|
|
button |
|
|
|
|
className={classes.button} |
|
|
|
|
key={server.server_uuid} |
|
|
|
|
component={showCheckbox ? 'div' : 'a'} |
|
|
|
|
href={`/server?uuid=${server.server_uuid}&server_name=${server.server_name}`} |
|
|
|
|
onClick={() => handleChange(server.server_uuid)} |
|
|
|
|
> |
|
|
|
|
<Box display="flex" flexDirection="row" width="100%"> |
|
|
|
|
{showCheckbox && ( |
|
|
|
|
<Box className={classes.checkbox}> |
|
|
|
|
<Checkbox |
|
|
|
|
style={{ color: TEXT }} |
|
|
|
|
color="secondary" |
|
|
|
|
checked={ |
|
|
|
|
selected.find((s) => s === server.server_uuid) !== |
|
|
|
|
undefined |
|
|
|
|
} |
|
|
|
|
/> |
|
|
|
|
</Box> |
|
|
|
|
<Box display="flex" className={classes.hostsBox}> |
|
|
|
|
{server.server_state !== 'shut off' && |
|
|
|
|
server.server_state !== 'crashed' && |
|
|
|
|
filteredHosts.map( |
|
|
|
|
( |
|
|
|
|
host: AnvilStatusHost, |
|
|
|
|
index: number, |
|
|
|
|
): JSX.Element => ( |
|
|
|
|
<> |
|
|
|
|
<Box |
|
|
|
|
p={1} |
|
|
|
|
key={host.host_uuid} |
|
|
|
|
className={classes.hostBox} |
|
|
|
|
> |
|
|
|
|
<BodyText |
|
|
|
|
text={host.host_name} |
|
|
|
|
selected={ |
|
|
|
|
server.server_host_uuid === |
|
|
|
|
host.host_uuid |
|
|
|
|
} |
|
|
|
|
/> |
|
|
|
|
</Box> |
|
|
|
|
{index !== filteredHosts.length - 1 && ( |
|
|
|
|
<Divider |
|
|
|
|
className={`${classes.divider} ${classes.verticalDivider}`} |
|
|
|
|
orientation="vertical" |
|
|
|
|
/> |
|
|
|
|
)} |
|
|
|
|
</> |
|
|
|
|
), |
|
|
|
|
)} |
|
|
|
|
</Box> |
|
|
|
|
)} |
|
|
|
|
<Box p={1}> |
|
|
|
|
<Decorator |
|
|
|
|
colour={selectDecorator(server.server_state)} |
|
|
|
|
/> |
|
|
|
|
</Box> |
|
|
|
|
<Box p={1} flexGrow={1}> |
|
|
|
|
<BodyText text={server.server_name} /> |
|
|
|
|
<BodyText |
|
|
|
|
text={ |
|
|
|
|
serverState.get(server.server_state) || |
|
|
|
|
'Not Available' |
|
|
|
|
} |
|
|
|
|
/> |
|
|
|
|
</Box> |
|
|
|
|
<Box display="flex" className={classes.hostsBox}> |
|
|
|
|
{server.server_state !== 'shut off' && |
|
|
|
|
server.server_state !== 'crashed' && |
|
|
|
|
filteredHosts.map( |
|
|
|
|
( |
|
|
|
|
host: AnvilStatusHost, |
|
|
|
|
index: number, |
|
|
|
|
): JSX.Element => ( |
|
|
|
|
<> |
|
|
|
|
<Box |
|
|
|
|
p={1} |
|
|
|
|
key={host.host_uuid} |
|
|
|
|
className={classes.hostBox} |
|
|
|
|
> |
|
|
|
|
<BodyText |
|
|
|
|
text={host.host_name} |
|
|
|
|
selected={ |
|
|
|
|
server.server_host_uuid === host.host_uuid |
|
|
|
|
} |
|
|
|
|
/> |
|
|
|
|
</Box> |
|
|
|
|
{index !== filteredHosts.length - 1 && ( |
|
|
|
|
<Divider |
|
|
|
|
className={`${classes.divider} ${classes.verticalDivider}`} |
|
|
|
|
orientation="vertical" |
|
|
|
|
/> |
|
|
|
|
)} |
|
|
|
|
</> |
|
|
|
|
), |
|
|
|
|
)} |
|
|
|
|
</Box> |
|
|
|
|
</ListItem> |
|
|
|
|
<Divider className={classes.divider} /> |
|
|
|
|
</> |
|
|
|
|
); |
|
|
|
|
})} |
|
|
|
|
</Box> |
|
|
|
|
</ListItem> |
|
|
|
|
<Divider className={classes.divider} /> |
|
|
|
|
</> |
|
|
|
|
); |
|
|
|
|
})} |
|
|
|
|
</List> |
|
|
|
|
</Box> |
|
|
|
|
) : ( |
|
|
|
|