style(striker-ui): fix style linting errors in components

main
Tsu-ba-me 3 years ago
parent c2f38a3f00
commit 0db0a94a05
  1. 141
      striker-ui/components/Hosts/AnvilHost.tsx
  2. 72
      striker-ui/components/Resource/ResourceVolumes.tsx

@ -73,84 +73,89 @@ const AnvilHost = ({
return ( return (
<Box className={classes.root}> <Box className={classes.root}>
{hosts && {hosts &&
hosts.map((host): JSX.Element => { hosts.map(
return ( (host): JSX.Element => {
<InnerPanel key={host.host_uuid}> return (
<PanelHeader> <InnerPanel key={host.host_uuid}>
<Box display="flex" width="100%" className={classes.header}> <PanelHeader>
<Box display="flex" width="100%" className={classes.header}>
<Box flexGrow={1}>
<BodyText text={host.host_name} />
</Box>
<Box className={classes.decoratorBox}>
<Decorator colour={selectDecorator(host.state)} />
</Box>
<Box>
<BodyText
text={
host?.state?.replace(stateRegex, (c) =>
c.toUpperCase(),
) || 'Not Available'
}
/>
</Box>
</Box>
</PanelHeader>
<Box display="flex" className={classes.state}>
<Box className={classes.label}>
<BodyText text="Power: " />
</Box>
<Box flexGrow={1}> <Box flexGrow={1}>
<BodyText text={host.host_name} /> <Switch
checked={host.state === 'online'}
onChange={() =>
putFetch(
`${process.env.NEXT_PUBLIC_API_URL}/set_power`,
{
host_uuid: host.host_uuid,
is_on: !(host.state === 'online'),
},
)
}
/>
</Box> </Box>
<Box className={classes.decoratorBox}> <Box className={classes.label}>
<Decorator colour={selectDecorator(host.state)} /> <BodyText text="Member: " />
</Box> </Box>
<Box> <Box>
<BodyText <Switch
text={ checked={host.state === 'online'}
host?.state?.replace(stateRegex, (c) => disabled={!(host.state === 'online')}
c.toUpperCase(), onChange={() =>
) || 'Not Available' putFetch(
`${process.env.NEXT_PUBLIC_API_URL}/set_membership`,
{
host_uuid: host.host_uuid,
is_member: !(host.state === 'online'),
},
)
} }
/> />
</Box> </Box>
</Box> </Box>
</PanelHeader> {host.state !== 'online' && host.state !== 'offline' && (
<Box display="flex" className={classes.state}> <>
<Box className={classes.label}> <Box display="flex" width="100%" className={classes.state}>
<BodyText text="Power: " /> <Box>
</Box> <BodyText
<Box flexGrow={1}> text={selectStateMessage(
<Switch messageRegex,
checked={host.state === 'online'} host.state_message,
onChange={() => )}
putFetch(`${process.env.NEXT_PUBLIC_API_URL}/set_power`, { />
host_uuid: host.host_uuid, </Box>
is_on: !(host.state === 'online'),
})
}
/>
</Box>
<Box className={classes.label}>
<BodyText text="Member: " />
</Box>
<Box>
<Switch
checked={host.state === 'online'}
disabled={!(host.state === 'online')}
onChange={() =>
putFetch(
`${process.env.NEXT_PUBLIC_API_URL}/set_membership`,
{
host_uuid: host.host_uuid,
is_member: !(host.state === 'online'),
},
)
}
/>
</Box>
</Box>
{host.state !== 'online' && host.state !== 'offline' && (
<>
<Box display="flex" width="100%" className={classes.state}>
<Box>
<BodyText
text={selectStateMessage(
messageRegex,
host.state_message,
)}
/>
</Box> </Box>
</Box> <Box display="flex" width="100%" className={classes.bar}>
<Box display="flex" width="100%" className={classes.bar}> <Box flexGrow={1}>
<Box flexGrow={1}> <ProgressBar progressPercentage={host.state_percent} />
<ProgressBar progressPercentage={host.state_percent} /> </Box>
</Box> </Box>
</Box> </>
</> )}
)} </InnerPanel>
</InnerPanel> );
); },
})} )}
</Box> </Box>
); );
}; };

@ -78,41 +78,49 @@ const ResourceVolumes = ({
</Box> </Box>
</Box> </Box>
</PanelHeader> </PanelHeader>
{volume.connections.map((connection, index): JSX.Element => { {volume.connections.map(
return ( (connection, index): JSX.Element => {
<> return (
<Box <>
key={connection.fencing} <Box
display="flex" key={connection.fencing}
width="100%" display="flex"
className={classes.connection} width="100%"
> className={classes.connection}
<Box className={classes.decoratorBox}> >
<Decorator <Box className={classes.decoratorBox}>
colour={selectDecorator(connection.connection_state)} <Decorator
/> colour={selectDecorator(
</Box> connection.connection_state,
<Box> )}
<Box display="flex" width="100%"> />
<BodyText text={connection.targets[0].target_name} />
<InsertLinkIcon style={{ color: DIVIDER }} />
<BodyText text={connection.targets[1].target_name} />
</Box> </Box>
<Box <Box>
display="flex" <Box display="flex" width="100%">
justifyContent="center" <BodyText
width="100%" text={connection.targets[0].target_name}
> />
<BodyText text={connection.connection_state} /> <InsertLinkIcon style={{ color: DIVIDER }} />
<BodyText
text={connection.targets[1].target_name}
/>
</Box>
<Box
display="flex"
justifyContent="center"
width="100%"
>
<BodyText text={connection.connection_state} />
</Box>
</Box> </Box>
</Box> </Box>
</Box> {volume.connections.length - 1 !== index ? (
{volume.connections.length - 1 !== index ? ( <Divider className={classes.divider} />
<Divider className={classes.divider} /> ) : null}
) : null} </>
</> );
); },
})} )}
</InnerPanel> </InnerPanel>
); );
})} })}

Loading…
Cancel
Save