|
|
@ -3,7 +3,6 @@ import { makeStyles } from '@material-ui/core/styles'; |
|
|
|
import * as prettyBytes from 'pretty-bytes'; |
|
|
|
import * as prettyBytes from 'pretty-bytes'; |
|
|
|
import { AllocationBar } from '../Bars'; |
|
|
|
import { AllocationBar } from '../Bars'; |
|
|
|
import { BodyText } from '../Text'; |
|
|
|
import { BodyText } from '../Text'; |
|
|
|
import Decorator from '../Decorator'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const useStyles = makeStyles(() => ({ |
|
|
|
const useStyles = makeStyles(() => ({ |
|
|
|
fs: { |
|
|
|
fs: { |
|
|
@ -21,58 +20,53 @@ const useStyles = makeStyles(() => ({ |
|
|
|
})); |
|
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
const SharedStorageHost = ({ |
|
|
|
const SharedStorageHost = ({ |
|
|
|
host, |
|
|
|
group, |
|
|
|
}: { |
|
|
|
}: { |
|
|
|
host: AnvilSharedStorageHost; |
|
|
|
group: AnvilSharedStorageGroup; |
|
|
|
}): JSX.Element => { |
|
|
|
}): JSX.Element => { |
|
|
|
const classes = useStyles(); |
|
|
|
const classes = useStyles(); |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
<Box display="flex" width="100%" className={classes.fs}> |
|
|
|
<Box display="flex" width="100%" className={classes.fs}> |
|
|
|
<Box flexGrow={1}> |
|
|
|
<Box flexGrow={1}> |
|
|
|
<BodyText text={host.host_name || 'Not Available'} /> |
|
|
|
<BodyText |
|
|
|
</Box> |
|
|
|
text={`Used: ${prettyBytes.default( |
|
|
|
<Box className={classes.decoratorBox}> |
|
|
|
group.storage_group_total - group.storage_group_free, |
|
|
|
<Decorator colour={host.is_mounted ? 'ok' : 'error'} /> |
|
|
|
{ |
|
|
|
|
|
|
|
binary: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
)}`}
|
|
|
|
|
|
|
|
/> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
<Box> |
|
|
|
<Box> |
|
|
|
<BodyText text={host.is_mounted ? 'Mounted' : 'Not Mounted'} /> |
|
|
|
<BodyText |
|
|
|
|
|
|
|
text={`Free: ${prettyBytes.default(group.storage_group_free, { |
|
|
|
|
|
|
|
binary: true, |
|
|
|
|
|
|
|
})}`}
|
|
|
|
|
|
|
|
/> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
{host.is_mounted && ( |
|
|
|
<Box display="flex" width="100%" className={classes.bar}> |
|
|
|
<> |
|
|
|
<Box flexGrow={1}> |
|
|
|
<Box display="flex" width="100%" className={classes.fs}> |
|
|
|
<AllocationBar |
|
|
|
<Box flexGrow={1}> |
|
|
|
allocated={ |
|
|
|
<BodyText |
|
|
|
((group.storage_group_total - group.storage_group_free) / |
|
|
|
text={`Used: ${prettyBytes.default(host.total - host.free, { |
|
|
|
group.storage_group_total) * |
|
|
|
binary: true, |
|
|
|
100 |
|
|
|
})}`}
|
|
|
|
} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
<Box> |
|
|
|
</Box> |
|
|
|
<BodyText |
|
|
|
<Box display="flex" justifyContent="center" width="100%"> |
|
|
|
text={`Free: ${prettyBytes.default(host.free, { |
|
|
|
<BodyText |
|
|
|
binary: true, |
|
|
|
text={`Total Storage: ${prettyBytes.default( |
|
|
|
})}`}
|
|
|
|
group.storage_group_total, |
|
|
|
/> |
|
|
|
{ |
|
|
|
</Box> |
|
|
|
binary: true, |
|
|
|
</Box> |
|
|
|
}, |
|
|
|
<Box display="flex" width="100%" className={classes.bar}> |
|
|
|
)}`}
|
|
|
|
<Box flexGrow={1}> |
|
|
|
/> |
|
|
|
<AllocationBar |
|
|
|
</Box> |
|
|
|
allocated={((host.total - host.free) / host.total) * 100} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</Box> |
|
|
|
|
|
|
|
</Box> |
|
|
|
|
|
|
|
<Box display="flex" justifyContent="center" width="100%"> |
|
|
|
|
|
|
|
<BodyText |
|
|
|
|
|
|
|
text={`Total Storage: ${prettyBytes.default(host.total, { |
|
|
|
|
|
|
|
binary: true, |
|
|
|
|
|
|
|
})}`}
|
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</Box> |
|
|
|
|
|
|
|
</> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
</> |
|
|
|
</> |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|