Minor Changes
This commit is contained in:
1 parent
644de5f34a
commit
278964500b
5 files changed
+14
-11
No files matched your search
@@ -108,7 +108,7 @@ const StatusBox = ({ title, value, status }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
StatusBox.propTypes = {
|
StatusBox.propTypes = {
|
||||||
title: PropTypes.string,
|
title: PropTypes.string.isRequired,
|
||||||
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
||||||
status: PropTypes.string,
|
status: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ import PropTypes from "prop-types";
|
|||||||
import { Stack } from "@mui/material";
|
import { Stack } from "@mui/material";
|
||||||
import StatusBox from "./StatusBox";
|
import StatusBox from "./StatusBox";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import SkeletonLayout from "./skeleton";
|
import SkeletonLayout from "./skeleton";
|
||||||
|
|
||||||
const StatusBoxes = ({ isLoading, summary }) => {
|
const StatusBoxes = ({ isLoading, summary }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation();
|
||||||
if (isLoading) return <SkeletonLayout shouldRender={isLoading} />;
|
if (isLoading) return <SkeletonLayout shouldRender={isLoading} />;
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
@@ -14,21 +16,21 @@ const StatusBoxes = ({ isLoading, summary }) => {
|
|||||||
justifyContent="space-between"
|
justifyContent="space-between"
|
||||||
>
|
>
|
||||||
<StatusBox
|
<StatusBox
|
||||||
title={"Total Incidents"}
|
title={t("incidentsOptionsHeaderTotalIncidents")}
|
||||||
value={summary?.totalChecks || 0}
|
value={summary?.totalChecks || 0}
|
||||||
/>
|
/>
|
||||||
<StatusBox
|
<StatusBox
|
||||||
title={"Resolved"}
|
title={t("incidentsOptionsHeaderFilterResolved")}
|
||||||
status="up"
|
status="up"
|
||||||
value={summary?.resolvedChecks || 0}
|
value={summary?.resolvedChecks || 0}
|
||||||
/>
|
/>
|
||||||
<StatusBox
|
<StatusBox
|
||||||
title={"Cannot Resolve"}
|
title={t("incidentsOptionsHeaderFilterCannotResolve")}
|
||||||
status="paused"
|
status="paused"
|
||||||
value={summary?.cannotResolveChecks || 0}
|
value={summary?.cannotResolveChecks || 0}
|
||||||
/>
|
/>
|
||||||
<StatusBox
|
<StatusBox
|
||||||
title={"Down"}
|
title={t("incidentsOptionsHeaderFilterDown")}
|
||||||
status="down"
|
status="down"
|
||||||
value={summary?.downChecks || 0}
|
value={summary?.downChecks || 0}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -385,7 +385,8 @@
|
|||||||
"incidentsOptionsHeader": "Incidents for:",
|
"incidentsOptionsHeader": "Incidents for:",
|
||||||
"incidentsOptionsHeaderFilterAll": "All",
|
"incidentsOptionsHeaderFilterAll": "All",
|
||||||
"incidentsOptionsHeaderFilterBy": "Filter by:",
|
"incidentsOptionsHeaderFilterBy": "Filter by:",
|
||||||
"incidentsOptionsHeaderFilterCannotResolve": "Cannot resolve",
|
"incidentsOptionsHeaderTotalIncidents": "Total Incidents",
|
||||||
|
"incidentsOptionsHeaderFilterCannotResolve": "Cannot Resolve",
|
||||||
"incidentsOptionsHeaderFilterDown": "Down",
|
"incidentsOptionsHeaderFilterDown": "Down",
|
||||||
"incidentsOptionsHeaderFilterResolved": "Resolved",
|
"incidentsOptionsHeaderFilterResolved": "Resolved",
|
||||||
"incidentsOptionsHeaderLastDay": "Last day",
|
"incidentsOptionsHeaderLastDay": "Last day",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import PageSpeedCheck from "../../models/PageSpeedCheck.js";
|
|||||||
import User from "../../models/User.js";
|
import User from "../../models/User.js";
|
||||||
import logger from "../../../utils/logger.js";
|
import logger from "../../../utils/logger.js";
|
||||||
import { ObjectId } from "mongodb";
|
import { ObjectId } from "mongodb";
|
||||||
import { buildChecksAndSummaryByTeamIdPipeline } from "./checkModuleQueries.js";
|
import { buildChecksSummaryByTeamIdPipeline } from "./checkModuleQueries.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "checkModule";
|
const SERVICE_NAME = "checkModule";
|
||||||
const dateRangeLookup = {
|
const dateRangeLookup = {
|
||||||
@@ -318,12 +318,12 @@ const getChecksSummaryByTeamId = async ({ teamId }) => {
|
|||||||
teamId: new ObjectId(teamId),
|
teamId: new ObjectId(teamId),
|
||||||
};
|
};
|
||||||
const checks = await Check.aggregate(
|
const checks = await Check.aggregate(
|
||||||
buildChecksAndSummaryByTeamIdPipeline({ matchStage })
|
buildChecksSummaryByTeamIdPipeline({ matchStage })
|
||||||
);
|
);
|
||||||
return checks[0].summary;
|
return checks[0].summary;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
error.service = SERVICE_NAME;
|
error.service = SERVICE_NAME;
|
||||||
error.method = "getChecksAndSummaryByTeamId";
|
error.method = "getChecksSummaryByTeamId";
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const buildChecksAndSummaryByTeamIdPipeline = ({ matchStage }) => {
|
const buildChecksSummaryByTeamIdPipeline = ({ matchStage }) => {
|
||||||
return [
|
return [
|
||||||
{ $match: matchStage },
|
{ $match: matchStage },
|
||||||
{
|
{
|
||||||
@@ -45,4 +45,4 @@ const buildChecksAndSummaryByTeamIdPipeline = ({ matchStage }) => {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
export { buildChecksAndSummaryByTeamIdPipeline };
|
export { buildChecksSummaryByTeamIdPipeline };
|
||||||
Reference in new issue
Block a user