This repository has been archived by the owner on Jul 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improved Uptime component, max uptime 100%
- Loading branch information
1 parent
e87a991
commit 1f1e43c
Showing
5 changed files
with
112 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// @flow | ||
import React from 'react'; | ||
|
||
import useStyles from './styles'; | ||
|
||
const Uptime = ({ | ||
lastEpochUptimePercent, | ||
cumulativeUptimePercent, | ||
uptimeEpochs, | ||
uptimeComplete, | ||
}: { | ||
lastEpochUptimePercent: number, | ||
cumulativeUptimePercent: number, | ||
uptimeEpochs: number, | ||
uptimeComplete: boolean, | ||
}) => { | ||
const classes = useStyles(); | ||
|
||
const uptimeDescription = | ||
lastEpochUptimePercent && | ||
cumulativeUptimePercent && | ||
uptimeEpochs && | ||
`Last Epoch Uptime: ${lastEpochUptimePercent.toFixed( | ||
1, | ||
)}%; Recent Cumulative Uptime: ${cumulativeUptimePercent.toFixed( | ||
3, | ||
)}%; Epochs: ${uptimeEpochs}`; | ||
|
||
const uptimeDisplay = | ||
(cumulativeUptimePercent && | ||
`${cumulativeUptimePercent.toFixed(cumulativeUptimePercent ? 4 : 2)}%`) || | ||
'Unavailable'; | ||
|
||
return ( | ||
<div className={classes.root} title={uptimeDescription}> | ||
{uptimeDisplay} | ||
{!uptimeComplete && ( | ||
<span | ||
title={`NOTE: Uptime calculation only contains ${uptimeEpochs} epochs`} | ||
> | ||
*** | ||
</span> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Uptime; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {makeStyles} from '@material-ui/core'; | ||
|
||
export default makeStyles(theme => ({ | ||
root: { | ||
display: 'flex', | ||
alignItems: 'center', | ||
'& div': { | ||
'&:first-child': { | ||
marginRight: 15, | ||
}, | ||
whiteSpace: 'nowrap', | ||
textOverflow: 'ellipsis', | ||
overflow: 'hidden', | ||
}, | ||
[theme.breakpoints.down('sm')]: { | ||
marginBottom: 22, | ||
}, | ||
}, | ||
})); |