Feat: Hooks for Summary
This commit is contained in:
1 parent
5428999d46
commit
644de5f34a
8 files changed
+91
-38
No files matched your search
@@ -22,31 +22,31 @@ const StatusBox = ({ title, value, status }) => {
|
||||
color = theme.palette.success.lowContrast;
|
||||
icon = (
|
||||
<Box sx={{ ...sharedStyles, top: 8 }}>
|
||||
<TaskAltOutlinedIcon fontSize="small"/>
|
||||
<TaskAltOutlinedIcon fontSize="small" />
|
||||
</Box>
|
||||
);
|
||||
} else if (status === "down") {
|
||||
color = theme.palette.error.lowContrast;
|
||||
icon = (
|
||||
<Box sx={{ ...sharedStyles, transform: "rotate(180deg)", top: 5 }}>
|
||||
<CancelOutlinedIcon fontSize="small"/>
|
||||
<CancelOutlinedIcon fontSize="small" />
|
||||
</Box>
|
||||
);
|
||||
} else if (status === "paused") {
|
||||
color = theme.palette.warning.lowContrast;
|
||||
icon = (
|
||||
<Box sx={{ ...sharedStyles, top: 12, right: 12 }}>
|
||||
<WarningAmberRoundedIcon fontSize="small"/>
|
||||
<WarningAmberRoundedIcon fontSize="small" />
|
||||
</Box>
|
||||
);
|
||||
} else {
|
||||
color = theme.palette.accent.main;
|
||||
icon = (
|
||||
<Box sx={{ ...sharedStyles, top: 12, right: 12 }}>
|
||||
<MonitorHeartOutlinedIcon fontSize="small"/>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
color = theme.palette.accent.main;
|
||||
icon = (
|
||||
<Box sx={{ ...sharedStyles, top: 12, right: 12 }}>
|
||||
<MonitorHeartOutlinedIcon fontSize="small" />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Box
|
||||
@@ -113,4 +113,4 @@ StatusBox.propTypes = {
|
||||
status: PropTypes.string,
|
||||
};
|
||||
|
||||
export default StatusBox;
|
||||
export default StatusBox;
|
||||
@@ -4,7 +4,7 @@ import StatusBox from "./StatusBox";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import SkeletonLayout from "./skeleton";
|
||||
|
||||
const StatusBoxes = ({ isLoading, statusCounts }) => {
|
||||
const StatusBoxes = ({ isLoading, summary }) => {
|
||||
const theme = useTheme();
|
||||
if (isLoading) return <SkeletonLayout shouldRender={isLoading} />;
|
||||
return (
|
||||
@@ -15,35 +15,30 @@ const StatusBoxes = ({ isLoading, statusCounts }) => {
|
||||
>
|
||||
<StatusBox
|
||||
title={"Total Incidents"}
|
||||
value={statusCounts?.total || 0}
|
||||
value={summary?.totalChecks || 0}
|
||||
/>
|
||||
<StatusBox
|
||||
title={"Resolved"}
|
||||
status="up"
|
||||
value={statusCounts?.resolved || 0}
|
||||
value={summary?.resolvedChecks || 0}
|
||||
/>
|
||||
<StatusBox
|
||||
title={"Cannot Resolve"}
|
||||
status="paused"
|
||||
value={summary?.cannotResolveChecks || 0}
|
||||
/>
|
||||
<StatusBox
|
||||
title={"Down"}
|
||||
status="down"
|
||||
value={summary?.downChecks || 0}
|
||||
/>
|
||||
<StatusBox
|
||||
title={"Cannot Resolve"}
|
||||
status="paused"
|
||||
value={statusCounts?.cannotResolve || 0}
|
||||
/>
|
||||
<StatusBox
|
||||
title={"Down"}
|
||||
status="down"
|
||||
value={statusCounts?.down || 0}
|
||||
/>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
|
||||
StatusBoxes.propTypes = {
|
||||
isLoading: PropTypes.bool,
|
||||
statusCounts: PropTypes.shape({
|
||||
total: PropTypes.number,
|
||||
resolved: PropTypes.number,
|
||||
cannotResolve: PropTypes.number,
|
||||
down: PropTypes.number,
|
||||
}),
|
||||
summary: PropTypes.object,
|
||||
};
|
||||
|
||||
export default StatusBoxes;
|
||||
export default StatusBoxes;
|
||||
Reference in new issue
Block a user