Merge branch 'develop' into feature/email-testing-without-saving

This commit is contained in:
Alexander Holliday authored and GitHub committed 2025-05-20 13:26:53 -07:00
commit e04212f9e9
50 files changed
+1029 -980

No files matched your search

@@ -5,12 +5,15 @@ import Button from "@mui/material/Button";
import SettingsOutlinedIcon from "@mui/icons-material/SettingsOutlined";
import PauseOutlinedIcon from "@mui/icons-material/PauseOutlined";
import PlayArrowOutlinedIcon from "@mui/icons-material/PlayArrowOutlined";
import EmailIcon from "@mui/icons-material/Email";
// Utils
import PropTypes from "prop-types";
import { useNavigate } from "react-router-dom";
import { useTheme } from "@mui/material/styles";
import { usePauseMonitor } from "../../Hooks/useMonitorControls";
import { useSendTestEmail } from "../../Hooks/useSendTestEmail";
import { useTranslation } from "react-i18next";
/**
* MonitorDetailsControlHeader component displays the control header for monitor details.
@@ -34,11 +37,14 @@ const MonitorDetailsControlHeader = ({
}) => {
const navigate = useNavigate();
const theme = useTheme();
const { t } = useTranslation();
const [pauseMonitor, isPausing, error] = usePauseMonitor({
monitorId: monitor?._id,
triggerUpdate,
});
const [isSending, emailError, sendTestEmail] = useSendTestEmail();
if (isLoading) {
return <Skeleton />;
}
@@ -54,6 +60,24 @@ const MonitorDetailsControlHeader = ({
direction="row"
gap={theme.spacing(2)}
>
<Button
variant="contained"
color="secondary"
loading={isSending}
startIcon={<EmailIcon />}
onClick={sendTestEmail}
>
{t("sendTestEmail")}
</Button>
<Button
variant="contained"
color="secondary"
onClick={(e) => {
navigate(`/incidents/${monitor?._id}`);
}}
>
{t("menu.incidents")}
</Button>
<Button
variant="contained"
color="secondary"
+4
View File
@@ -31,8 +31,12 @@ const useSendTestEmail = () => {
});
} else {
throw new Error(response?.data?.error || t("settingsTestEmailFailed", "Failed to send test email"));
}
} catch (error) {
createToast({
body: t("failedToSendEmail"),
});
setError(error);
createToast({
body: t("settingsTestEmailFailedWithReason", "Failed to send test email: {{reason}}", {
@@ -294,7 +294,7 @@ const CreateInfrastructureMonitor = () => {
</Typography>
<ConfigBox>
<Stack gap={theme.spacing(6)}>
<Typography component="h2">{t("settingsGeneralSettings")}</Typography>
<Typography component="h2" variant="h2">{t("settingsGeneralSettings")}</Typography>
<Typography component="p">
{t("infrastructureCreateGeneralSettingsDescription")}
</Typography>
@@ -368,7 +368,7 @@ const CreateInfrastructureMonitor = () => {
</ConfigBox>
<ConfigBox>
<Box>
<Typography component="h2">{t("distributedUptimeCreateIncidentNotification")}</Typography>
<Typography component="h2" variant="h2">{t("distributedUptimeCreateIncidentNotification")}</Typography>
<Typography component="p">
{t("distributedUptimeCreateIncidentDescription")}
</Typography>
@@ -385,7 +385,7 @@ const CreateInfrastructureMonitor = () => {
</ConfigBox>
<ConfigBox>
<Box>
<Typography component="h2">{t("infrastructureCustomizeAlerts")}</Typography>
<Typography component="h2" variant="h2">{t("infrastructureCustomizeAlerts")}</Typography>
<Typography component="p">
{t("infrastructureAlertNotificationDescription")}
</Typography>
@@ -432,7 +432,7 @@ const CreateInfrastructureMonitor = () => {
</ConfigBox>
<ConfigBox>
<Box>
<Typography component="h2">{t("distributedUptimeCreateAdvancedSettings")}</Typography>
<Typography component="h2" variant="h2">{t("distributedUptimeCreateAdvancedSettings")}</Typography>
</Box>
<Stack gap={theme.spacing(12)}>
<Select
@@ -310,7 +310,7 @@ const PageSpeedConfigure = () => {
</Stack>
<ConfigBox>
<Box>
<Typography component="h2">{t("settingsGeneralSettings")}</Typography>
<Typography component="h2" variant="h2">{t("settingsGeneralSettings")}</Typography>
<Typography component="p">
{t("pageSpeedConfigureSettingsDescription")}
</Typography>
@@ -349,7 +349,7 @@ const PageSpeedConfigure = () => {
</ConfigBox>
<ConfigBox>
<Box>
<Typography component="h2">{t("distributedUptimeCreateIncidentNotification")}</Typography>
<Typography component="h2" variant="h2">{t("distributedUptimeCreateIncidentNotification")}</Typography>
<Typography component="p">
{t("distributedUptimeCreateIncidentDescription")}
</Typography>
@@ -405,7 +405,7 @@ const PageSpeedConfigure = () => {
</ConfigBox>
<ConfigBox>
<Box>
<Typography component="h2">{t("distributedUptimeCreateAdvancedSettings")}</Typography>
<Typography component="h2" variant="h2">{t("distributedUptimeCreateAdvancedSettings")}</Typography>
</Box>
<Stack gap={theme.spacing(20)}>
<Select
+4 -4
View File
@@ -216,7 +216,7 @@ const CreatePageSpeed = () => {
</Typography>
<ConfigBox>
<Box>
<Typography component="h2">{t("settingsGeneralSettings")}</Typography>
<Typography component="h2" variant="h2">{t("settingsGeneralSettings")}</Typography>
<Typography component="p">
{t("distributedUptimeCreateSelectURL")}
</Typography>
@@ -251,7 +251,7 @@ const CreatePageSpeed = () => {
</ConfigBox>
<ConfigBox>
<Box>
<Typography component="h2">{t("distributedUptimeCreateChecks")}</Typography>
<Typography component="h2" variant="h2">{t("distributedUptimeCreateChecks")}</Typography>
<Typography component="p">
{t("distributedUptimeCreateChecksDescription")}
</Typography>
@@ -300,7 +300,7 @@ const CreatePageSpeed = () => {
</ConfigBox>
<ConfigBox>
<Box>
<Typography component="h2">{t("distributedUptimeCreateIncidentNotification")}</Typography>
<Typography component="h2" variant="h2">{t("distributedUptimeCreateIncidentNotification")}</Typography>
<Typography component="p">
{t("distributedUptimeCreateIncidentDescription")}
</Typography>
@@ -320,7 +320,7 @@ const CreatePageSpeed = () => {
</ConfigBox>
<ConfigBox>
<Box>
<Typography component="h2">{t("distributedUptimeCreateAdvancedSettings")}</Typography>
<Typography component="h2" variant="h2">{t("distributedUptimeCreateAdvancedSettings")}</Typography>
</Box>
<Stack gap={theme.spacing(12)}>
<Select
+1 -1
View File
@@ -12,7 +12,7 @@ const SettingsAbout = () => {
return (
<ConfigBox>
<Box>
<Typography component="h1">{t("settingsAbout")}</Typography>
<Typography component="h1" variant="h2">{t("settingsAbout")}</Typography>
</Box>
<Box>
<Typography component="h2">Checkmate {2.1}</Typography>
@@ -23,7 +23,7 @@ const SettingsDemoMonitors = ({ isAdmin, HEADER_SX, handleChange, isLoading }) =
<>
<ConfigBox>
<Box>
<Typography component="h1">{t("settingsDemoMonitors")}</Typography>
<Typography component="h1" variant="h2">{t("settingsDemoMonitors")}</Typography>
<Typography sx={HEADER_SX}>{t("settingsDemoMonitorsDescription")}</Typography>
</Box>
<Box>
@@ -48,7 +48,7 @@ const SettingsDemoMonitors = ({ isAdmin, HEADER_SX, handleChange, isLoading }) =
</ConfigBox>
<ConfigBox>
<Box>
<Typography component="h1">{t("settingsSystemReset")}</Typography>
<Typography component="h1" variant="h2">{t("settingsSystemReset")}</Typography>
<Typography sx={{ mt: theme.spacing(2) }}>
{t("settingsSystemResetDescription")}
</Typography>
+1 -1
View File
@@ -75,7 +75,7 @@ const SettingsEmail = ({
return (
<ConfigBox>
<Box>
<Typography component="h1">{t("settingsEmail")}</Typography>
<Typography component="h1" variant="h2">{t("settingsEmail")}</Typography>
<Typography sx={HEADER_SX}>{t("settingsEmailDescription")}</Typography>
</Box>
<Box>
@@ -41,7 +41,7 @@ const SettingsPagespeed = ({
return (
<ConfigBox>
<Box>
<Typography component="h1">{t("pageSpeedApiKeyFieldTitle")}</Typography>
<Typography component="h1" variant="h2">{t("pageSpeedApiKeyFieldTitle")}</Typography>
<Typography sx={HEADING_SX}>{t("pageSpeedApiKeyFieldDescription")}</Typography>
</Box>
<Stack gap={theme.spacing(20)}>
@@ -26,6 +26,7 @@ const SettingsStats = ({ isAdmin, HEADING_SX, handleChange, settingsData, errors
<Box>
<Typography
component="h1"
variant="h2"
sx={HEADING_SX}
>
{t("settingsHistoryAndMonitoring")}
@@ -15,7 +15,7 @@ const SettingsTimeZone = ({ HEADING_SX, handleChange, timezone }) => {
return (
<ConfigBox>
<Box>
<Typography component="h1">{t("settingsGeneralSettings")}</Typography>
<Typography component="h1" variant="h2">{t("settingsGeneralSettings")}</Typography>
<Typography sx={HEADING_SX}>
<Typography component="span">{t("settingsDisplayTimezone")}</Typography>-{" "}
{t("settingsDisplayTimezoneDescription")}
+1 -1
View File
@@ -16,7 +16,7 @@ const SettingsUI = ({ HEADING_SX, handleChange, mode, language }) => {
return (
<ConfigBox>
<Box>
<Typography component="h1">{t("settingsAppearance")}</Typography>
<Typography component="h1" variant="h2">{t("settingsAppearance")}</Typography>
<Typography sx={HEADING_SX}>{t("settingsAppearanceDescription")}</Typography>
</Box>
<Stack gap={theme.spacing(20)}>
@@ -9,7 +9,7 @@ const ConfigStack = ({ title, description, children }) => {
return (
<ConfigBox>
<Stack gap={theme.spacing(6)}>
<Typography component="h2">{title}</Typography>
<Typography component="h2" variant="h2">{title}</Typography>
<Typography component="p">{description}</Typography>
</Stack>
{children}
@@ -34,7 +34,7 @@ const TabSettings = ({
<Stack gap={theme.spacing(10)}>
<ConfigBox>
<Stack>
<Typography component="h2">{t("access")}</Typography>
<Typography component="h2" variant="h2">{t("access")}</Typography>
<Typography component="p">
{t("statusPageCreateSettings")}
</Typography>
@@ -51,7 +51,7 @@ const TabSettings = ({
</ConfigBox>
<ConfigBox>
<Stack gap={theme.spacing(6)}>
<Typography component="h2">{t("basicInformation")}</Typography>
<Typography component="h2" variant="h2">{t("basicInformation")}</Typography>
<Typography component="p">
{t("statusPageCreateBasicInfoDescription")}
</Typography>
@@ -82,7 +82,7 @@ const TabSettings = ({
</ConfigBox>
<ConfigBox>
<Stack gap={theme.spacing(6)}>
<Typography component="h2">{t("timezone")}</Typography>
<Typography component="h2" variant="h2">{t("timezone")}</Typography>
<Typography component="p">
{t("statusPageCreateSelectTimeZoneDescription")}
</Typography>
@@ -100,7 +100,7 @@ const TabSettings = ({
</ConfigBox>
<ConfigBox>
<Stack gap={theme.spacing(6)}>
<Typography component="h2">{t("settingsAppearance")}</Typography>
<Typography component="h2" variant="h2">{t("settingsAppearance")}</Typography>
<Typography component="p">
{t("statusPageCreateAppearanceDescription")}
</Typography>
+2 -1
View File
@@ -184,7 +184,6 @@ const CreateStatusPage = () => {
size: null,
};
}
setForm((prev) => {
return {
...prev,
@@ -194,6 +193,8 @@ const CreateStatusPage = () => {
monitors: statusPageMonitors.map((monitor) => monitor._id),
color: statusPage?.color,
logo: newLogo,
showCharts: statusPage?.showCharts ?? true,
showUptimePercentage: statusPage?.showUptimePercentage ?? true
};
});
setSelectedMonitors(statusPageMonitors);
+1 -1
View File
@@ -61,7 +61,7 @@ const BulkImport = () => {
</Typography>
<ConfigBox>
<Box>
<Typography component="h2">{t("bulkImport.selectFileTips")}</Typography>
<Typography component="h2" variant="h2">{t("bulkImport.selectFileTips")}</Typography>
<Typography component="p">
<Trans
i18nKey="bulkImport.selectFileDescription"
+4 -4
View File
@@ -325,7 +325,7 @@ const Configure = () => {
</Stack>
<ConfigBox>
<Box>
<Typography component="h2">{t("settingsGeneralSettings")}</Typography>
<Typography component="h2" variant="h2">{t("settingsGeneralSettings")}</Typography>
<Typography component="p">
{t("distributedUptimeCreateSelectURL")}
</Typography>
@@ -371,7 +371,7 @@ const Configure = () => {
</ConfigBox>
<ConfigBox>
<Box>
<Typography component="h2">
<Typography component="h2" variant="h2">
{t("distributedUptimeCreateIncidentNotification")}
</Typography>
<Typography component="p">
@@ -439,7 +439,7 @@ const Configure = () => {
</ConfigBox>
<ConfigBox>
<Box>
<Typography component="h2">{t("ignoreTLSError")}</Typography>
<Typography component="h2" variant="h2">{t("ignoreTLSError")}</Typography>
<Typography component="p">{t("ignoreTLSErrorDescription")}</Typography>
</Box>
<Stack>
@@ -459,7 +459,7 @@ const Configure = () => {
</ConfigBox>
<ConfigBox>
<Box>
<Typography component="h2">
<Typography component="h2" variant="h2">
{t("distributedUptimeCreateAdvancedSettings")}
</Typography>
</Box>
+5 -5
View File
@@ -261,7 +261,7 @@ const CreateMonitor = () => {
</Typography>
<ConfigBox>
<Box>
<Typography component="h2">{t("distributedUptimeCreateChecks")}</Typography>
<Typography component="h2" variant="h2">{t("distributedUptimeCreateChecks")}</Typography>
<Typography component="p">
{t("distributedUptimeCreateChecksDescription")}
</Typography>
@@ -342,7 +342,7 @@ const CreateMonitor = () => {
</ConfigBox>
<ConfigBox>
<Box>
<Typography component="h2">{t("settingsGeneralSettings")}</Typography>
<Typography component="h2" variant="h2">{t("settingsGeneralSettings")}</Typography>
<Typography component="p">{t("uptimeCreateSelectURL")}</Typography>
</Box>
<Stack gap={theme.spacing(15)}>
@@ -386,7 +386,7 @@ const CreateMonitor = () => {
</ConfigBox>
<ConfigBox>
<Box>
<Typography component="h2">
<Typography component="h2" variant="h2">
{t("distributedUptimeCreateIncidentNotification")}
</Typography>
<Typography component="p">
@@ -417,7 +417,7 @@ const CreateMonitor = () => {
</ConfigBox>
<ConfigBox>
<Box>
<Typography component="h2">{t("ignoreTLSError")}</Typography>
<Typography component="h2" variant="h2">{t("ignoreTLSError")}</Typography>
<Typography component="p">{t("ignoreTLSErrorDescription")}</Typography>
</Box>
<Stack>
@@ -437,7 +437,7 @@ const CreateMonitor = () => {
</ConfigBox>
<ConfigBox>
<Box>
<Typography component="h2">
<Typography component="h2" variant="h2">
{t("distributedUptimeCreateAdvancedSettings")}
</Typography>
</Box>
+6 -3
View File
@@ -1047,9 +1047,12 @@ class NetworkService {
form.url && fd.append("url", form.url);
form.timezone && fd.append("timezone", form.timezone);
form.color && fd.append("color", form.color);
form.showCharts && fd.append("showCharts", form.showCharts);
form.showUptimePercentage &&
fd.append("showUptimePercentage", form.showUptimePercentage);
if (form.showCharts !== undefined) {
fd.append("showCharts", String(form.showCharts));
}
if (form.showUptimePercentage !== undefined) {
fd.append("showUptimePercentage", String(form.showUptimePercentage));
}
form.monitors &&
form.monitors.forEach((monitorId) => {
fd.append("monitors[]", monitorId);
+4 -1
View File
@@ -540,5 +540,8 @@
"passwordRequirements": "New password must contain at least 8 characters and must have at least one uppercase letter, one lowercase letter, one number and one special character.",
"saving": "Saving..."
},
"uptimeCreateSelectURL": "Enter the URL or IP to monitor (e.g., https://example.com/ or 192.168.1.100) and add a clear display name that appears on the dashboard."
"uptimeCreateSelectURL": "Enter the URL or IP to monitor (e.g., https://example.com/ or 192.168.1.100) and add a clear display name that appears on the dashboard.",
"sendTestEmail": "Send test email",
"emailSent": "Email sent successfully",
"failedToSendEmail": "Failed to send email"
}