Add status header
This commit is contained in:
1 parent
48475c4767
commit
8e405b0ab7
2 files changed
+90
-1
No files matched your search
@@ -0,0 +1,84 @@
|
|||||||
|
// Components
|
||||||
|
import { ColContainer } from "../../../../../Components/StandardContainer";
|
||||||
|
import { Stack, Typography } from "@mui/material";
|
||||||
|
import PulseDot from "../../../../../Components/Animated/PulseDot";
|
||||||
|
import LastUpdate from "../LastUpdate";
|
||||||
|
|
||||||
|
// Utils
|
||||||
|
import { useTheme } from "@emotion/react";
|
||||||
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
|
const StatusHeader = ({ monitor, connectionStatus }) => {
|
||||||
|
console.log(monitor);
|
||||||
|
|
||||||
|
const theme = useTheme();
|
||||||
|
|
||||||
|
const COLOR_MAP = {
|
||||||
|
up: theme.palette.distributedStatusHeader.up,
|
||||||
|
down: theme.palette.distributedStatusHeader.down,
|
||||||
|
};
|
||||||
|
|
||||||
|
const MSG_MAP = {
|
||||||
|
up: "All Systems Operational",
|
||||||
|
down: "Last Check Failed",
|
||||||
|
};
|
||||||
|
|
||||||
|
const PULSE_COLOR = {
|
||||||
|
up: theme.palette.success.main,
|
||||||
|
down: theme.palette.error.main,
|
||||||
|
};
|
||||||
|
|
||||||
|
let bgColor = COLOR_MAP[connectionStatus];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ColContainer backgroundColor={bgColor}>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
gap={theme.spacing(8)}
|
||||||
|
>
|
||||||
|
<PulseDot color={PULSE_COLOR[connectionStatus]} />
|
||||||
|
<Stack>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
gap={theme.spacing(8)}
|
||||||
|
>
|
||||||
|
<Typography
|
||||||
|
variant="h1"
|
||||||
|
color={theme.palette.distributedStatusHeader.primaryText}
|
||||||
|
>
|
||||||
|
{MSG_MAP[connectionStatus]}
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
variant="body2"
|
||||||
|
borderRadius={theme.spacing(8)}
|
||||||
|
padding={theme.spacing(4)}
|
||||||
|
backgroundColor={
|
||||||
|
theme.palette.distributedStatusHeader.primaryTextBackground
|
||||||
|
}
|
||||||
|
color={theme.palette.distributedStatusHeader.primaryText}
|
||||||
|
>
|
||||||
|
Uptime: {(monitor.totalUptime * 100).toFixed(2)}%
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Typography
|
||||||
|
variant="body2"
|
||||||
|
color={theme.palette.distributedStatusHeader.secondaryText}
|
||||||
|
>
|
||||||
|
Last updated{" "}
|
||||||
|
<LastUpdate
|
||||||
|
suffix={"seconds ago"}
|
||||||
|
lastUpdateTime={monitor.timeSinceLastCheck}
|
||||||
|
/>
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
</ColContainer>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
StatusHeader.propTypes = {
|
||||||
|
monitor: PropTypes.object,
|
||||||
|
connectionStatus: PropTypes.string,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default StatusHeader;
|
||||||
@@ -12,10 +12,10 @@ import MonitorTimeFrameHeader from "../../../Components/MonitorTimeFrameHeader";
|
|||||||
import GenericFallback from "../../../Components/GenericFallback";
|
import GenericFallback from "../../../Components/GenericFallback";
|
||||||
import Dialog from "../../../Components/Dialog";
|
import Dialog from "../../../Components/Dialog";
|
||||||
import SkeletonLayout from "./Components/Skeleton";
|
import SkeletonLayout from "./Components/Skeleton";
|
||||||
import StatBox from "../../../Components/StatBox";
|
|
||||||
import UptLogo from "../../../assets/icons/upt_logo.png";
|
import UptLogo from "../../../assets/icons/upt_logo.png";
|
||||||
import PeopleAltOutlinedIcon from "@mui/icons-material/PeopleAltOutlined";
|
import PeopleAltOutlinedIcon from "@mui/icons-material/PeopleAltOutlined";
|
||||||
import InfoBox from "../../../Components/InfoBox";
|
import InfoBox from "../../../Components/InfoBox";
|
||||||
|
import StatusHeader from "../../DistributedUptime/Details/Components/StatusHeader";
|
||||||
|
|
||||||
//Utils
|
//Utils
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
@@ -150,6 +150,11 @@ const DistributedUptimeStatus = () => {
|
|||||||
type="distributed"
|
type="distributed"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<StatusHeader
|
||||||
|
monitor={monitor}
|
||||||
|
connectionStatus={connectionStatus}
|
||||||
|
/>
|
||||||
|
|
||||||
<NextExpectedCheck
|
<NextExpectedCheck
|
||||||
lastUpdateTime={monitor?.timeSinceLastCheck ?? 0}
|
lastUpdateTime={monitor?.timeSinceLastCheck ?? 0}
|
||||||
interval={monitor?.interval ?? 0}
|
interval={monitor?.interval ?? 0}
|
||||||
|
|||||||
Reference in new issue
Block a user