|
|
@ -50,15 +50,12 @@ const selectStateMessage = (regex: RegExp, message: string): string => { |
|
|
|
|
|
|
|
|
|
|
|
const selectDecorator = (state: string): Colours => { |
|
|
|
const selectDecorator = (state: string): Colours => { |
|
|
|
switch (state) { |
|
|
|
switch (state) { |
|
|
|
case 'ready': |
|
|
|
case 'online': |
|
|
|
return 'ok'; |
|
|
|
return 'ok'; |
|
|
|
case 'off': |
|
|
|
case 'offline': |
|
|
|
return 'off'; |
|
|
|
return 'off'; |
|
|
|
case 'accessible': |
|
|
|
|
|
|
|
case 'on': |
|
|
|
|
|
|
|
return 'warning'; |
|
|
|
|
|
|
|
default: |
|
|
|
default: |
|
|
|
return 'error'; |
|
|
|
return 'warning'; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -103,11 +100,11 @@ const AnvilHost = ({ |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
<Box flexGrow={1}> |
|
|
|
<Box flexGrow={1}> |
|
|
|
<Switch |
|
|
|
<Switch |
|
|
|
checked={host.state === 'ready'} |
|
|
|
checked={host.state === 'online'} |
|
|
|
onChange={() => |
|
|
|
onChange={() => |
|
|
|
putJSON('/set_power', { |
|
|
|
putJSON('/set_power', { |
|
|
|
host_uuid: host.host_uuid, |
|
|
|
host_uuid: host.host_uuid, |
|
|
|
is_on: !(host.state === 'ready'), |
|
|
|
is_on: !(host.state === 'online'), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
/> |
|
|
|
/> |
|
|
@ -117,18 +114,18 @@ const AnvilHost = ({ |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
<Box> |
|
|
|
<Box> |
|
|
|
<Switch |
|
|
|
<Switch |
|
|
|
checked={host.state === 'ready'} |
|
|
|
checked={host.state === 'online'} |
|
|
|
disabled={!host.removable} |
|
|
|
disabled={!host.removable} |
|
|
|
onChange={() => |
|
|
|
onChange={() => |
|
|
|
putJSON('/set_membership', { |
|
|
|
putJSON('/set_membership', { |
|
|
|
host_uuid: host.host_uuid, |
|
|
|
host_uuid: host.host_uuid, |
|
|
|
is_member: !(host.state === 'ready'), |
|
|
|
is_member: !(host.state === 'online'), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
{host.state !== 'ready' && ( |
|
|
|
{host.state !== 'online' && ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
<Box display="flex" width="100%" className={classes.state}> |
|
|
|
<Box display="flex" width="100%" className={classes.state}> |
|
|
|
<Box> |
|
|
|
<Box> |
|
|
|