diff --git a/client/src/Hooks/checkHooks.js b/client/src/Hooks/checkHooks.js index f24466792..6fd48e828 100644 --- a/client/src/Hooks/checkHooks.js +++ b/client/src/Hooks/checkHooks.js @@ -226,6 +226,32 @@ const useAckAllChecks = () => { return [ackAllChecks, isLoading]; }; +const useAcknowledgeChecks = () => { + const [isLoading, setIsLoading] = useState(false); + const { t } = useTranslation(); + + const acknowledge = async (setUpdateTrigger, monitorId = null) => { + setIsLoading(true); + try { + if (monitorId) { + await networkService.updateMonitorChecksStatus({ monitorId, ack: true }); + } else { + await networkService.updateAllChecksStatus({ ack: true }); + } + setUpdateTrigger((prev) => !prev); + } catch (error) { + const toastMessage = monitorId + ? t("checkHooks.failureResolveMonitor") + : t("checkHooks.failureResolveAll"); + createToast({ body: toastMessage }); + } finally { + setIsLoading(false); + } + }; + + return { acknowledge, isLoading }; +}; + export { useFetchChecksByMonitor, useFetchChecksTeam, @@ -233,4 +259,5 @@ export { useResolveIncident, useAckMonitorChecks, useAckAllChecks, + useAcknowledgeChecks, }; diff --git a/client/src/Pages/Incidents/index.jsx b/client/src/Pages/Incidents/index.jsx index 780c91fe8..d963db9e7 100644 --- a/client/src/Pages/Incidents/index.jsx +++ b/client/src/Pages/Incidents/index.jsx @@ -11,7 +11,11 @@ import { Box, Button } from "@mui/material"; import { useTheme } from "@emotion/react"; import { useFetchMonitorsByTeamId } from "../../Hooks/monitorHooks"; import { useFetchChecksSummaryByTeamId } from "../../Hooks/checkHooks"; -import { useAckAllChecks, useAckMonitorChecks } from "../../Hooks/checkHooks"; +import { + useAckAllChecks, + useAckMonitorChecks, + useAcknowledgeChecks, +} from "../../Hooks/checkHooks"; import { useState, useEffect } from "react"; import NetworkError from "../../Components/GenericFallback/NetworkError"; import { useTranslation } from "react-i18next"; @@ -36,6 +40,7 @@ const Incidents = () => { //Hooks const [ackAllChecks, ackAllLoading] = useAckAllChecks(); const [ackMonitorChecks, ackMonitorLoading] = useAckMonitorChecks(); + const { acknowledge, isLoadingAcknowledge } = useAcknowledgeChecks(); //Utils const theme = useTheme(); @@ -71,6 +76,11 @@ const Incidents = () => { } }; + const handleAcknowledge = () => { + const monitorId = selectedMonitor === "0" ? null : selectedMonitor; + acknowledge(setUpdateTrigger, monitorId); + }; + if (networkError || networkErrorSummary) { return ( @@ -86,10 +96,12 @@ const Incidents = () => { - - - - - - - - - - - - - Message from Checkmate Service - - - - - - -

Hello {{ name }}!

-

- You are receiving this email because a password reset request has been made for {{ email }}. Please use the link below on the site to - reset your password. -

- Reset Password -

If you didn't request this, please ignore this email.

+ + + + + + + + + + + + + Message from Checkmate Service + + + + + + +

Hello {{ name }}!

+

+ You are receiving this email because a password reset request has been made for {{ email }}. Please use the link below on the site to + reset your password. +

+ Reset Password +

If you didn't request this, please ignore this email.

-

Thank you.

-
-
- - - -

This email was sent by Checkmate.

-
-
-
-
-
\ No newline at end of file +

Thank you.

+ + + + + +

This email was sent by Checkmate.

+
+
+ + + diff --git a/server/templates/serverIsDown.mjml b/server/templates/serverIsDown.mjml index 5375412ab..bf6424a6b 100755 --- a/server/templates/serverIsDown.mjml +++ b/server/templates/serverIsDown.mjml @@ -1,42 +1,68 @@ - - - - - - - - - - - - - Message from Checkmate Service - - - - - {{ monitor }} is down - - - - - - - -

Hello {{ name }}!

-

We detected an incident on one of your monitors. Your service is currently down. We'll send a message to you once it is up again.

-

Monitor name: {{ monitor }}

-

URL: {{ url }}

-
-
- - - View incident details - -

This email was sent by Checkmate.

-
-
-
-
-
\ No newline at end of file + + + + + + + + + + + + + Message from Checkmate Service + + + + + {{ monitor }} is down + + + + + + + +

Hello {{ name }}!

+

We detected an incident on one of your monitors. Your service is currently down. We'll send a message to you once it is up again.

+

Monitor name: {{ monitor }}

+

URL: {{ url }}

+
+
+ + + View incident details + +

This email was sent by Checkmate.

+
+
+
+
+ diff --git a/server/templates/welcomeEmail.mjml b/server/templates/welcomeEmail.mjml index b5e90ffaf..e9f569e3f 100755 --- a/server/templates/welcomeEmail.mjml +++ b/server/templates/welcomeEmail.mjml @@ -1,37 +1,51 @@ - - - - - - - - - - - - - Message from Checkmate Service - - - - - - -

Hello {{ name }}!

-

Thank you for trying out Checkmate! We developed it with great care to meet our own needs, and we're excited to share it with you.

-

Checkmate is an automated way of checking whether a service such as a website or an application is available or not.

-

We hope you find our service as valuable as we do.

-

Thank you.

-
-
- - - -

This email was sent by Checkmate.

-
-
-
-
-
\ No newline at end of file + + + + + + + + + + + + + Message from Checkmate Service + + + + + + +

Hello {{ name }}!

+

Thank you for trying out Checkmate! We developed it with great care to meet our own needs, and we're excited to share it with you.

+

Checkmate is an automated way of checking whether a service such as a website or an application is available or not.

+

We hope you find our service as valuable as we do.

+

Thank you.

+
+
+ + + +

This email was sent by Checkmate.

+
+
+
+
+