2025-01-28 15:42:09 -08:00
|
|
|
import StatusBoxes from "../../../../../Components/StatusBoxes";
|
2025-01-27 13:18:05 -08:00
|
|
|
import StatBox from "../../../../../Components/StatBox";
|
2025-01-28 15:42:09 -08:00
|
|
|
import { getHumanReadableDuration } from "../../../../../Utils/timeUtils";
|
2025-01-27 13:18:05 -08:00
|
|
|
import { useTheme } from "@mui/material/styles";
|
2025-01-28 15:42:09 -08:00
|
|
|
import { Typography } from "@mui/material";
|
2025-01-28 11:05:06 -08:00
|
|
|
import useUtils from "../../../Monitors/Hooks/useUtils";
|
2025-01-28 15:42:09 -08:00
|
|
|
|
|
|
|
|
const UptimeStatusBoxes = ({ shouldRender, monitor, certificateExpiry }) => {
|
2025-01-27 14:58:37 -08:00
|
|
|
const theme = useTheme();
|
|
|
|
|
const { determineState } = useUtils();
|
2025-01-27 13:18:05 -08:00
|
|
|
const { time: streakTime, units: streakUnits } = getHumanReadableDuration(
|
|
|
|
|
monitor?.uptimeStreak
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const { time: lastCheckTime, units: lastCheckUnits } = getHumanReadableDuration(
|
|
|
|
|
monitor?.timeSinceLastCheck
|
|
|
|
|
);
|
|
|
|
|
return (
|
2025-01-28 15:42:09 -08:00
|
|
|
<StatusBoxes shouldRender={shouldRender}>
|
2025-01-27 13:18:05 -08:00
|
|
|
<StatBox
|
|
|
|
|
gradient={true}
|
|
|
|
|
status={determineState(monitor)}
|
|
|
|
|
heading={"active for"}
|
|
|
|
|
subHeading={
|
|
|
|
|
<>
|
|
|
|
|
{streakTime}
|
|
|
|
|
<Typography component="span">{streakUnits}</Typography>
|
|
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<StatBox
|
|
|
|
|
heading="last check"
|
|
|
|
|
subHeading={
|
|
|
|
|
<>
|
|
|
|
|
{lastCheckTime}
|
|
|
|
|
<Typography component="span">{lastCheckUnits}</Typography>
|
|
|
|
|
<Typography component="span">{"ago"}</Typography>
|
|
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<StatBox
|
|
|
|
|
heading="last response time"
|
|
|
|
|
subHeading={
|
|
|
|
|
<>
|
|
|
|
|
{monitor?.latestResponseTime}
|
|
|
|
|
<Typography component="span">{"ms"}</Typography>
|
|
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<StatBox
|
|
|
|
|
heading="certificate expiry"
|
|
|
|
|
subHeading={
|
|
|
|
|
<Typography
|
|
|
|
|
component="span"
|
|
|
|
|
fontSize={13}
|
|
|
|
|
color={theme.palette.primary.contrastText}
|
|
|
|
|
>
|
|
|
|
|
{certificateExpiry}
|
|
|
|
|
</Typography>
|
|
|
|
|
}
|
|
|
|
|
/>
|
2025-01-28 15:42:09 -08:00
|
|
|
</StatusBoxes>
|
2025-01-27 13:18:05 -08:00
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2025-01-28 15:42:09 -08:00
|
|
|
export default UptimeStatusBoxes;
|