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) => {
|
const ackMonitorChecks = async (monitorId, setUpdateTrigger) => {
|
||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
await networkService.updateMonitorChecksStatus({
|
||||||
|
monitorId,
|
||||||
|
ack: true,
|
||||||
|
});
|
||||||
|
setUpdateTrigger((prev) => !prev);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
createToast({ body: t("checkHooks.failureResolveMonitor") });
|
createToast({ body: t("checkHooks.failureResolveMonitor") });
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -11,7 +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 { useAckAllChecks } from "../../Hooks/checkHooks";
|
import { useAckAllChecks, useAckMonitorChecks } 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";
|
||||||
@@ -35,6 +35,7 @@ const Incidents = () => {
|
|||||||
|
|
||||||
//Hooks
|
//Hooks
|
||||||
const [ackAllChecks, ackAllLoading] = useAckAllChecks();
|
const [ackAllChecks, ackAllLoading] = useAckAllChecks();
|
||||||
|
const [ackMonitorChecks, ackMonitorLoading] = useAckMonitorChecks();
|
||||||
|
|
||||||
//Utils
|
//Utils
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
@@ -63,7 +64,11 @@ const Incidents = () => {
|
|||||||
}, [monitors]);
|
}, [monitors]);
|
||||||
|
|
||||||
const handleAckAllChecks = () => {
|
const handleAckAllChecks = () => {
|
||||||
ackAllChecks(setUpdateTrigger);
|
if (selectedMonitor === "0") {
|
||||||
|
ackAllChecks(setUpdateTrigger);
|
||||||
|
} else {
|
||||||
|
ackMonitorChecks(selectedMonitor, setUpdateTrigger);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (networkError || networkErrorSummary) {
|
if (networkError || networkErrorSummary) {
|
||||||
@@ -82,7 +87,7 @@ const Incidents = () => {
|
|||||||
variant="contained"
|
variant="contained"
|
||||||
color="accent"
|
color="accent"
|
||||||
onClick={handleAckAllChecks}
|
onClick={handleAckAllChecks}
|
||||||
disabled={ackAllLoading}
|
disabled={selectedMonitor === "0" ? ackAllLoading : ackMonitorLoading}
|
||||||
>
|
>
|
||||||
{selectedMonitor === "0" ? t("incidentsPageActionResolveAll") : t("incidentsPageActionResolveMonitor")}
|
{selectedMonitor === "0" ? t("incidentsPageActionResolveAll") : t("incidentsPageActionResolveMonitor")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in new issue
Block a user