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.

Keep the assessed Backups view stable through health refreshes

pulse-triage[bot]612b02e18888
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 2840b61454..e7b1a0508a 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -10533,3 +10533,15 @@ current tooltip readings and input ownership. `ProxmoxBackupsTable.test.tsx`
exercises the parsed inventory and ordinary polling through the consuming date
filter, preserving bounded reads. Backup/posture policy, source association,
read cadence and guest operations are unchanged; this is not native recovery.
+
+### Backup polling does not choose a different workspace
+
+Bare legacy Backups links retain the useful initial health-based view choice,
+then bind it to the existing canonical view route once inventory is readable
+and the first assessment settles. History replacement preserves shared query
+filters and the fragment without a scroll jump. Explicit named/query views
+remain authoritative. Subsequent health changes update the mounted workspace,
+not its selection; existing tab and health-count actions remain the way to
+choose another view. This adds no route, assessment or backend mutation.
+`ProxmoxBackupsTable.test.tsx` verifies focused open evidence across both polling
+directions, deferred/failing assessment, retry and URL/history compatibility.
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 75eb066dcb..0368bb3311 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -8137,3 +8137,26 @@ current tooltip readings and input ownership. `ProxmoxBackupsTable.test.tsx`
exercises the parsed inventory and ordinary polling through the consuming date
filter, preserving bounded reads. Backup/posture policy, source association,
read cadence and guest operations are unchanged; this is not native recovery.
+
+### Bare Backups entry chooses a view once, not on each health poll
+
+An existing `/proxmox/backups` bookmark without a named or legacy-query view
+chooses its health-based default after readable inventory and the first
+workload protection assessment settle. Attention, unprotected or unknown
+workloads still open Coverage; otherwise the existing By date default applies.
+The chosen view becomes its existing canonical route through a history replace
+without scrolling. Shared query filters and the fragment survive; incompatible
+per-view facets are cleared by the existing view-path builder. Explicit named
+and legacy-query views remain authoritative and are not rewritten.
+
+Later inventory/posture polls and posture retries update counts, evidence and
+unavailability honestly without silently replacing that workspace or its open
+row and keyboard focus. The operator can still change views or follow a health
+count to filtered Coverage. No assessment, backup completion, provider query,
+permissions, guest operation, persistence or recovery guarantee changes.
+
+`ProxmoxBackupsTable.test.tsx` covers both polling directions, unknown and failed
+initial assessments, retry, deferred initial assessment, common filters/hash,
+replace-history semantics, explicit views and empty inventory. Browser proof
+must exercise the actual table, inventory parsers and posture client through a
+local safe producer at desktop and narrow widths, with native pixel inspection.
diff --git a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
index df47592504..7dffe447d0 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
@@ -1,4 +1,12 @@
-import { For, Show, createMemo, createSignal, type Component, type JSX } from 'solid-js';
+import {
+ For,
+ Show,
+ createEffect,
+ createMemo,
+ createSignal,
+ type Component,
+ type JSX,
+} from 'solid-js';
import ChevronRightIcon from 'lucide-solid/icons/chevron-right';
import { useLocation, useNavigate, useSearchParams } from '@solidjs/router';
import { FilterBar, type FilterDef, type FilterSelectOption } from '@/components/shared/FilterBar';
@@ -491,6 +499,20 @@ export const ProxmoxBackupsTable: Component<{
// The health strip's counts that name a posture filter toggle it. From the
// date view a count opens Coverage already filtered to those workloads.
const navigate = useNavigate();
+ // Old bookmarks can enter without a view segment. Pick their useful default
+ // only after the first assessment settles, then let the existing URL own it.
+ // A later poll must update health, not replace the workspace under inspection.
+ createEffect(() => {
+ if (
+ location.pathname.replace(/\/+$/, '') !== PROXMOX_BACKUPS_PATH ||
+ legacyQueryView() ||
+ !hasReadableInventory() ||
+ ((props.workloads?.length ?? 0) > 0 && !protectionPostures.resolvedOnce())
+ ) {
+ return;
+ }
+ navigate(`${backupViewPath(view())}${location.hash}`, { replace: true, scroll: false });
+ });
const postureSegmentFilter = (posture: Exclude<CoverageFilterValue, 'all'>) => {
const pressed = view() === 'coverage' && coverageFilter() === posture;
// A zero count would only open an empty list.
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
index 42074febeb..bd9ee15c90 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
@@ -2560,3 +2560,119 @@ describe('backup activity day controls survive ordinary inventory polling', () =
expect(apiFetchMock).toHaveBeenCalledTimes(4);
});
});
+
+describe('bare Backups entry retains its assessed workspace', () => {
+ beforeEach(() => {
+ vi.useFakeTimers({ toFake: ['setInterval', 'clearInterval'] });
+ window.history.replaceState({}, '', '/proxmox/backups');
+ mockBackupAPIs();
+ });
+ afterEach(() => vi.useRealTimers());
+
+ const responseFor = (
+ state: 'protected' | 'attention' | 'unknown',
+ ): ProtectionPosturesResponse => ({
+ data: [{ ...protectionPosture('ct-112'), state, explanation: `Observed ${state} posture.` }],
+ policy: protectionPolicy,
+ });
+
+ it.each([
+ { initial: 'attention', next: 'protected', view: 'coverage', table: 'coverage' },
+ { initial: 'protected', next: 'attention', view: 'date', table: 'recoverable' },
+ { initial: 'unknown', next: 'protected', view: 'coverage', table: 'coverage' },
+ ] as const)(
+ 'keeps $view, its open evidence and focus when $initial becomes $next',
+ async ({ initial, next, view, table }) => {
+ let state: 'protected' | 'attention' | 'unknown' = initial;
+ apiFetchJSONMock.mockImplementation(() => Promise.resolve(responseFor(state)));
+ const historyLength = window.history.length;
+ mountBackupReadState();
+ await waitFor(() => expect(window.location.pathname).toBe(`/proxmox/backups/${view}`));
+ expect(window.history.length).toBe(historyLength);
+ const row = document.querySelector(`[data-proxmox-backup-row="${table}"]`)!;
+ const disclosure = within(row as HTMLElement).getByRole('button', {
+ name: /expand details/i,
+ });
+ await fireEvent.click(disclosure);
+ disclosure.focus();
+ const detail = document.getElementById(disclosure.getAttribute('aria-controls')!);
+ expect(detail).not.toBeNull();
+
+ state = next;
+ await vi.advanceTimersByTimeAsync(30_000);
+ await waitFor(() =>
+ expect(screen.getByRole('button', { name: `1 ${next}` })).toBeInTheDocument(),
+ );
+ expect(window.location.pathname).toBe(`/proxmox/backups/${view}`);
+ expect(
+ screen.getByRole('link', { name: view === 'date' ? /by date/i : /coverage/i }),
+ ).toHaveAttribute('aria-current', 'page');
+ expect(document.getElementById(disclosure.getAttribute('aria-controls')!)).toBe(detail);
+ expect(disclosure).toHaveAttribute('aria-expanded', 'true');
+ expect(disclosure).toHaveFocus();
+ expect(apiFetchJSONMock).toHaveBeenCalledTimes(2);
+ expect(sourceCalls('pve')).toHaveLength(2);
+ expect(sourceCalls('pbs')).toHaveLength(2);
+ },
+ );
+
+ it('waits for the initial assessment, preserves common filters/hash and replaces rather than pushes', async () => {
+ const pending = deferred<ProtectionPosturesResponse>();
+ apiFetchJSONMock.mockReturnValue(pending.promise);
+ window.history.replaceState(
+ {},
+ '',
+ '/proxmox/backups/?q=pbs&node=pve-a&type=ct&operator=saved#evidence',
+ );
+ const historyLength = window.history.length;
+ mountBackupReadState();
+ await screen.findByRole('link', { name: /by date/i });
+ expect(window.location.pathname).toBe('/proxmox/backups/');
+ pending.resolve(responseFor('attention'));
+ await waitFor(() => expect(window.location.pathname).toBe('/proxmox/backups/coverage'));
+ expect(window.location.search).toBe('?q=pbs&node=pve-a&type=ct&operator=saved');
+ expect(window.location.hash).toBe('#evidence');
+ expect(window.history.length).toBe(historyLength);
+ expect(screen.getByPlaceholderText(/search backups by workload/i)).toHaveValue('pbs');
+ expect(document.querySelectorAll('[data-proxmox-backup-row="coverage"]')).toHaveLength(1);
+ });
+
+ it('keeps the initial failure workspace through retry and lets a later health action choose Coverage', async () => {
+ apiFetchJSONMock.mockRejectedValueOnce(new Error('Posture unavailable'));
+ apiFetchJSONMock.mockResolvedValue(responseFor('protected'));
+ mountBackupReadState();
+ await waitFor(() => expect(window.location.pathname).toBe('/proxmox/backups/coverage'));
+ await screen.findByText(/Protection posture is unavailable/);
+ await fireEvent.click(screen.getByRole('button', { name: 'Retry protection posture' }));
+ await screen.findByRole('button', { name: '1 protected' });
+ expect(window.location.pathname).toBe('/proxmox/backups/coverage');
+ await fireEvent.click(screen.getByRole('link', { name: /by date/i }));
+ const protectedCount = screen.getByRole('button', { name: '1 protected' });
+ await fireEvent.click(protectedCount);
+ await waitFor(() => expect(window.location.pathname).toBe('/proxmox/backups/coverage'));
+ expect(new URLSearchParams(window.location.search).get('posture')).toBe('protected');
+ });
+
+ it.each([
+ '/proxmox/backups/date',
+ '/proxmox/backups/coverage',
+ '/proxmox/backups?view=date',
+ '/proxmox/backups?view=coverage',
+ ])('does not rewrite an explicit view: %s', async (path) => {
+ window.history.replaceState({}, '', path);
+ apiFetchJSONMock.mockResolvedValue(responseFor('attention'));
+ mountBackupReadState();
+ await screen.findByRole('button', { name: '1 attention' });
+ expect(window.location.pathname + window.location.search).toBe(path);
+ });
+
+ it('chooses By date after a readable empty inventory without requesting an unscoped assessment', async () => {
+ apiFetchMock.mockImplementation((url: string) =>
+ Promise.resolve(jsonResponse(url.endsWith('/pve') ? emptyPVE : emptyPBS)),
+ );
+ renderInRouter(() => <ProxmoxBackupsTable emptyIcon={<span />} workloads={[]} />);
+ await waitFor(() => expect(window.location.pathname).toBe('/proxmox/backups/date'));
+ expect(apiFetchJSONMock).not.toHaveBeenCalled();
+ await screen.findByText('No backups yet');
+ });
+});