diff --git a/client/src/Pages/Settings/index.tsx b/client/src/Pages/Settings/index.tsx
index 564cb3bda..e7172638e 100644
--- a/client/src/Pages/Settings/index.tsx
+++ b/client/src/Pages/Settings/index.tsx
@@ -347,14 +347,16 @@ export const SettingsPage = () => {
const onError = (errors: unknown) => {
logger.debug("Form validation errors", errors);
- // The save bar lists errors by field name, so reveal the tab owning the
- // first one rather than naming a field the user cannot see.
- const firstField = Object.keys(errors ?? {})[0];
- if (firstField) {
- const target = tabForField(firstField);
- if (visibleTabs.some((tab) => tab.key === target)) {
- handleTabChange(target);
- }
+ };
+
+ // The save bar lists errors by field name, and the offending field may sit on
+ // a tab that is not open. Submitting cannot reveal it -- the button is
+ // disabled while the form is invalid -- so each listed field switches to its
+ // own tab instead.
+ const revealField = (field: string) => {
+ const target = tabForField(field);
+ if (visibleTabs.some((tab) => tab.key === target)) {
+ handleTabChange(target);
}
};
@@ -398,272 +400,229 @@ export const SettingsPage = () => {
)}
{/* general tab */}
-
- option.name}
- isOptionEqualToValue={(option: TimezoneOption, value: TimezoneOption) =>
- option.id === value.id
- }
- onChange={(_, newValue: TimezoneOption | null) => {
- handleTimezoneChange(newValue);
- }}
- fieldLabel={t("pages.settings.form.timezone.option.timezone.label")}
- />
- }
- />
-
-
-
-
-
-
- }
- />
- {/* URL Settings */}
-
- }
- />
- {/* About */}
-
-
- {t("common.appName")} {__APP_VERSION__}
-
-
- {t("pages.settings.form.about.developedBy")}
-
-
- https://github.com/bluewave-labs/checkmate
-
-
- }
- />
-
-
- {/* monitoring tab */}
-
- {/* Global Thresholds */}
- {isAdmin && (
+ {activeTab === "general" && (
+
-
-
-
-
-
-
- }
- />
- )}
- {/* Check Retention */}
- {isAdmin && (
-
- value >= CHECK_TTL_SENTINEL
- ? t("pages.settings.form.retention.option.days.unlimited")
- : `${value}`
- }
- formatDisplayValue={(value: number) =>
- value >= CHECK_TTL_SENTINEL
- ? t("pages.settings.form.retention.option.days.unlimited")
- : `${value}`
+ option.name}
+ isOptionEqualToValue={(option: TimezoneOption, value: TimezoneOption) =>
+ option.id === value.id
}
+ onChange={(_, newValue: TimezoneOption | null) => {
+ handleTimezoneChange(newValue);
+ }}
+ fieldLabel={t("pages.settings.form.timezone.option.timezone.label")}
/>
}
/>
- )}
-
- {/* Demo Monitors - Admin Only */}
- {isAdmin && (
-
-
+
+
+
+
+
+
+
}
/>
- )}
-
+ {/* URL Settings */}
+
+ }
+ />
+ {/* About */}
+
+
+ {t("common.appName")} {__APP_VERSION__}
+
+
+ {t("pages.settings.form.about.developedBy")}
+
+
+ https://github.com/bluewave-labs/checkmate
+
+
+ }
+ />
+
+ )}
+
+ {/* monitoring tab */}
+ {activeTab === "monitoring" && (
+
+ {/* Global Thresholds */}
+ {isAdmin && (
+
+
+
+
+
+
+
+ }
+ />
+ )}
+ {/* Check Retention */}
+ {isAdmin && (
+
+ value >= CHECK_TTL_SENTINEL
+ ? t("pages.settings.form.retention.option.days.unlimited")
+ : `${value}`
+ }
+ formatDisplayValue={(value: number) =>
+ value >= CHECK_TTL_SENTINEL
+ ? t("pages.settings.form.retention.option.days.unlimited")
+ : `${value}`
+ }
+ />
+ }
+ />
+ )}
+
+ {/* Demo Monitors - Admin Only */}
+ {isAdmin && (
+
+
+
+ }
+ />
+ )}
+
+ )}
{/* email tab */}
-
- {/* Email Settings - Admin Only */}
- {isAdmin && (
-
-
- {(() => {
- const address = form.watch("systemEmailAddress") || "";
- const displayName = form.watch("systemEmailDisplayName")?.trim();
- return (
- <>
-
-
- {JSON.stringify(
- {
- host: form.watch("systemEmailHost") || "",
- port: form.watch("systemEmailPort") || "",
- secure: form.watch("systemEmailSecure") ?? false,
- auth: {
- user: form.watch("systemEmailUser") || address,
- pass: "",
- },
- name:
- form.watch("systemEmailConnectionHost") || "localhost",
- pool: form.watch("systemEmailPool") ?? false,
- tls: {
- rejectUnauthorized:
- form.watch("systemEmailRejectUnauthorized") ?? true,
- ignoreTLS: form.watch("systemEmailIgnoreTLS") ?? false,
- requireTLS:
- form.watch("systemEmailRequireTLS") ?? false,
- servername:
- form.watch("systemEmailTLSServername") || "",
- },
- },
- null,
- 2
- )}
-
-
- {address && (
+ {activeTab === "email" && (
+
+ {/* Email Settings - Admin Only */}
+ {isAdmin && (
+
+
+ {(() => {
+ const address = form.watch("systemEmailAddress") || "";
+ const displayName = form.watch("systemEmailDisplayName")?.trim();
+ return (
+ <>
{
}}
>
- {`From: ${displayName ? `"${displayName}" <${address}>` : address}`}
+ {JSON.stringify(
+ {
+ host: form.watch("systemEmailHost") || "",
+ port: form.watch("systemEmailPort") || "",
+ secure: form.watch("systemEmailSecure") ?? false,
+ auth: {
+ user: form.watch("systemEmailUser") || address,
+ pass: "",
+ },
+ name:
+ form.watch("systemEmailConnectionHost") ||
+ "localhost",
+ pool: form.watch("systemEmailPool") ?? false,
+ tls: {
+ rejectUnauthorized:
+ form.watch("systemEmailRejectUnauthorized") ?? true,
+ ignoreTLS:
+ form.watch("systemEmailIgnoreTLS") ?? false,
+ requireTLS:
+ form.watch("systemEmailRequireTLS") ?? false,
+ servername:
+ form.watch("systemEmailTLSServername") || "",
+ },
+ },
+ null,
+ 2
+ )}
+ {address && (
+
+
+ {`From: ${displayName ? `"${displayName}" <${address}>` : address}`}
+
+
+ )}
+ >
+ );
+ })()}
+
+ }
+ rightContent={
+
+ {/* Email Host */}
+
+
+ {/* Email Port */}
+
+
+ {/* Email Address */}
+
+
+ {/* Email Display Name (Optional) */}
+
+
+ {/* Email User (Optional) */}
+
+
+ {/* Email Password with Reset Pattern */}
+ {isEmailPasswordSet && !emailPasswordHasBeenReset ? (
+
+
+ {t("pages.settings.form.email.option.password.labelSet")}
+
+
+
+
+
+ ) : (
+
- );
- })()}
-
- }
- rightContent={
-
- {/* Email Host */}
-
-
- {/* Email Port */}
-
-
- {/* Email Address */}
-
)}
- />
- {/* Email Display Name (Optional) */}
-
+ {/* TLS Servername (Optional) */}
+
- {/* Email User (Optional) */}
-
+ {/* Connection Host (Optional) */}
+
- {/* Email Password with Reset Pattern */}
- {isEmailPasswordSet && !emailPasswordHasBeenReset ? (
+ {/* Boolean Switches */}
+
+ {emailSwitches.map(({ name, label }) => (
+
+ ))}
+
+
+ {/* Test Email Button */}
-
- {t("pages.settings.form.email.option.password.labelSet")}
-
-
+ {t("common.buttons.sendTestEmail")}
+
+
+
+ }
+ />
+ )}
+
+ )}
+
+ {/* integrations tab */}
+ {activeTab === "integrations" && (
+
+ {isAdmin && (
+ 0 ? (
+
+
+ {globalProxyEnabled && (
+
+ )}
+
+ ) : (
+
+ )
+ }
+ />
+ )}
+ {isAdmin && (
+
+ {(isApiKeySet === false || apiKeyHasBeenReset === true) && (
+
+ )}
+
+ {isApiKeySet === true && apiKeyHasBeenReset === false && (
+
+
+ {t("pages.settings.form.pagespeed.option.apiKey.labelSet")}
+
-
-
- ) : (
-
- )}
-
- {/* TLS Servername (Optional) */}
-
)}
- />
-
- {/* Connection Host (Optional) */}
-
-
- {/* Boolean Switches */}
-
- {emailSwitches.map(({ name, label }) => (
-
- ))}
-
-
- {/* Test Email Button */}
-
-
-
-
- }
- />
- )}
-
-
- {/* integrations tab */}
-
- {isAdmin && (
- 0 ? (
-
-
- {globalProxyEnabled && (
-
- )}
-
- ) : (
-
- )
- }
- />
- )}
- {isAdmin && (
-
- {(isApiKeySet === false || apiKeyHasBeenReset === true) && (
-
- )}
-
- {isApiKeySet === true && apiKeyHasBeenReset === false && (
-
-
- {t("pages.settings.form.pagespeed.option.apiKey.labelSet")}
-
-
-
- )}
- >
- }
- />
- )}
-
+ >
+ }
+ />
+ )}
+
+ )}
{/* data tab */}
-
- {/* Export Monitors - Admin Only */}
- {isAdmin && (
-
-
-
-
-
- }
- />
- )}
- {/* Clear All Stats */}
- {isAdmin && (
- setIsStatsDialogOpen(true)}
- >
- {t("common.buttons.clear")}
-
- }
- />
- )}
-
- {/* Remove All Monitors - Admin Only */}
- {isAdmin && (
-
+
+
+
+
+ }
+ />
+ )}
+ {/* Clear All Stats */}
+ {isAdmin && (
+ setIsDemoMonitorsDialogOpen(true)}
+ onClick={() => setIsStatsDialogOpen(true)}
>
- {t("common.buttons.removeMonitors")}
+ {t("common.buttons.clear")}
-
- }
- />
- )}
-
+ }
+ />
+ )}
+
+ {/* Remove All Monitors - Admin Only */}
+ {isAdmin && (
+
+
+
+ }
+ />
+ )}
+
+ )}
{/* Clear Stats Confirmation Dialog */}