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.

Say why a backup shield is amber and link to its limit

rcourtman63d58910017c
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index 24c7579b8d..99400b8f1b 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -2979,6 +2979,18 @@ log text, and the English Assistant model-context labels must remain
untranslated; only the user-visible briefing labels and alert controls may use
the active app locale.
+The Recovery section is a thresholds deep link: `/alerts/thresholds/proxmox#backups`
+expands and scrolls to it like `#pbs` and `#pmg` (`useThresholdsTableState.test.tsx`).
+A successful Alerts page save re-reads the shared `alertsActivation` config in
+`useAlertsConfigurationState.ts` (only when the config write landed and the
+save still owns the editor), because backup shields and metric colours on
+every page read that config and otherwise kept the old limits until a reload.
+`refreshConfig` in `frontend-modern/src/stores/alertsActivation.ts` installs a
+read only while it is the latest: each read and each organisation switch takes
+a new generation, so a slow reply for the previous organisation or an older
+read cannot overwrite the current config (`alertsActivation.test.ts`,
+`useAlertsConfigurationState.test.tsx`).
+
The remaining alert configuration and history presentation helpers now also
have explicit alerts ownership. `frontend-modern/src/utils/alertActivationPresentation.ts`,
`frontend-modern/src/utils/alertAdministrationPresentation.ts`,
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 80702b08cc..88213dc17e 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -608,6 +608,12 @@ zero, pre-sample status, dated inspection, access denial and resumption.
and History API client at desktop and touch widths with synthetic responses.
These checks do not establish native guest thaw, collection or release availability.
+Backup age rules read through one resolver: `resolveBackupThresholds` in
+`frontend-modern/src/utils/format.ts` fills the fresh and stale defaults for
+both `getBackupInfo` and `getWorkloadsGuestBackupAgeRule`, so the copy that
+explains a shield (#2858) cannot disagree with the colour it explains.
+`workloadGuestPresentation.test.ts` pins the wording.
+
### Completed guest backup evidence versus current activity
The guest Overview keeps the last completed backup age and its existing
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 319e5b930d..d550644baf 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -1301,6 +1301,12 @@ change may globally weaken the Task 03 lifecycle-state idempotency invariant.
than converting missing evidence into "never backed up." Legacy workload
rows without platform metadata retain the Proxmox-compatible behavior at
the migration boundary.
+
+ A backup shield's hover card and dialog name the limit that coloured it
+ through `getWorkloadsGuestBackupAgeRule` (Fresh Hours decides amber for stale
+ and overdue alike; overdue also names Stale Hours), read from the same
+ configured thresholds the row already holds, so the row adds no request. The
+ dialog links to the Recovery thresholds (`ALERT_BACKUP_THRESHOLDS_PATH`).
11. Extend workload drawer derivations and runtime wiring through `frontend-modern/src/components/Workloads/guestDrawerModel.ts` and `frontend-modern/src/components/Workloads/useGuestDrawerState.ts`, and extend drawer overview rendering through `frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx`, rather than rebuilding canonical guest identity, discovery routing, or drawer-local normalization inside `frontend-modern/src/components/Workloads/GuestDrawer.tsx`
The selected resource owns its drawer tab and History range. Regrouping the
same resource under a new parent or node retains both even if its drawer
diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.json
index 9050c7a387..910e1c652c 100644
--- a/docs/release-control/v6/internal/subsystems/registry.json
+++ b/docs/release-control/v6/internal/subsystems/registry.json
@@ -2605,6 +2605,7 @@
"allow_same_subsystem_tests": false,
"test_prefixes": [],
"exact_files": [
+ "frontend-modern/src/stores/__tests__/alertsActivation.test.ts",
"frontend-modern/src/utils/__tests__/metricThresholds.test.ts"
]
},
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 7ebb0ea5b2..65a8b34be7 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -267,6 +267,10 @@ server posture policy (`freshnessWindowSeconds`) using the causes
`internal/recovery/posture.go` evaluates, and renders no rule until that policy
has loaded rather than a guessed window.
+The workload backup shield explains its colour from the configured Fresh and
+Stale Hours and links to the Recovery thresholds through the shared
+`ALERT_BACKUP_THRESHOLDS_PATH`; it reads no recovery evidence of its own.
+
Phone pool/disk rows preserve health and identity while using weighted widths,
consistent gutters and compact capacity/health labels. Full disk risk reasons
move into the existing expanded header; the ZFS activity badge uses supplied
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 4ea9e8b2f3..6f9a117ca3 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -2671,6 +2671,11 @@ overview must first have its canonical resource adapter project the
platform's top-level system as a unified resource so the builder
default still resolves to a populated table.
+`ALERT_BACKUP_THRESHOLDS_PATH` (`/alerts/thresholds/proxmox#backups`) names
+the Recovery thresholds whose fresh and stale hours colour every backup
+shield; the backup dialog links there and the thresholds page treats
+`#backups` like `#pbs` and `#pmg` (`resourceLinks.test.ts`).
+
17. Platform table ordering is a two-layer contract. Each platform table's
default order is owned by its page model's status-first compare
(`compareDockerContainers`, `compareKubernetesPods`, and peers), which
diff --git a/frontend-modern/browser-verification/9341f0a9f9aab008.json b/frontend-modern/browser-verification/9341f0a9f9aab008.json
new file mode 100644
index 0000000000..b7a1f3089e
--- /dev/null
+++ b/frontend-modern/browser-verification/9341f0a9f9aab008.json
@@ -0,0 +1,51 @@
+{
+ "version": 1,
+ "base_sha": "62ac128ffd15772c098a97de8790a6226d1f418c",
+ "verified_at": "2026-10-14T23:04:00Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/components/Workloads/GuestRowCells.tsx",
+ "frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts",
+ "frontend-modern/src/features/alerts/useAlertsConfigurationState.ts",
+ "frontend-modern/src/routing/resourceLinks.ts",
+ "frontend-modern/src/stores/alertsActivation.ts",
+ "frontend-modern/src/utils/format.ts",
+ "frontend-modern/src/utils/workloadGuestPresentation.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/components/Workloads/GuestRowCells.tsx": "207f3f2031c4bb7338de222dc0a4342603702ccc12f408d45271f0454a003f14",
+ "frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts": "c17eb297d0e68d2615a365f31542dbf4b569a27b506f68449876dffc474ed311",
+ "frontend-modern/src/features/alerts/useAlertsConfigurationState.ts": "66b3739ee3f7f894a15e30b1baa6f05ed3dd7bed2bdeb1cbae4184e818aa0ee9",
+ "frontend-modern/src/routing/resourceLinks.ts": "eb67457eb8537ac6c43192d698c64468f11b7b6f69a59b3824a927fce7f59bb4",
+ "frontend-modern/src/stores/alertsActivation.ts": "ce8af5a1692b2348fe2ceff0350ebd7ee09e79fa36f6409f87dafdbc4826c670",
+ "frontend-modern/src/utils/format.ts": "442f5681f5dd80ddb9899d12da2849f35a13cd61f45f4af0c36ba4c51cd7bb3f",
+ "frontend-modern/src/utils/workloadGuestPresentation.ts": "46b2f23b3f148922e66a2e96e34e2b491e20c4ab3826286310ffdb29e06b0071"
+ },
+ "routes": [
+ "/proxmox/overview",
+ "/alerts/thresholds/proxmox"
+ ],
+ "viewports": [
+ {
+ "width": 1280,
+ "height": 800
+ },
+ {
+ "width": 375,
+ "height": 812
+ }
+ ],
+ "states": [
+ "Before (main): a stale backup dialog read only \"Last completed backup ... 1 day ago\"; /alerts/thresholds/proxmox#backups left the page at the top",
+ "After: hover card and dialog name the limit: fresh \"Fresh: no more than 1 day old (Fresh Hours).\", stale \"Shown amber: more than 1 day old (Fresh Hours).\", overdue adds \"Also past Stale Hours (3 days).\" as its own sentence",
+ "Dialog link \"Change when backups count as old\" (40px tall on phone) opens the thresholds page with Recovery expanded and Fresh/Stale Hours in view at 1280 and 375",
+ "With Fresh Hours saved at 72 the same 1-day-old backup is fresh and reads \"no more than 3 days old\"",
+ "Phone 375px light theme: dialog fits, no horizontal overflow"
+ ],
+ "interactions": [
+ "Hovered and clicked fresh, stale and overdue shields on the Proxmox overview and read the rule line",
+ "Followed the dialog link; the dialog closed and the Recovery section scrolled into view",
+ "Saved Fresh Hours 24 on the thresholds page and returned in-app without a reload: the 1-day-old backup turned amber immediately (it had stayed stale-coloured until a reload before the config refresh fix)",
+ "Repeated the dialog and link on a 375x812 phone viewport"
+ ]
+}
diff --git a/frontend-modern/src/components/Workloads/GuestRowCells.tsx b/frontend-modern/src/components/Workloads/GuestRowCells.tsx
index f69be05198..1c9df06d2a 100644
--- a/frontend-modern/src/components/Workloads/GuestRowCells.tsx
+++ b/frontend-modern/src/components/Workloads/GuestRowCells.tsx
@@ -1,15 +1,21 @@
import { createMemo, createSignal, For, Show } from 'solid-js';
import { Dialog } from '@/components/shared/Dialog';
+import {
+ EXTERNAL_TEXT_LINK_BASE_CLASS,
+ EXTERNAL_TEXT_LINK_VARIANT_CLASSES,
+} from '@/components/shared/ExternalTextLink';
import { TooltipPortal } from '@/components/shared/TooltipPortal';
import { useTooltip } from '@/hooks/useTooltip';
import { useAlertsActivation } from '@/stores/alertsActivation';
import type { GuestNetworkInterface } from '@/types/api';
import { formatBytes, formatRelativeTime, getBackupInfo, type BackupInfo } from '@/utils/format';
+import { ALERT_BACKUP_THRESHOLDS_PATH } from '@/routing/resourceLinks';
import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
import type { AvailabilityProbePresentation } from '@/utils/availabilityProbePresentation';
import {
+ getWorkloadsGuestBackupAgeRule,
getWorkloadsGuestBackupStatusPresentation,
getWorkloadsGuestBackupTooltip,
getWorkloadsGuestNetworkEmptyState,
@@ -337,6 +343,9 @@ function BackupStatusCell(props: {
: getBackupAgeBadgeLabel(props.lastBackup, info(), now()),
);
const hasCompletedBackup = createMemo(() => info().ageMs !== null);
+ const ageRule = createMemo(() =>
+ getWorkloadsGuestBackupAgeRule(info().status, alertsActivation.getBackupThresholds()),
+ );
const ariaLabel = createMemo(() => {
const currentInfo = info();
if (props.indicator) {
@@ -361,7 +370,7 @@ function BackupStatusCell(props: {
// Both entry points reveal the same retained completion evidence. Hover
// stays a shortcut on a fine pointer; the native button opens a read-only
// dialog for keyboard/touch without stealing the enclosing row action.
- const Evidence = () => (
+ const Evidence = (evidenceProps: { ruleLink?: boolean }) => (
<div class="space-y-2 text-xs">
<Show when={props.guestName}>
<p class="font-medium text-base-content wrap-break-word">{props.guestName}</p>
@@ -386,6 +395,22 @@ function BackupStatusCell(props: {
{new Date(props.lastBackup!).toLocaleTimeString()}
</time>
<div class="text-base-content">{info().ageFormatted}</div>
+ <Show when={ageRule()}>
+ {(rule) => (
+ <p class="text-muted" data-backup-age-rule>
+ {rule()}
+ </p>
+ )}
+ </Show>
+ <Show when={evidenceProps.ruleLink && ageRule()}>
+ <a
+ href={ALERT_BACKUP_THRESHOLDS_PATH}
+ class={`${EXTERNAL_TEXT_LINK_BASE_CLASS} ${EXTERNAL_TEXT_LINK_VARIANT_CLASSES.compactAction} -mx-1`}
+ onClick={() => setDetailsOpen(false)}
+ >
+ Change when backups count as old
+ </a>
+ </Show>
</div>
</Show>
<Show when={info().status === 'unknown'}>
@@ -464,7 +489,7 @@ function BackupStatusCell(props: {
</button>
</div>
<div class="overflow-y-auto p-4">
- <Evidence />
+ <Evidence ruleLink />
</div>
</Dialog>
</Show>
diff --git a/frontend-modern/src/components/Workloads/__tests__/BackupStatusCell.test.tsx b/frontend-modern/src/components/Workloads/__tests__/BackupStatusCell.test.tsx
index c4ad178d24..e72170d90d 100644
--- a/frontend-modern/src/components/Workloads/__tests__/BackupStatusCell.test.tsx
+++ b/frontend-modern/src/components/Workloads/__tests__/BackupStatusCell.test.tsx
@@ -1,5 +1,5 @@
import { describe, it, expect, afterEach } from 'vitest';
-import { render, cleanup } from '@solidjs/testing-library';
+import { render, cleanup, fireEvent, screen } from '@solidjs/testing-library';
import { BackupStatusCell } from '../GuestRowCells';
@@ -98,4 +98,27 @@ describe('BackupStatusCell', () => {
expect(badge.textContent?.trim()).toBe('Running');
expect(badge.getAttribute('aria-label')).toContain('last completed backup');
});
+ // #2858: a user on a three-day cycle saw amber after one day and could not
+ // find where that limit lives. The dialog names the limit and links to it.
+ it('says which age limit made a backup amber and links to where it is set', () => {
+ const badge = renderCell(Date.now() - 48 * HOUR_MS);
+ fireEvent.click(badge);
+
+ const dialog = screen.getByRole('dialog');
+ expect(dialog.querySelector('[data-backup-age-rule]')?.textContent).toBe(
+ 'Shown amber: more than 1 day old (Fresh Hours).',
+ );
+ const link = screen.getByRole('link', { name: 'Change when backups count as old' });
+ expect(link.getAttribute('href')).toBe('/alerts/thresholds/proxmox#backups');
+
+ fireEvent.click(link);
+ expect(screen.queryByRole('dialog')).toBeNull();
+ });
+
+ it('offers no age limit or link when no backup has completed', () => {
+ fireEvent.click(renderCell(null));
+
+ expect(screen.getByRole('dialog').querySelector('[data-backup-age-rule]')).toBeNull();
+ expect(screen.queryByRole('link', { name: 'Change when backups count as old' })).toBeNull();
+ });
});
diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsx
index ee025ca82f..16bc30bbfe 100644
--- a/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsx
+++ b/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsx
@@ -2440,6 +2440,28 @@ describe('GuestRow', () => {
expect(onClick).not.toHaveBeenCalled();
});
+ // #2858: the amber shield names the operator's own limits (this mock's
+ // stale limit is 48 hours, not the 72-hour default) and links to them.
+ it('says which backup age limit a row crossed and links to where it is set', () => {
+ const guest = makeGuest({
+ type: 'qemu',
+ workloadType: 'vm',
+ lastBackup: Date.now() - 60 * 3_600_000,
+ });
+ renderGuestRow({ guest, visibleColumnIds: ['name', 'backup'] });
+
+ fireEvent.click(screen.getByRole('button', { name: /^Backup status: overdue/ }));
+ const dialog = screen.getByRole('dialog', {
+ name: `Backup status details for ${guest.name}`,
+ });
+ expect(dialog).toHaveTextContent(
+ 'Shown amber: more than 1 day old (Fresh Hours). Also past Stale Hours (2 days).',
+ );
+ expect(
+ screen.getByRole('link', { name: 'Change when backups count as old' }),
+ ).toHaveAttribute('href', '/alerts/thresholds/proxmox#backups');
+ });
+
it('keeps the 44px touch target on the Backup column badge', () => {
renderGuestRow({
guest: makeGuest({ type: 'qemu', workloadType: 'vm', lastBackup: Date.now() }),
diff --git a/frontend-modern/src/features/alerts/__tests__/useAlertsConfigurationState.test.tsx b/frontend-modern/src/features/alerts/__tests__/useAlertsConfigurationState.test.tsx
index bddb2f1cb2..fd382cc64e 100644
--- a/frontend-modern/src/features/alerts/__tests__/useAlertsConfigurationState.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/useAlertsConfigurationState.test.tsx
@@ -53,6 +53,7 @@ vi.mock('../useAlertOverridesState', () => ({
}),
}));
+import { useAlertsActivation } from '@/stores/alertsActivation';
import { useAlertsConfigurationState } from '../useAlertsConfigurationState';
describe('useAlertsConfigurationState', () => {
@@ -150,4 +151,39 @@ describe('useAlertsConfigurationState', () => {
expect(mockSaveDestinations).toHaveBeenCalledTimes(1);
expect(setHasUnsavedChanges).toHaveBeenLastCalledWith(false);
});
+ // A user who raised Fresh Hours for a three-day backup cycle (#2858) went
+ // back to their guests and still saw amber until a reload: the shields read
+ // the shared activation config, which the save did not refresh.
+ it('refreshes the shared activation config once a save lands', async () => {
+ mockGetConfig.mockResolvedValueOnce({ overrides: {} });
+ const { result } = renderHook(() =>
+ useAlertsConfigurationState({
+ activeTab: () => 'thresholds',
+ allResources: () => [],
+ byType: () => [],
+ children: () => [],
+ activeAlerts: {},
+ removeAlerts: vi.fn(),
+ setOverviewOverrides: vi.fn(),
+ hasUnsavedChanges: () => true,
+ setHasUnsavedChanges: vi.fn(),
+ alertsActivationState: () => 'active',
+ alertsActivationConfig: () => ({ enabled: true }),
+ }),
+ );
+ await waitFor(() => expect(result.isReloadingConfig()).toBe(false));
+
+ mockGetConfig.mockResolvedValue({
+ overrides: {},
+ backupDefaults: { freshHours: 72, staleHours: 96 },
+ });
+ await result.saveAlertConfiguration();
+
+ await waitFor(() =>
+ expect(useAlertsActivation().getBackupThresholds()).toEqual({
+ freshHours: 72,
+ staleHours: 96,
+ }),
+ );
+ });
});
diff --git a/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsTableState.test.tsx b/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsTableState.test.tsx
index 4bf706e226..38eeb1e2d4 100644
--- a/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsTableState.test.tsx
+++ b/frontend-modern/src/features/alerts/thresholds/hooks/__tests__/useThresholdsTableState.test.tsx
@@ -5,10 +5,12 @@ import type { ThresholdsTableProps } from '@/features/alerts/thresholds/types';
import { useThresholdsTableState } from '../useThresholdsTableState';
let mockPathname = '/alerts/thresholds/systems';
+let mockHash = '';
+const setCollapsedSpy = vi.fn();
const navigateSpy = vi.fn();
vi.mock('@solidjs/router', () => ({
- useLocation: () => ({ pathname: mockPathname }),
+ useLocation: () => ({ pathname: mockPathname, hash: mockHash }),
useNavigate: () => navigateSpy,
}));
@@ -21,6 +23,7 @@ vi.mock('@/components/Alerts/Thresholds/hooks/useCollapsedSections', () => ({
collapseAll: vi.fn(),
expandAll: vi.fn(),
isCollapsed: () => false,
+ setCollapsed: setCollapsedSpy,
toggleSection: vi.fn(),
}),
}));
@@ -182,6 +185,8 @@ const buildProps = (): ThresholdsTableProps =>
beforeEach(() => {
mockPathname = '/alerts/thresholds/systems';
+ mockHash = '';
+ setCollapsedSpy.mockReset();
navigateSpy.mockReset();
localStorage.clear();
});
@@ -238,4 +243,23 @@ describe('useThresholdsTableState', () => {
}),
);
});
+ // The backup shield's dialog links here, so a user can change when a backup
+ // counts as old (#2858): the Recovery section opens and scrolls into view.
+ it('opens and scrolls to the Recovery section from a #backups link', () => {
+ mockPathname = '/alerts/thresholds/proxmox';
+ mockHash = '#backups';
+ let captured: ReturnType<typeof useThresholdsTableState> | undefined;
+
+ const Harness = () => {
+ captured = useThresholdsTableState(buildProps());
+ return null;
+ };
+
+ render(() => <Harness />);
+ expect(setCollapsedSpy).toHaveBeenCalledWith('backups', false);
+
+ const section = { scrollIntoView: vi.fn() } as unknown as HTMLDivElement;
+ captured!.registerSection('backups')(section);
+ expect(section.scrollIntoView).toHaveBeenCalledWith({ block: 'start' });
+ });
});
diff --git a/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts b/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts
index 029b99aab5..776ca89fa5 100644
--- a/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts
+++ b/frontend-modern/src/features/alerts/thresholds/hooks/useThresholdsTableState.ts
@@ -374,7 +374,8 @@ export function useThresholdsTableState(props: ThresholdsTableProps) {
);
const vmwareVMsWithOverrides = createMemo(() => filterResources(rawVmwareVMsWithOverrides()));
- // Deep-links to a Proxmox sub-section (PBS / PMG) arrive as `#pbs` / `#pmg`.
+ // Deep-links to a Proxmox sub-section (PBS / PMG / Recovery) arrive as
+ // `#pbs` / `#pmg` / `#backups`.
// Expand the target section and scroll it into view. The section's anchor only
// mounts once its table rows resolve, so the effect keys off the registered
// section element (set by the section's `ref`): it re-runs the moment the
@@ -384,7 +385,7 @@ export function useThresholdsTableState(props: ThresholdsTableProps) {
const [sectionElements, setSectionElements] = createSignal<Record<string, HTMLElement | null>>(
{},
);
- const SECTION_HASH_IDS = new Set(['pbs', 'pmg']);
+ const SECTION_HASH_IDS = new Set(['pbs', 'pmg', 'backups']);
const [lastSectionHashScrolled, setLastSectionHashScrolled] = createSignal<string | null>(null);
createEffect(() => {
diff --git a/frontend-modern/src/features/alerts/useAlertsConfigurationState.ts b/frontend-modern/src/features/alerts/useAlertsConfigurationState.ts
index 57d158a992..62f2eb2553 100644
--- a/frontend-modern/src/features/alerts/useAlertsConfigurationState.ts
+++ b/frontend-modern/src/features/alerts/useAlertsConfigurationState.ts
@@ -2,6 +2,7 @@ import { createSignal, onCleanup, onMount } from 'solid-js';
import type { Accessor } from 'solid-js';
import { AlertsAPI } from '@/api/alerts';
+import { useAlertsActivation } from '@/stores/alertsActivation';
import { eventBus } from '@/stores/events';
import { notificationStore } from '@/stores/notifications';
import type { Alert } from '@/types/api';
@@ -45,6 +46,7 @@ export interface AlertsConfigurationSurfaceProps {
}
export function useAlertsConfigurationState(props: AlertsConfigurationSurfaceProps) {
+ const alertsActivation = useAlertsActivation();
const [isReloadingConfig, setIsReloadingConfig] = createSignal(false);
const [isConfigLoaded, setIsConfigLoaded] = createSignal(false);
const [configLoadError, setConfigLoadError] = createSignal<string | null>(null);
@@ -146,8 +148,10 @@ export function useAlertsConfigurationState(props: AlertsConfigurationSurfacePro
const savedVersion = configurationVersion;
const ownsSave = () => savedVersion === configurationVersion;
setIsSavingConfig(true);
+ let configSaved = false;
try {
await AlertsAPI.updateConfig(result.alertConfig!);
+ configSaved = true;
if (!ownsSave()) return;
await destinationsState.saveDestinations(destinationsSnapshot, ownsSave);
if (!ownsSave()) return;
@@ -159,6 +163,10 @@ export function useAlertsConfigurationState(props: AlertsConfigurationSurfacePro
if (ownsSave()) throw error;
} finally {
if (ownsSave()) setIsSavingConfig(false);
+ // Backup shields and metric bars on every page colour by the shared
+ // activation config; re-read it so a saved limit shows without a
+ // reload, even when a later destinations write fails.
+ if (configSaved && ownsSave()) void alertsActivation.refreshConfig();
}
};
diff --git a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
index a8c12b9c4a..27e6e6f93a 100644
--- a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
+++ b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
@@ -10,6 +10,7 @@ import {
KUBERNETES_PATH,
KUBERNETES_QUERY_PARAMS,
PMG_THRESHOLDS_PATH,
+ ALERT_BACKUP_THRESHOLDS_PATH,
PATROL_AUTONOMY_OPERATIONS_LOOP_PATH,
PATROL_CONTROL_ANCHOR,
PATROL_CONTROL_PATH,
@@ -342,6 +343,10 @@ describe('resource link routing contract', () => {
expect(PMG_THRESHOLDS_PATH).toBe('/alerts/thresholds/mail-gateway');
});
+ it('opens the Recovery thresholds that set when a backup counts as old', () => {
+ expect(ALERT_BACKUP_THRESHOLDS_PATH).toBe('/alerts/thresholds/proxmox#backups');
+ });
+
it('deep-links one stable Patrol attention item without changing the route owner', () => {
expect(buildPatrolAttentionPath('record/one')).toBe('/patrol?attention=record%2Fone');
expect(buildPatrolAttentionPath('')).toBe('/patrol');
diff --git a/frontend-modern/src/routing/resourceLinks.ts b/frontend-modern/src/routing/resourceLinks.ts
index 1c77d7807a..60561b1a45 100644
--- a/frontend-modern/src/routing/resourceLinks.ts
+++ b/frontend-modern/src/routing/resourceLinks.ts
@@ -48,6 +48,8 @@ export const VMWARE_PATH = '/vmware';
export const VMWARE_DEFAULT_TAB = 'overview';
export const ALERT_THRESHOLDS_PATH = '/alerts/thresholds';
export const PMG_THRESHOLDS_PATH = '/alerts/thresholds/mail-gateway';
+// The Recovery section, whose fresh and stale hours colour every backup shield.
+export const ALERT_BACKUP_THRESHOLDS_PATH = `${ALERT_THRESHOLDS_PATH}/proxmox#backups`;
export const PATROL_PATH = '/patrol';
export const PATROL_ATTENTION_QUERY_PARAM = 'attention';
export const ACTIONS_PATH = '/actions';
diff --git a/frontend-modern/src/stores/__tests__/alertsActivation.test.ts b/frontend-modern/src/stores/__tests__/alertsActivation.test.ts
index cca247590b..ed887608d7 100644
--- a/frontend-modern/src/stores/__tests__/alertsActivation.test.ts
+++ b/frontend-modern/src/stores/__tests__/alertsActivation.test.ts
@@ -65,4 +65,45 @@ describe('alerts activation ownership boundary', () => {
expect(store.notificationDeliveryEnabled()).toBe(false);
expect(window.__pulseAlertsDetectionEnabled).toBe(false);
});
+ // An Alerts page save re-reads this config so backup shields and metric
+ // colours follow a saved limit; that read must not land in another
+ // organisation, nor let an older read overwrite a newer one.
+ it('drops a config read that an organisation switch has overtaken', async () => {
+ let resolveRead: (config: AlertConfig) => void = () => undefined;
+ vi.spyOn(AlertsAPI, 'getConfig').mockReturnValue(
+ new Promise<AlertConfig>((resolve) => {
+ resolveRead = resolve;
+ }),
+ );
+ const store = useAlertsActivation();
+ const read = store.refreshConfig();
+
+ eventBus.emit('org_switched', 'other-org');
+ resolveRead(alertConfig('active'));
+ await read;
+
+ expect(store.config()).toBeNull();
+ expect(store.activationState()).toBeNull();
+ });
+
+ it('keeps the newest config read when an older one answers last', async () => {
+ const reads: Array<(config: AlertConfig) => void> = [];
+ vi.spyOn(AlertsAPI, 'getConfig').mockImplementation(
+ () =>
+ new Promise<AlertConfig>((resolve) => {
+ reads.push(resolve);
+ }),
+ );
+ const store = useAlertsActivation();
+ const older = store.refreshConfig();
+ const newer = store.refreshConfig();
+
+ reads[1]?.(alertConfig('snoozed'));
+ await newer;
+ reads[0]?.(alertConfig('active'));
+ await older;
+
+ expect(store.activationState()).toBe('snoozed');
+ expect(store.isLoading()).toBe(false);
+ });
});
diff --git a/frontend-modern/src/stores/alertsActivation.ts b/frontend-modern/src/stores/alertsActivation.ts
index 677a186db2..b483ae2752 100644
--- a/frontend-modern/src/stores/alertsActivation.ts
+++ b/frontend-modern/src/stores/alertsActivation.ts
@@ -37,20 +37,30 @@ const ensureConfigLoaded = async (): Promise<AlertConfig | null> => {
return current;
};
+// Each config read and each organisation switch takes a new generation. A
+// read installs its answer only while it is still the latest, so a slow reply
+// for the previous organisation, or an older read overtaken by a newer one,
+// cannot overwrite what the page now shows.
+let configGeneration = 0;
+
// Refresh config from API
const refreshConfig = async (): Promise<void> => {
+ const generation = ++configGeneration;
+ const isLatest = () => generation === configGeneration;
try {
setIsLoading(true);
setLastError(null);
const alertConfig = await AlertsAPI.getConfig();
+ if (!isLatest()) return;
setConfig(alertConfig);
setGlobalAlertsDetectionEnabled(alertConfig.enabled);
applyActivationState(alertConfig.activationState || 'active');
} catch (error) {
+ if (!isLatest()) return;
logger.error('Failed to fetch alert config:', error);
setLastError(error instanceof Error ? error.message : 'Unknown error');
} finally {
- setIsLoading(false);
+ if (isLatest()) setIsLoading(false);
}
};
@@ -173,6 +183,7 @@ const getTrueNASDiskTemperatureThresholds = (disk: Pick<Resource, 'id' | 'physic
};
eventBus.on('org_switched', () => {
+ configGeneration++;
setConfig(null);
setGlobalAlertsDetectionEnabled(null);
applyActivationState(null);
diff --git a/frontend-modern/src/utils/__tests__/workloadGuestPresentation.test.ts b/frontend-modern/src/utils/__tests__/workloadGuestPresentation.test.ts
index d72591afde..af6c3c98b9 100644
--- a/frontend-modern/src/utils/__tests__/workloadGuestPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/workloadGuestPresentation.test.ts
@@ -1,6 +1,7 @@
import { describe, expect, it } from 'vitest';
import { guestDiskDeferrals } from '@/components/Workloads/__fixtures__/guestDiskDeferrals';
import {
+ getWorkloadsGuestBackupAgeRule,
getWorkloadsGuestBackupStatusPresentation,
getWorkloadsGuestBackupTooltip,
getWorkloadsGuestProtectionPresentation,
@@ -217,4 +218,31 @@ describe('workloadGuestPresentation', () => {
// An agent's staleness says nothing about Proxmox's own filesystems.
expect(getWorkloadGuestDiskRead({ agentStale: true }, true).state).toBe('current');
});
+ it('names the age limit that coloured a completed backup, in days when whole', () => {
+ const defaults = { freshHours: 24, staleHours: 72 };
+ expect(getWorkloadsGuestBackupAgeRule('fresh', defaults)).toBe(
+ 'Fresh: no more than 1 day old (Fresh Hours).',
+ );
+ expect(getWorkloadsGuestBackupAgeRule('stale', defaults)).toBe(
+ 'Shown amber: more than 1 day old (Fresh Hours).',
+ );
+ // Overdue is amber for the same reason as stale: Fresh Hours decides the
+ // colour, so raising Stale Hours would not postpone it.
+ expect(getWorkloadsGuestBackupAgeRule('overdue', defaults)).toBe(
+ 'Shown amber: more than 1 day old (Fresh Hours). Also past Stale Hours (3 days).',
+ );
+ // A three-day backup cycle (#2858) sets Fresh Hours to 72.
+ expect(getWorkloadsGuestBackupAgeRule('stale', { freshHours: 72, staleHours: 96 })).toBe(
+ 'Shown amber: more than 3 days old (Fresh Hours).',
+ );
+ expect(getWorkloadsGuestBackupAgeRule('fresh', { freshHours: 36, staleHours: 96 })).toBe(
+ 'Fresh: no more than 36 hours old (Fresh Hours).',
+ );
+ // Unset limits fall back to the same defaults the shield is judged by.
+ expect(getWorkloadsGuestBackupAgeRule('overdue')).toBe(
+ 'Shown amber: more than 1 day old (Fresh Hours). Also past Stale Hours (3 days).',
+ );
+ expect(getWorkloadsGuestBackupAgeRule('never', defaults)).toBeNull();
+ expect(getWorkloadsGuestBackupAgeRule('unknown', defaults)).toBeNull();
+ });
});
diff --git a/frontend-modern/src/utils/format.ts b/frontend-modern/src/utils/format.ts
index 2cae0d53c0..be212baa88 100644
--- a/frontend-modern/src/utils/format.ts
+++ b/frontend-modern/src/utils/format.ts
@@ -294,6 +294,17 @@ export interface BackupThresholds {
staleHours?: number;
}
+/** The fresh and stale limits a backup is judged by, defaults filled in. */
+export function resolveBackupThresholds(thresholds?: BackupThresholds): {
+ freshHours: number;
+ staleHours: number;
+} {
+ return {
+ freshHours: thresholds?.freshHours ?? DEFAULT_FRESH_HOURS,
+ staleHours: thresholds?.staleHours ?? DEFAULT_STALE_HOURS,
+ };
+}
+
/**
* Analyzes backup freshness for a guest.
* @param lastBackup - ISO timestamp string or Unix timestamp (ms)
@@ -349,9 +360,7 @@ export function getBackupInfo(
}
const ageMs = nowMs - timestamp;
- // Use provided thresholds or fall back to defaults
- const freshHours = thresholds?.freshHours ?? DEFAULT_FRESH_HOURS;
- const staleHours = thresholds?.staleHours ?? DEFAULT_STALE_HOURS;
+ const { freshHours, staleHours } = resolveBackupThresholds(thresholds);
const freshThresholdMs = freshHours * 60 * 60 * 1000;
const staleThresholdMs = staleHours * 60 * 60 * 1000;
diff --git a/frontend-modern/src/utils/workloadGuestPresentation.ts b/frontend-modern/src/utils/workloadGuestPresentation.ts
index 02997cc7be..e04a59b09e 100644
--- a/frontend-modern/src/utils/workloadGuestPresentation.ts
+++ b/frontend-modern/src/utils/workloadGuestPresentation.ts
@@ -1,4 +1,4 @@
-import type { BackupStatus } from '@/utils/format';
+import { resolveBackupThresholds, type BackupStatus, type BackupThresholds } from '@/utils/format';
// The age-derived BackupStatus plus the overlay state for a backup that is
// running right now. 'running' never comes from getBackupInfo (which only
@@ -58,6 +58,36 @@ export function getWorkloadsGuestBackupStatusPresentation(
return BACKUP_STATUS_PRESENTATION[status];
}
+const formatBackupAgeLimit = (hours: number): string => {
+ if (hours >= 24 && hours % 24 === 0) {
+ const days = hours / 24;
+ return `${days} day${days === 1 ? '' : 's'}`;
+ }
+ return `${hours} hour${hours === 1 ? '' : 's'}`;
+};
+
+// Which of the operator's own age limits coloured a completed backup, so an
+// amber shield says why instead of leaving the user to find the Recovery
+// thresholds (#2858). Amber starts after Fresh Hours for stale and overdue
+// alike, so both name that field; Stale Hours only marks overdue on top.
+// Statuses without an age have no rule to name.
+export function getWorkloadsGuestBackupAgeRule(
+ status: BackupStatus,
+ thresholds?: BackupThresholds,
+): string | null {
+ const { freshHours, staleHours } = resolveBackupThresholds(thresholds);
+ switch (status) {
+ case 'fresh':
+ return `Fresh: no more than ${formatBackupAgeLimit(freshHours)} old (Fresh Hours).`;
+ case 'stale':
+ return `Shown amber: more than ${formatBackupAgeLimit(freshHours)} old (Fresh Hours).`;
+ case 'overdue':
+ return `Shown amber: more than ${formatBackupAgeLimit(freshHours)} old (Fresh Hours). Also past Stale Hours (${formatBackupAgeLimit(staleHours)}).`;
+ default:
+ return null;
+ }
+}
+
export function getWorkloadsGuestBackupTooltip(
status: BackupStatus,
ageFormatted?: string | null,