Merge pull request #2570 from loma373/feat/if-no-notif

feat: disable send test notification when 0 notifications are configured
This commit is contained in:
Alexander Holliday authored and GitHub committed 2025-07-04 02:24:04 +08:00
commit 8f46da0907
12 files changed
+38 -13

No files matched your search

@@ -2,6 +2,7 @@ import Stack from "@mui/material/Stack";
import Status from "./status";
import Skeleton from "./skeleton";
import Button from "@mui/material/Button";
import { Tooltip } from "@mui/material";
import SettingsOutlinedIcon from "@mui/icons-material/SettingsOutlined";
import PauseOutlinedIcon from "@mui/icons-material/PauseOutlined";
import PlayArrowOutlinedIcon from "@mui/icons-material/PlayArrowOutlined";
@@ -40,6 +41,10 @@ const MonitorDetailsControlHeader = ({
const { t } = useTranslation();
const [pauseMonitor, isPausing, error] = usePauseMonitor();
const isTestNotificationsDisabled = monitor?.notifications?.length === 0;
const tooltipTitle = isTestNotificationsDisabled ? t("testNotificationsDisabled") : "";
// const [isSending, emailError, sendTestEmail] = useSendTestEmail();
const [testAllNotifications, isSending, errorAllNotifications] =
@@ -60,20 +65,29 @@ const MonitorDetailsControlHeader = ({
direction="row"
gap={theme.spacing(2)}
>
<Button
variant="contained"
color="secondary"
loading={isSending}
startIcon={<EmailIcon />}
onClick={() => {
testAllNotifications({ monitorId: monitor?._id });
}}
sx={{
whiteSpace: "nowrap",
}}
<Tooltip
key={monitor?._id}
placement="bottom"
title={tooltipTitle}
>
{t("sendTestNotifications")}
</Button>
<span>
<Button
variant="contained"
color="secondary"
loading={isSending}
startIcon={<EmailIcon />}
disabled={isTestNotificationsDisabled}
onClick={() => {
testAllNotifications({ monitorId: monitor?._id });
}}
sx={{
whiteSpace: "nowrap",
}}
>
{t("sendTestNotifications")}
</Button>
</span>
</Tooltip>
<Button
variant="contained"
color="secondary"
+1
View File
@@ -690,6 +690,7 @@
},
"advancedMatching": "",
"sendTestNotifications": "",
"testNotificationsDisabled": "",
"selectAll": "",
"showAdminLoginLink": "",
"logsPage": {
+1
View File
@@ -690,6 +690,7 @@
},
"advancedMatching": "",
"sendTestNotifications": "",
"testNotificationsDisabled": "",
"selectAll": "",
"showAdminLoginLink": "",
"logsPage": {
+1
View File
@@ -690,6 +690,7 @@
},
"advancedMatching": "",
"sendTestNotifications": "",
"testNotificationsDisabled": "",
"selectAll": "",
"showAdminLoginLink": "",
"logsPage": {
+1
View File
@@ -827,6 +827,7 @@
"teamMembers": "Team members"
},
"testLocale": "testLocale",
"testNotificationsDisabled": "There are no notifications setup for this monitor. You need to add one by clicking 'Configure' button",
"timeZoneInfo": "All dates and times are in GMT+0 time zone.",
"timezone": "Timezone",
"title": "Title",
+1
View File
@@ -690,6 +690,7 @@
},
"advancedMatching": "",
"sendTestNotifications": "",
"testNotificationsDisabled": "",
"selectAll": "",
"showAdminLoginLink": "",
"logsPage": {
+1
View File
@@ -690,6 +690,7 @@
},
"advancedMatching": "",
"sendTestNotifications": "",
"testNotificationsDisabled": "",
"selectAll": "",
"showAdminLoginLink": "",
"logsPage": {
+1
View File
@@ -690,6 +690,7 @@
},
"advancedMatching": "",
"sendTestNotifications": "",
"testNotificationsDisabled": "",
"selectAll": "",
"showAdminLoginLink": "",
"logsPage": {
+1
View File
@@ -690,6 +690,7 @@
},
"advancedMatching": "",
"sendTestNotifications": "",
"testNotificationsDisabled": "",
"selectAll": "",
"showAdminLoginLink": "",
"logsPage": {
+1
View File
@@ -690,6 +690,7 @@
},
"advancedMatching": "",
"sendTestNotifications": "",
"testNotificationsDisabled": "",
"selectAll": "",
"showAdminLoginLink": "",
"logsPage": {
+1
View File
@@ -690,6 +690,7 @@
},
"advancedMatching": "",
"sendTestNotifications": "Bildirimleri dene",
"testNotificationsDisabled": "",
"selectAll": "Tümünü seç",
"showAdminLoginLink": "",
"logsPage": {
+1
View File
@@ -690,6 +690,7 @@
},
"advancedMatching": "",
"sendTestNotifications": "",
"testNotificationsDisabled": "",
"selectAll": "",
"showAdminLoginLink": "",
"logsPage": {