Feat: Monitor Incidents Resolve
This commit is contained in:
1 parent
4933d11dfd
commit
3650c400ca
2 files changed
+13
-3
No files matched your search
@@ -192,6 +192,11 @@ const useAckMonitorChecks = () => {
|
||||
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 {
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Box, Button } from "@mui/material";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { useFetchMonitorsByTeamId } from "../../Hooks/monitorHooks";
|
||||
import { useFetchChecksSummaryByTeamId } from "../../Hooks/checkHooks";
|
||||
import { useAckAllChecks } from "../../Hooks/checkHooks";
|
||||
import { useAckAllChecks, useAckMonitorChecks } from "../../Hooks/checkHooks";
|
||||
import { useState, useEffect } from "react";
|
||||
import NetworkError from "../../Components/GenericFallback/NetworkError";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -35,6 +35,7 @@ const Incidents = () => {
|
||||
|
||||
//Hooks
|
||||
const [ackAllChecks, ackAllLoading] = useAckAllChecks();
|
||||
const [ackMonitorChecks, ackMonitorLoading] = useAckMonitorChecks();
|
||||
|
||||
//Utils
|
||||
const theme = useTheme();
|
||||
@@ -63,7 +64,11 @@ const Incidents = () => {
|
||||
}, [monitors]);
|
||||
|
||||
const handleAckAllChecks = () => {
|
||||
ackAllChecks(setUpdateTrigger);
|
||||
if (selectedMonitor === "0") {
|
||||
ackAllChecks(setUpdateTrigger);
|
||||
} else {
|
||||
ackMonitorChecks(selectedMonitor, setUpdateTrigger);
|
||||
}
|
||||
};
|
||||
|
||||
if (networkError || networkErrorSummary) {
|
||||
@@ -82,7 +87,7 @@ const Incidents = () => {
|
||||
variant="contained"
|
||||
color="accent"
|
||||
onClick={handleAckAllChecks}
|
||||
disabled={ackAllLoading}
|
||||
disabled={selectedMonitor === "0" ? ackAllLoading : ackMonitorLoading}
|
||||
>
|
||||
{selectedMonitor === "0" ? t("incidentsPageActionResolveAll") : t("incidentsPageActionResolveMonitor")}
|
||||
</Button>
|
||||
|
||||
Reference in new issue
Block a user