Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Refuse alert settings writes until the saved policy is loaded

pulse-triage[bot]c9bcb7420085
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index c156fa09af..9c4ce39f80 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -33,6 +33,14 @@ unsent writes; they cannot cancel or undo an already-issued request. The newer
context alone owns load results and pending flags. Apprise response masking
replaces only the untouched submitted draft, not newer input.
+Save admission additionally requires a successful saved-policy read in the
+current editor context. Initial load and every replacement withdraw that
+admission before resetting draft defaults. A failed read leaves editing and
+saving unavailable; an explicit reload must obtain the saved policy and finish
+destination loading before admitting writes. An older failed read cannot
+withdraw a newer successful context. Destination partial-load failures retain
+their existing separate save block. Defaults are not a recovered saved policy.
+
`alertSettingsSave.acknowledgement.test.tsx` exercises the real policy and
destination owners with deferred/rejected API replies, coherent snapshots,
newer edits, duplicate admission, tab navigation, retry, normal masking and
@@ -41,6 +49,8 @@ same downstream snapshot; `alertConfigPresentation.test.ts` distinguishes
pending, accepted and newer-unsaved messages. Browser proof mounts the real
configuration surface at desktop and narrow widths with synthetic local
endpoints. These are source controls, not ordinary notification delivery.
+The acknowledgement controls also require failed-initial/replacement-read
+write refusal, deliberate reload recovery and superseded-error ownership.
### PMG collection opt-outs are not recovery evidence
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index a4e75c302f..27d1f24460 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -32,6 +32,15 @@ by the parent-bound browser fixture. `alertConfigPresentation.test.ts` and
`alertSettingsSave.acknowledgement.test.tsx` exercise the copy and state owner.
No new primitive, route or permission is introduced.
+Threshold, schedule and destination editors appear only after saved policy
+and destination loading have completed for the current context. Pending reads
+render an announced loading message, not editable defaults. Failed policy reads
+render an alert and keyboard-operable Reload settings control; neither Save
+nor editable default fields is exposed. The copy and acknowledgement controls
+cover failed reads and successful reloads; the connected browser fixture also
+requires preserved pending-save drafts and narrow-layout fit. Overview and
+History navigation are not gated by this editor load state.
+
### Existing Assistant control selectors describe planning
diff --git a/docs/release-control/v6/internal/subsystems/notifications.md b/docs/release-control/v6/internal/subsystems/notifications.md
index fb19cf45d9..c5484e2158 100644
--- a/docs/release-control/v6/internal/subsystems/notifications.md
+++ b/docs/release-control/v6/internal/subsystems/notifications.md
@@ -27,6 +27,14 @@ remaining unsent calls, without cancelling or undoing an issued request.
Failed multi-endpoint saves can have earlier persisted writes and are not
represented as atomic rollback or provider delivery.
+The aggregate editor refuses all policy/destination writes until it has loaded
+the saved policy for its current context. A rejected policy GET is not permission
+to save empty or disabled destination defaults. Explicit reload restores normal
+admission only after saved policy and destination loading finish; existing
+destination-load errors still block saves. The acknowledgement controls require
+no downstream writes after initial or replacement policy-read failures, without
+changing provider, queue or retry semantics.
+
`useAlertDestinationsState.test.tsx` and
`alertSettingsSave.acknowledgement.test.tsx` use deferred and rejected replies
to prove the snapshot, draft, retry and context boundaries. The genuine browser
diff --git a/frontend-modern/browser-verification/d271538cdf9f498d.json b/frontend-modern/browser-verification/d271538cdf9f498d.json
new file mode 100644
index 0000000000..018280c2c0
--- /dev/null
+++ b/frontend-modern/browser-verification/d271538cdf9f498d.json
@@ -0,0 +1,79 @@
+{
+ "version": 1,
+ "base_sha": "cceaea20c0c726c95e12e126d3e364b83f0ffe38",
+ "verified_at": "2026-10-10T10:21:28.981Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/features/alerts/useAlertsConfigurationState.ts",
+ "frontend-modern/src/features/alerts/AlertsConfigurationSurface.tsx",
+ "frontend-modern/src/utils/alertConfigPresentation.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/features/alerts/useAlertsConfigurationState.ts": "f62c9497f190811e63ce750246d6e44e05f145697e5de36bf7914a7759748021",
+ "frontend-modern/src/features/alerts/AlertsConfigurationSurface.tsx": "319a42fed4bee01960a9db7b41717be8681bffa4ea5e3db9d3dceae0e5255f3a",
+ "frontend-modern/src/utils/alertConfigPresentation.ts": "e3d43f9051121201a07a4ec61dda6271566bf1c875898cd05c06a235e649aa6f"
+ },
+ "routes": [
+ "/qualification/save (local fixture for existing alert scheduling and notification settings, not a new product route)"
+ ],
+ "viewports": [
+ {
+ "name": "desktop-light",
+ "width": 1365,
+ "height": 900
+ },
+ {
+ "name": "desktop-dark",
+ "width": 1365,
+ "height": 900
+ },
+ {
+ "name": "phone-light",
+ "width": 390,
+ "height": 844
+ },
+ {
+ "name": "narrow-dark",
+ "width": 320,
+ "height": 844
+ }
+ ],
+ "states": [
+ "Production configuration surface, real policy/destination state, payload builders, API adapters and CSS against synthetic local endpoints. Playwright 1.56.1; Chromium 141.0.7390.37 and WebKit 26.0, light/dark desktop and 390px/320px.",
+ "A rejected saved-policy read renders an announced load error and Reload settings instead of editable defaults. No policy or destination PUT occurs. Keyboard reload announces pending saved settings without editable fields.",
+ "A successful reload restores the saved cooldown, overrides and SMTP destination before admitting an edited save. A failed replacement context withdraws editing again.",
+ "All twenty final captures inspected: unavailable, loading, recovered, replacement-unavailable and pending-save states across four variants. New load/error/reload content fits narrow widths; inherited panel description truncation remains.",
+ "This local browser proof does not establish type-check, unit/full-suite, lint, production-build, native notification, real tenant, physical-phone, installed or release acceptance."
+ ],
+ "interactions": [
+ "48 assertion groups across four variants: failed/pending policy reads, keyboard reload, correct saved-state write after recovery, replacement failure, normal Save/Discard, pending policy/Apprise replies, retained newer inputs, duplicate-save prevention, dirty tab re-entry, rejection and deliberate retry.",
+ "The changed-source control retains click-time wire fields and newer dirty inputs through older acknowledgements. Superseded destination reads cannot replace fresh context or leave the obsolete loading indicator.",
+ "No page errors, unexpected API requests or Test/retained-queue Retry/Dismiss/Relay/provider calls. Browsers and preview server closed. Earlier issued/acknowledged writes are not cancelled or rolled back."
+ ],
+ "evidence_sha256": {
+ "script": "04b766adfb2b390022f6a82c09540c5f24ff2e04bf0775af512a20a3c1d023ba",
+ "results": "c3b29002f25efc4c628f87e064c33a0774b6fffdc1f4ffd55c4b9c59d5f1ed83",
+ "captures": {
+ "desktop-light-unavailable.png": "faf720c0451699567301916b989b3a7be35a6bcdd3b9dc45902535593b4f81c4",
+ "desktop-light-loading.png": "87510ec2b7ff196bde3a274645b78c31b7ff620d7d3e626fdace968939d9ffac",
+ "desktop-light-recovered.png": "f890eb2d16e45890f3127bcf4e0ed0b7593258f8ec6df3df58e73b65ad91c49b",
+ "desktop-light-context-unavailable.png": "75882738355300af20b8db9b1b2f32032df7a54a80952797a9689052bebca958",
+ "desktop-light-pending.png": "32b9df8ffe90c51ddc0a57dd99ca4471dedfb733785a6666df97f33838878504",
+ "desktop-dark-unavailable.png": "c7e3517326f3ffef36cdc516e37ef74a474c5035f133d052f4de612b72836d4c",
+ "desktop-dark-loading.png": "bf140f89692ea445c48758016b3d7bb56e577eaf34ba7aabefc33afda165e3c2",
+ "desktop-dark-recovered.png": "ffb40524ed08d317c57ca5a4d5dc356cccd0bbc556d3e5ff560a6fe1be1ad8ee",
+ "desktop-dark-context-unavailable.png": "fdd6b32d0c2fe4117f94623137f67318f458826d1f1cbc5acdc38b1d0016f784",
+ "desktop-dark-pending.png": "0138e7d6dc493179a78464b1ecf6437bcbea68b8a6bb53e1d5cf08a0c7404781",
+ "phone-light-unavailable.png": "8742163f36a3bfc4557868360525fc0ed19da83c5875e0a6e3af22b126a7ac36",
+ "phone-light-loading.png": "8b0fb37fd3d8428f9653cbd210e797dea1397fd1223868d7ac63f138cf64798c",
+ "phone-light-recovered.png": "c4d2faec29bfafc2de96d62dba04593ce052e2181858a53869d14a712d322aa1",
+ "phone-light-context-unavailable.png": "8742163f36a3bfc4557868360525fc0ed19da83c5875e0a6e3af22b126a7ac36",
+ "phone-light-pending.png": "6b0f83a2a856bb6be392824f5faff73d912057fbefa457530a4c1057a33f1a86",
+ "narrow-dark-unavailable.png": "b74233e2de8156763d42e5afff788028a05c5fd78872a55eac3e49cf2c904647",
+ "narrow-dark-loading.png": "ddd0098846fb2782f5a9f181cfc597a5c01e6b244e3f30a460f6007e388856d5",
+ "narrow-dark-recovered.png": "1f479c9ea47d3c32c33996c7691c35a702e84ae7b392d08aa17228ed546d6b34",
+ "narrow-dark-context-unavailable.png": "d02c8c495f27dd00986c3ae08ceb518b09b7545b3ec5805728b4fc8acde66c89",
+ "narrow-dark-pending.png": "533e2f94b7e3c30253b5bacd49e98c664e2539d4315f58196c8576e799b6fd1f"
+ }
+ }
+}
diff --git a/frontend-modern/src/features/alerts/AlertsConfigurationSurface.tsx b/frontend-modern/src/features/alerts/AlertsConfigurationSurface.tsx
index 7fef76dd2b..335fdd03e5 100644
--- a/frontend-modern/src/features/alerts/AlertsConfigurationSurface.tsx
+++ b/frontend-modern/src/features/alerts/AlertsConfigurationSurface.tsx
@@ -3,6 +3,8 @@ import { createMemo, Show } from 'solid-js';
import { Card } from '@/components/shared/Card';
import {
getAlertConfigDiscardLabel,
+ getAlertConfigLoadingLabel,
+ getAlertConfigReloadLabel,
getAlertConfigSaveChangesLabel,
getAlertConfigSaveFailure,
getAlertConfigUnsavedChangesLabel,
@@ -43,6 +45,34 @@ export function AlertsConfigurationSurface(props: AlertsConfigurationSurfaceProp
return (
<>
+ <Show
+ when={
+ !state.isConfigLoaded() &&
+ (props.activeTab() === 'thresholds' ||
+ props.activeTab() === 'schedule' ||
+ props.activeTab() === 'destinations')
+ }
+ >
+ <Card tone={state.configLoadError() ? 'danger' : 'muted'} padding="sm" class="sm:p-4">
+ <div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
+ <p
+ role={state.configLoadError() ? 'alert' : 'status'}
+ class="text-sm text-base-content"
+ >
+ {state.configLoadError() || getAlertConfigLoadingLabel()}
+ </p>
+ <Show when={state.configLoadError()}>
+ <button
+ class="min-h-11 shrink-0 rounded-md border border-border px-4 py-2 text-sm text-base-content hover:bg-surface-hover"
+ onClick={() => void state.loadAlertConfiguration()}
+ >
+ {getAlertConfigReloadLabel()}
+ </button>
+ </Show>
+ </div>
+ </Card>
+ </Show>
+
<Show
when={
props.hasUnsavedChanges() &&
@@ -71,6 +101,7 @@ export function AlertsConfigurationSurface(props: AlertsConfigurationSurfaceProp
<button
class="flex-1 px-4 py-2 text-sm text-white transition-colors sm:flex-initial bg-blue-600 rounded-md hover:bg-blue-700 disabled:opacity-60 disabled:cursor-not-allowed"
disabled={
+ !state.isConfigLoaded() ||
state.isReloadingConfig() ||
state.isLoadingDestinations() ||
state.isSavingConfig() ||
@@ -104,7 +135,7 @@ export function AlertsConfigurationSurface(props: AlertsConfigurationSurfaceProp
</Card>
</Show>
- <Show when={props.activeTab() === 'thresholds'}>
+ <Show when={props.activeTab() === 'thresholds' && state.isConfigLoaded()}>
<ThresholdsTab
overrides={state.overrides}
setOverrides={state.setOverrides}
@@ -237,7 +268,7 @@ export function AlertsConfigurationSurface(props: AlertsConfigurationSurfaceProp
/>
</Show>
- <Show when={props.activeTab() === 'destinations'}>
+ <Show when={props.activeTab() === 'destinations' && state.isConfigLoaded()}>
<DestinationsTab
setHasUnsavedChanges={state.guardedSetHasUnsavedChanges}
deadManPingUrl={state.deadManPingUrl}
@@ -257,7 +288,7 @@ export function AlertsConfigurationSurface(props: AlertsConfigurationSurfaceProp
/>
</Show>
- <Show when={props.activeTab() === 'schedule'}>
+ <Show when={props.activeTab() === 'schedule' && state.isConfigLoaded()}>
<ScheduleTab
setHasUnsavedChanges={state.guardedSetHasUnsavedChanges}
quietHours={state.scheduleQuietHours}
diff --git a/frontend-modern/src/features/alerts/__tests__/alertSettingsSave.acknowledgement.test.tsx b/frontend-modern/src/features/alerts/__tests__/alertSettingsSave.acknowledgement.test.tsx
index 1d5cf08786..53a52638f1 100644
--- a/frontend-modern/src/features/alerts/__tests__/alertSettingsSave.acknowledgement.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/alertSettingsSave.acknowledgement.test.tsx
@@ -138,6 +138,75 @@ describe('alert settings save acknowledgement', () => {
expect(result.dirty()).toBe(true);
});
+ it('refuses default writes after a failed policy read until saved settings are loaded', async () => {
+ vi.mocked(AlertsAPI.getConfig).mockRejectedValueOnce(
+ new Error('Synthetic policy read failure'),
+ );
+ const { result } = await editor();
+ expect(result.isConfigLoaded()).toBe(false);
+ expect(result.configLoadError()).toContain('Saved alert settings could not be loaded');
+ editEmail(result, 'smtp.not-loaded.example.test');
+ await result.saveAlertConfiguration();
+ expect(AlertsAPI.updateConfig).not.toHaveBeenCalled();
+ expect(NotificationsAPI.updateEmailConfig).not.toHaveBeenCalled();
+ expect(NotificationsAPI.updateAppriseConfig).not.toHaveBeenCalled();
+ expect(AlertsAPI.updateDeadManConfig).not.toHaveBeenCalled();
+ expect(notificationStore.success).not.toHaveBeenCalled();
+
+ await result.loadAlertConfiguration();
+ expect(result.isConfigLoaded()).toBe(true);
+ expect(result.configLoadError()).toBeNull();
+ editEmail(result, 'smtp.loaded.example.test');
+ await result.saveAlertConfiguration();
+ expect(NotificationsAPI.updateEmailConfig).toHaveBeenCalledWith(
+ expect.objectContaining({ server: 'smtp.loaded.example.test' }),
+ );
+ expect(result.dirty()).toBe(false);
+ });
+
+ it('withdraws save admission while replacing a previously loaded context', async () => {
+ const { result } = await editor();
+ const pending = deferred<Awaited<ReturnType<typeof AlertsAPI.getConfig>>>();
+ vi.mocked(AlertsAPI.getConfig).mockReturnValueOnce(pending.promise);
+ const reload = result.loadAlertConfiguration();
+ expect(result.isConfigLoaded()).toBe(false);
+ await result.saveAlertConfiguration();
+ expect(AlertsAPI.updateConfig).not.toHaveBeenCalled();
+ pending.resolve({ overrides: {} } as never);
+ await reload;
+ expect(result.isConfigLoaded()).toBe(true);
+ });
+
+ it("does not reuse the old context's write admission when its replacement read fails", async () => {
+ const { result } = await editor();
+ vi.mocked(AlertsAPI.getConfig).mockRejectedValueOnce(
+ new Error('Synthetic replacement failure'),
+ );
+ eventBus.emit('org_switched', 'synthetic-unavailable-org');
+ await waitFor(() => {
+ expect(AlertsAPI.getConfig).toHaveBeenCalledTimes(2);
+ expect(result.isReloadingConfig()).toBe(false);
+ });
+ expect(result.isConfigLoaded()).toBe(false);
+ editEmail(result, 'smtp.stale-context.example.test');
+ await result.saveAlertConfiguration();
+ expect(AlertsAPI.updateConfig).not.toHaveBeenCalled();
+ expect(NotificationsAPI.updateEmailConfig).not.toHaveBeenCalled();
+ });
+
+ it('does not let an older failed read withdraw a newer loaded context', async () => {
+ const { result } = await editor();
+ const pending = deferred<Awaited<ReturnType<typeof AlertsAPI.getConfig>>>();
+ vi.mocked(AlertsAPI.getConfig).mockReturnValueOnce(pending.promise);
+ const superseded = result.loadAlertConfiguration();
+ await result.loadAlertConfiguration();
+ expect(result.isConfigLoaded()).toBe(true);
+ pending.reject(new Error('Synthetic superseded read failure'));
+ await superseded;
+ expect(result.isConfigLoaded()).toBe(true);
+ expect(result.configLoadError()).toBeNull();
+ });
+
it('keeps edits made during a destination write dirty after acknowledgement', async () => {
const { result } = await editor();
const pending = deferred<{ success: boolean }>();
diff --git a/frontend-modern/src/features/alerts/__tests__/useAlertDestinationsState.test.tsx b/frontend-modern/src/features/alerts/__tests__/useAlertDestinationsState.test.tsx
index d0b29015da..e8372c6dd7 100644
--- a/frontend-modern/src/features/alerts/__tests__/useAlertDestinationsState.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/useAlertDestinationsState.test.tsx
@@ -1,4 +1,4 @@
-import { renderHook } from '@solidjs/testing-library';
+import { renderHook, waitFor } from '@solidjs/testing-library';
import { createSignal } from 'solid-js';
import { beforeEach, describe, expect, it, vi } from 'vitest';
@@ -288,4 +288,34 @@ describe('useAlertDestinationsState', () => {
expect(result.isLoadingDestinations()).toBe(false);
expect(result.emailConfig().server).toBe('smtp.current.example.test');
});
+
+ it('does not refresh destinations before the policy owner admits a loaded context', async () => {
+ vi.mocked(hasFeature).mockReturnValue(false);
+ vi.mocked(NotificationsAPI.getEmailConfig).mockResolvedValue({
+ enabled: true,
+ server: 'smtp.loaded.example.test',
+ } as never);
+ vi.mocked(NotificationsAPI.getAppriseConfig).mockResolvedValue({ enabled: false } as never);
+ vi.mocked(NotificationsAPI.getWebhooks).mockResolvedValue([]);
+ vi.mocked(AlertsAPI.getDeadManConfig).mockResolvedValue({ pingUrl: '', configured: false });
+ const [activeTab, setActiveTab] = createSignal<'overview' | 'destinations'>('overview');
+ const [canReload, setCanReload] = createSignal(false);
+ const { result } = renderHook(() => useAlertDestinationsState({ activeTab, canReload }));
+
+ setActiveTab('destinations');
+ await Promise.resolve();
+ expect(NotificationsAPI.getEmailConfig).not.toHaveBeenCalled();
+ expect(NotificationsAPI.getAppriseConfig).not.toHaveBeenCalled();
+ expect(AlertsAPI.getDeadManConfig).not.toHaveBeenCalled();
+ expect(NotificationsAPI.getWebhooks).not.toHaveBeenCalled();
+ setCanReload(true);
+ await Promise.resolve();
+ expect(NotificationsAPI.getEmailConfig).not.toHaveBeenCalled();
+
+ setActiveTab('overview');
+ setActiveTab('destinations');
+ await waitFor(() => expect(result.emailConfig().server).toBe('smtp.loaded.example.test'));
+ expect(NotificationsAPI.getEmailConfig).toHaveBeenCalledTimes(1);
+ expect(RelayAPI.getConfig).not.toHaveBeenCalled();
+ });
});
diff --git a/frontend-modern/src/features/alerts/useAlertsConfigurationState.ts b/frontend-modern/src/features/alerts/useAlertsConfigurationState.ts
index 69c9e7afa3..57d158a992 100644
--- a/frontend-modern/src/features/alerts/useAlertsConfigurationState.ts
+++ b/frontend-modern/src/features/alerts/useAlertsConfigurationState.ts
@@ -9,6 +9,7 @@ import type { ActivationState } from '@/types/alerts';
import type { Resource, ResourceType } from '@/types/resource';
import {
getAlertConfigDiscardedSuccess,
+ getAlertConfigLoadError,
getAlertConfigReloadFailure,
getAlertConfigSaveSuccess,
} from '@/utils/alertConfigPresentation';
@@ -45,6 +46,8 @@ export interface AlertsConfigurationSurfaceProps {
export function useAlertsConfigurationState(props: AlertsConfigurationSurfaceProps) {
const [isReloadingConfig, setIsReloadingConfig] = createSignal(false);
+ const [isConfigLoaded, setIsConfigLoaded] = createSignal(false);
+ const [configLoadError, setConfigLoadError] = createSignal<string | null>(null);
const [isSavingConfig, setIsSavingConfig] = createSignal(false);
let draftRevision = 0;
let configurationVersion = 0;
@@ -59,7 +62,8 @@ export function useAlertsConfigurationState(props: AlertsConfigurationSurfacePro
});
const destinationsState = useAlertDestinationsState({
activeTab: props.activeTab,
- canReload: () => !props.hasUnsavedChanges() && !isSavingConfig() && !isReloadingConfig(),
+ canReload: () =>
+ isConfigLoaded() && !props.hasUnsavedChanges() && !isSavingConfig() && !isReloadingConfig(),
});
const overridesState = useAlertOverridesState({
allResources: props.allResources,
@@ -75,6 +79,8 @@ export function useAlertsConfigurationState(props: AlertsConfigurationSurfacePro
// cancel or undo a request that has already reached the server.
setIsSavingConfig(false);
setIsReloadingConfig(true);
+ setIsConfigLoaded(false);
+ setConfigLoadError(null);
setSuppressDirtyFlag(true);
props.setHasUnsavedChanges(false);
destinationsState.resetDestinations();
@@ -93,12 +99,14 @@ export function useAlertsConfigurationState(props: AlertsConfigurationSurfacePro
await destinationsState.loadDestinations();
if (thisVersion !== configurationVersion) return;
+ setIsConfigLoaded(true);
if (options.notify) {
notificationStore.success(getAlertConfigDiscardedSuccess());
}
} catch (error) {
if (thisVersion !== configurationVersion) return;
+ setConfigLoadError(getAlertConfigLoadError());
logger.error('Failed to load alert configuration:', error);
if (options.notify) {
notificationStore.error(getAlertConfigReloadFailure());
@@ -115,6 +123,7 @@ export function useAlertsConfigurationState(props: AlertsConfigurationSurfacePro
const saveAlertConfiguration = async () => {
if (
+ !isConfigLoaded() ||
isSavingConfig() ||
isReloadingConfig() ||
destinationsState.isLoadingDestinations() ||
@@ -166,6 +175,8 @@ export function useAlertsConfigurationState(props: AlertsConfigurationSurfacePro
return {
isReloadingConfig,
+ isConfigLoaded,
+ configLoadError,
isSavingConfig,
guardedSetHasUnsavedChanges,
isLoadingDestinations: destinationsState.isLoadingDestinations,
diff --git a/frontend-modern/src/utils/__tests__/alertConfigPresentation.test.ts b/frontend-modern/src/utils/__tests__/alertConfigPresentation.test.ts
index e0281777f5..fed18b1026 100644
--- a/frontend-modern/src/utils/__tests__/alertConfigPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/alertConfigPresentation.test.ts
@@ -63,6 +63,9 @@ import {
getAlertConfigEscalationNotifyLabel,
getAlertConfigQuietHourSuppressOptions,
getAlertConfigLeaveConfirmation,
+ getAlertConfigLoadError,
+ getAlertConfigLoadingLabel,
+ getAlertConfigReloadLabel,
getAlertConfigReloadFailure,
getAlertConfigRecoveryHelp,
getAlertConfigResetDefaultsLabel,
@@ -83,6 +86,14 @@ import {
} from '@/utils/alertConfigPresentation';
describe('alertConfigPresentation', () => {
+ it('explains that a failed saved-settings read is not an editable default configuration', () => {
+ expect(getAlertConfigLoadError()).toBe(
+ 'Saved alert settings could not be loaded. Reload them before editing or saving.',
+ );
+ expect(getAlertConfigLoadingLabel()).toBe('Loading saved alert settings…');
+ expect(getAlertConfigReloadLabel()).toBe('Reload settings');
+ });
+
it('distinguishes a pending save from accepted settings with newer unsaved edits', () => {
expect(getAlertConfigSaveChangesLabel(true)).toBe('Saving…');
expect(getAlertConfigSaveChangesLabel(false)).toBe('Save Changes');
diff --git a/frontend-modern/src/utils/alertConfigPresentation.ts b/frontend-modern/src/utils/alertConfigPresentation.ts
index 3ca38aa08d..a9ece604e0 100644
--- a/frontend-modern/src/utils/alertConfigPresentation.ts
+++ b/frontend-modern/src/utils/alertConfigPresentation.ts
@@ -96,6 +96,10 @@ export const ALERT_CONFIG_SUMMARY_ALL_DISABLED =
'• All notification controls are disabled - alerts will be sent immediately';
export const ALERT_CONFIG_DISCARDED_SUCCESS = 'Changes discarded';
export const ALERT_CONFIG_RELOAD_FAILURE = 'Failed to reload configuration';
+export const ALERT_CONFIG_LOAD_ERROR =
+ 'Saved alert settings could not be loaded. Reload them before editing or saving.';
+export const ALERT_CONFIG_LOADING = 'Loading saved alert settings…';
+export const ALERT_CONFIG_RELOAD_LABEL = 'Reload settings';
export const ALERT_CONFIG_SAVE_SUCCESS = 'Configuration saved successfully!';
export const ALERT_CONFIG_SAVE_FAILURE = 'Failed to save configuration';
export const ALERT_CONFIG_DISCARD_LABEL = 'Discard';
@@ -110,6 +114,18 @@ export function getAlertConfigUnsavedChangesLabel() {
return ALERT_CONFIG_UNSAVED_CHANGES;
}
+export function getAlertConfigLoadError() {
+ return ALERT_CONFIG_LOAD_ERROR;
+}
+
+export function getAlertConfigLoadingLabel() {
+ return ALERT_CONFIG_LOADING;
+}
+
+export function getAlertConfigReloadLabel() {
+ return ALERT_CONFIG_RELOAD_LABEL;
+}
+
export function getAlertConfigSaveChangesLabel(isSaving = false) {
return isSaving ? ALERT_CONFIG_SAVING : ALERT_CONFIG_SAVE_CHANGES;
}