Removal of old code
This commit is contained in:
1 parent
b7093b5de5
commit
7236e85321
2 files changed
+1
-58
No files matched your search
@@ -185,47 +185,6 @@ const useResolveIncident = () => {
|
|||||||
return [resolveIncident, isLoading];
|
return [resolveIncident, isLoading];
|
||||||
};
|
};
|
||||||
|
|
||||||
const useAckMonitorChecks = () => {
|
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
const ackMonitorChecks = async (monitorId, setUpdateTrigger) => {
|
|
||||||
try {
|
|
||||||
setIsLoading(true);
|
|
||||||
await networkService.updateMonitorChecksStatus({
|
|
||||||
monitorId,
|
|
||||||
ack: true,
|
|
||||||
});
|
|
||||||
setUpdateTrigger((prev) => !prev);
|
|
||||||
} catch (error) {
|
|
||||||
createToast({ body: t("checkHooks.failureResolveMonitor") });
|
|
||||||
} finally {
|
|
||||||
setIsLoading(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return [ackMonitorChecks, isLoading];
|
|
||||||
};
|
|
||||||
|
|
||||||
const useAckAllChecks = () => {
|
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
const ackAllChecks = async (setUpdateTrigger) => {
|
|
||||||
try {
|
|
||||||
setIsLoading(true);
|
|
||||||
await networkService.updateAllChecksStatus({ ack: true });
|
|
||||||
setUpdateTrigger((prev) => !prev);
|
|
||||||
} catch (error) {
|
|
||||||
createToast({ body: t("checkHooks.failureResolveAll") });
|
|
||||||
} finally {
|
|
||||||
setIsLoading(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return [ackAllChecks, isLoading];
|
|
||||||
};
|
|
||||||
|
|
||||||
const useAcknowledgeChecks = () => {
|
const useAcknowledgeChecks = () => {
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -257,7 +216,5 @@ export {
|
|||||||
useFetchChecksTeam,
|
useFetchChecksTeam,
|
||||||
useFetchChecksSummaryByTeamId,
|
useFetchChecksSummaryByTeamId,
|
||||||
useResolveIncident,
|
useResolveIncident,
|
||||||
useAckMonitorChecks,
|
|
||||||
useAckAllChecks,
|
|
||||||
useAcknowledgeChecks,
|
useAcknowledgeChecks,
|
||||||
};
|
};
|
||||||
@@ -11,11 +11,7 @@ import { Box, Button } from "@mui/material";
|
|||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { useFetchMonitorsByTeamId } from "../../Hooks/monitorHooks";
|
import { useFetchMonitorsByTeamId } from "../../Hooks/monitorHooks";
|
||||||
import { useFetchChecksSummaryByTeamId } from "../../Hooks/checkHooks";
|
import { useFetchChecksSummaryByTeamId } from "../../Hooks/checkHooks";
|
||||||
import {
|
import { useAcknowledgeChecks } from "../../Hooks/checkHooks";
|
||||||
useAckAllChecks,
|
|
||||||
useAckMonitorChecks,
|
|
||||||
useAcknowledgeChecks,
|
|
||||||
} from "../../Hooks/checkHooks";
|
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import NetworkError from "../../Components/GenericFallback/NetworkError";
|
import NetworkError from "../../Components/GenericFallback/NetworkError";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -38,8 +34,6 @@ const Incidents = () => {
|
|||||||
const [updateTrigger, setUpdateTrigger] = useState(false);
|
const [updateTrigger, setUpdateTrigger] = useState(false);
|
||||||
|
|
||||||
//Hooks
|
//Hooks
|
||||||
const [ackAllChecks, ackAllLoading] = useAckAllChecks();
|
|
||||||
const [ackMonitorChecks, ackMonitorLoading] = useAckMonitorChecks();
|
|
||||||
const { acknowledge, isLoadingAcknowledge } = useAcknowledgeChecks();
|
const { acknowledge, isLoadingAcknowledge } = useAcknowledgeChecks();
|
||||||
|
|
||||||
//Utils
|
//Utils
|
||||||
@@ -68,14 +62,6 @@ const Incidents = () => {
|
|||||||
setMonitorLookup(monitorLookup);
|
setMonitorLookup(monitorLookup);
|
||||||
}, [monitors]);
|
}, [monitors]);
|
||||||
|
|
||||||
const handleAckAllChecks = () => {
|
|
||||||
if (selectedMonitor === "0") {
|
|
||||||
ackAllChecks(setUpdateTrigger);
|
|
||||||
} else {
|
|
||||||
ackMonitorChecks(selectedMonitor, setUpdateTrigger);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleAcknowledge = () => {
|
const handleAcknowledge = () => {
|
||||||
const monitorId = selectedMonitor === "0" ? null : selectedMonitor;
|
const monitorId = selectedMonitor === "0" ? null : selectedMonitor;
|
||||||
acknowledge(setUpdateTrigger, monitorId);
|
acknowledge(setUpdateTrigger, monitorId);
|
||||||
|
|||||||
Reference in new issue
Block a user