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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Keep mounted backup evidence and badge tones current
pulse-triage[bot]da2e2a839e45
diff --git a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsxindex 2c8081f04f..2b7da7d083 100644--- a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx+++ b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx@@ -87,6 +87,8 @@ const BACKUP_VIEW_TABS: readonly { id: BackupView; label: string }[] = [{ id: 'coverage', label: 'Coverage' },];+const BACKUP_INVENTORY_POLL_MS = 30_000;+const EMPTY_PVE_BACKUPS: PVEBackupsPayload = {backupTasks: [],storageBackups: [],@@ -122,16 +124,19 @@ export const ProxmoxBackupsTable: Component<{servers?: readonly Resource[];}> = (props) => {// Independent read owners contain source failures and replace pending reads- // on org changes/disposal. No new polling or cross-route inventory cache.+ // on org changes/disposal. Refresh while mounted at the same bounded cadence+ // as protection posture; no cross-route inventory cache or per-row reads.const backups = createNonSuspendingQuery({source: () => 'pve',fetcher: (_source, signal) => fetchPVEBackups(signal),initialValue: EMPTY_PVE_BACKUPS,+ pollMs: BACKUP_INVENTORY_POLL_MS,});const pbsBackups = createNonSuspendingQuery({source: () => 'pbs',fetcher: (_source, signal) => fetchPBSBackups(signal),initialValue: EMPTY_PBS_BACKUPS,+ pollMs: BACKUP_INVENTORY_POLL_MS,});const inventorySources = [{ label: 'PVE', query: backups },diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsxindex 00c00233bc..4f0f715a1d 100644--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx@@ -1673,8 +1673,8 @@ describe('Coverage withdraws failed protection assessments', () => {expect(screen.queryByText(/Protection posture is unavailable/)).not.toBeInTheDocument();expect(screen.getByRole('button', { name: '1 attention' })).toBeInTheDocument();expect(document.querySelector('[data-coverage-strip-footnote]')).not.toBeNull();- expect(apiFetchMock.mock.calls.filter(([url]) => url === '/api/backups/pve')).toHaveLength(1);- expect(apiFetchMock.mock.calls.filter(([url]) => url === '/api/backups/pbs')).toHaveLength(1);+ expect(apiFetchMock.mock.calls.filter(([url]) => url === '/api/backups/pve')).toHaveLength(2);+ expect(apiFetchMock.mock.calls.filter(([url]) => url === '/api/backups/pbs')).toHaveLength(2);} finally {vi.useRealTimers();}@@ -1768,3 +1768,101 @@ describe('completed restore-point summary and activity', () => {expect(container.querySelectorAll('[data-proxmox-backup-row="recoverable"]')).toHaveLength(5);});});++describe('mounted Proxmox backup inventory refresh', () => {+ beforeEach(() => {+ vi.useFakeTimers({ toFake: ['setInterval', 'clearInterval'] });+ mockBackupAPIs();+ window.history.replaceState({}, '', '/proxmox/backups/coverage');+ });+ afterEach(() => vi.useRealTimers());++ it('refreshes both inventories and the same open evidence badge without losing focus', async () => {+ const pbs = structuredClone(pbsPayload);+ pbs.data.backups[0].protected = false;+ let nextPBS: unknown = pbs;+ let nextPVE: unknown = emptyPVE;+ apiFetchMock.mockImplementation((url: string) =>+ Promise.resolve(jsonResponse(url.endsWith('/pbs') ? nextPBS : nextPVE)),+ );+ const { unmount } = mountBackupReadState();+ const row = () => document.querySelector('[data-proxmox-backup-row="coverage"]') as HTMLElement;+ await waitFor(() => expect(row()).toHaveTextContent('Protected'));+ const disclosure = within(row()).getByRole('button', { name: /expand details/i });+ fireEvent.click(disclosure);+ disclosure.focus();+ const detail = await screen.findByTestId('proxmox-coverage-detail');+ const badge = within(detail).getByText('Verified', { exact: true });+ expect(badge).toHaveClass('bg-emerald-100');++ // The provider can revise verification of the same native point. New+ // successful PVE evidence arrives independently on that same bounded tick.+ nextPBS = { ...pbs, data: { backups: [{ ...pbs.data.backups[0], verified: false }] } };+ nextPVE = readPvePayload;+ await vi.advanceTimersByTimeAsync(30_000);+ await waitFor(() => expect(within(detail).getByText('Unverified')).toBe(badge));+ expect(badge).toHaveClass('bg-amber-100');+ expect(detail).toHaveTextContent('PVE file');+ expect(screen.getByTestId('proxmox-coverage-detail')).toBe(detail);+ expect(document.activeElement).toBe(disclosure);+ expect(document.body).toHaveTextContent('2 completed restore points');+ expect(sourceCalls('pbs')).toHaveLength(2);+ expect(sourceCalls('pve')).toHaveLength(2);++ nextPBS = {+ ...pbs,+ data: {+ backups: [+ {+ ...pbs.data.backups[0],+ inProgress: true,+ writeActivityObserved: true,+ writeActive: false,+ },+ ],+ },+ };+ await vi.advanceTimersByTimeAsync(30_000);+ await waitFor(() => expect(within(detail).getByText('Failed')).toBe(badge));+ expect(badge).toHaveClass('bg-red-100');+ expect(document.body).toHaveTextContent('1 completed restore point');+ expect(document.body).toHaveTextContent('1 failed');+ expect(document.activeElement).toBe(disclosure);++ nextPBS = pbs;+ await vi.advanceTimersByTimeAsync(30_000);+ await waitFor(() => expect(within(detail).getByText('Verified')).toBe(badge));+ expect(badge).toHaveClass('bg-emerald-100');+ expect(document.body).toHaveTextContent('2 completed restore points');+ expect(document.activeElement).toBe(disclosure);+ const calls = apiFetchMock.mock.calls.length;+ unmount();+ await vi.advanceTimersByTimeAsync(60_000);+ expect(apiFetchMock).toHaveBeenCalledTimes(calls);+ });++ it('does not overlap a slow poll, keeps the other source refreshing and aborts on disposal', async () => {+ let nextPBS = Promise.resolve(jsonResponse(pbsPayload));+ apiFetchMock.mockImplementation((url: string) =>+ url.endsWith('/pbs') ? nextPBS : Promise.resolve(jsonResponse(readPvePayload)),+ );+ const { unmount } = mountBackupReadState();+ await waitFor(() => expect(sourceCalls('pbs')).toHaveLength(1));+ const pending = deferred<Response>();+ nextPBS = pending.promise;+ await vi.advanceTimersByTimeAsync(30_000);+ const signal = sourceCalls('pbs')[1][1].signal as AbortSignal;+ expect(signal.aborted).toBe(false);+ await vi.advanceTimersByTimeAsync(60_000);+ expect(sourceCalls('pbs')).toHaveLength(2);+ expect(sourceCalls('pve')).toHaveLength(4);+ expect(signal.aborted).toBe(false);+ expect(document.body).not.toHaveTextContent('PBS backup inventory is unavailable');+ const calls = apiFetchMock.mock.calls.length;+ unmount();+ expect(signal.aborted).toBe(true);+ pending.resolve(jsonResponse(emptyPBS));+ await vi.advanceTimersByTimeAsync(30_000);+ expect(apiFetchMock).toHaveBeenCalledTimes(calls);+ });+});diff --git a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupsTableShared.test.tsx b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupsTableShared.test.tsxindex ab23ae24f3..c116ae17e1 100644--- a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupsTableShared.test.tsx+++ b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupsTableShared.test.tsx@@ -1,5 +1,7 @@import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { cleanup, render, screen, within } from '@solidjs/testing-library';+import { createSignal } from 'solid-js';+import { getMetadataBadgeClass } from '@/components/shared/MetadataBadge';import { WorkloadTypeBadge } from '@/components/shared/WorkloadTypeBadge';import proxmoxBackupServersTableSource from '../ProxmoxBackupServersTable.tsx?raw';import proxmoxCoverageTableSource from '../ProxmoxCoverageTable.tsx?raw';@@ -8,6 +10,7 @@ import proxmoxBackupsTableSharedSource from '../proxmoxBackupsTableShared.tsx?raimport {ArtifactSourceBadge,ArtifactStateBadge,+ artifactStateLabel,ProxmoxBackupAgeText,ProxmoxBackupWorkloadTypeBadge,SortableHead,@@ -66,6 +69,63 @@ describe('proxmoxBackupsTableShared', () => {expect(screen.getByText('Verified').className).toContain('bg-emerald-100');});+ it.each([+ [+ 'running outranks pruning and verification',+ { running: true, protected: true, verified: true },+ 'Running',+ 'info',+ ],+ [+ 'failure outranks pruning and verification',+ { failed: true, protected: true, verified: true },+ 'Failed',+ 'danger',+ ],+ [+ 'snapshot stays informational',+ { sourceKind: 'snapshot', protected: true, verified: true },+ 'Snapshot',+ 'indigo',+ ],+ [+ 'pruning protection is not verification',+ { protected: true, verified: true },+ 'Protected',+ 'warning',+ ],+ ['verification passed', { verified: true }, 'Verified', 'success'],+ ['verification absent or failed', { verified: false }, 'Unverified', 'warning'],+ ['unknown verification stays neutral', {}, 'Backup file', 'muted'],+ ] as const)('keeps state wording and tone consistent: %s', (_name, fields, label, tone) => {+ render(() => <ArtifactStateBadge artifact={artifact(fields)} label={label} />);+ expect(screen.getByText(label).className).toBe(+ getMetadataBadgeClass({+ tone,+ size: 'xs',+ shape: 'rounded',+ }),+ );+ });++ it('updates the mounted state badge through same-ID verification and activity changes', () => {+ const [point, setPoint] = createSignal(artifact({ verified: true }));+ render(() => <ArtifactStateBadge artifact={point()} label={artifactStateLabel(point())} />);+ const badge = screen.getByText('Verified');+ for (const [fields, label, tone] of [+ [{ verified: false }, 'Unverified', 'warning'],+ [{ running: true, verified: true }, 'Running', 'info'],+ [{ failed: true, protected: true }, 'Failed', 'danger'],+ [{ protected: true, verified: true }, 'Protected', 'warning'],+ [{}, 'Backup file', 'muted'],+ [{ verified: true }, 'Verified', 'success'],+ ] as const) {+ setPoint(artifact(fields));+ expect(screen.getByText(label)).toBe(badge);+ expect(badge.className).toBe(getMetadataBadgeClass({ tone, size: 'xs', shape: 'rounded' }));+ }+ });+it('keeps backup source and state chips on the shared MetadataBadge primitive', () => {expect(proxmoxBackupsTableSharedSource).toContain('MetadataBadge');expect(proxmoxBackupsTableSharedSource).toContain('PROXMOX_BACKUP_METADATA_BADGE_PROPS');diff --git a/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx b/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsxindex 0d3c5b49d6..bb90210ef6 100644--- a/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx+++ b/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx@@ -1,7 +1,7 @@import { Show, type Accessor } from 'solid-js';import { filterChipStatusDot } from '@/components/shared/FilterBar';import { type FilterOption } from '@/components/shared/FilterButtonGroup';-import { MetadataBadge } from '@/components/shared/MetadataBadge';+import { MetadataBadge, type MetadataBadgeTone } from '@/components/shared/MetadataBadge';import { ProgressBar } from '@/components/shared/ProgressBar';import { TableHead } from '@/components/shared/Table';import { getTableSortIndicator } from '@/components/shared/tableSortPresentation';@@ -276,51 +276,25 @@ export function artifactStateLabel(artifact: RecoverableArtifact): string {return getProxmoxBackupSourcePresentation(artifact.sourceKind).stateFallbackLabel;}+const artifactStateTone = (artifact: RecoverableArtifact): MetadataBadgeTone => {+ if (artifact.running) return 'info';+ if (artifact.failed) return 'danger';+ if (artifact.sourceKind === 'snapshot') return 'indigo';+ if (artifact.protected) return 'warning';+ if (artifact.verified === true) return 'success';+ if (artifact.verified === false) return 'warning';+ return 'muted';+};+export function ArtifactStateBadge(props: { artifact: RecoverableArtifact; label: string }) {- if (props.artifact.running) {- return (- <MetadataBadge {...PROXMOX_BACKUP_METADATA_BADGE_PROPS} tone="info">- {props.label}- </MetadataBadge>- );- }- if (props.artifact.failed) {- return (- <MetadataBadge {...PROXMOX_BACKUP_METADATA_BADGE_PROPS} tone="danger">- {props.label}- </MetadataBadge>- );- }- if (props.artifact.sourceKind === 'snapshot') {- return (- <MetadataBadge {...PROXMOX_BACKUP_METADATA_BADGE_PROPS} tone="indigo">- {props.label}- </MetadataBadge>- );- }- if (props.artifact.protected) {- return (- <MetadataBadge {...PROXMOX_BACKUP_METADATA_BADGE_PROPS} tone="warning">- {props.label}- </MetadataBadge>- );- }- if (props.artifact.verified === true) {- return (- <MetadataBadge {...PROXMOX_BACKUP_METADATA_BADGE_PROPS} tone="success">- {props.label}- </MetadataBadge>- );- }- if (props.artifact.verified === false) {- return (- <MetadataBadge {...PROXMOX_BACKUP_METADATA_BADGE_PROPS} tone="warning">- {props.label}- </MetadataBadge>- );- }+ // Coverage reconciles same-ID points in place. Derive tone inside the+ // reactive JSX so new verification/activity evidence cannot retain a+ // mounted badge's old health cue while its wording changes.return (- <MetadataBadge {...PROXMOX_BACKUP_METADATA_BADGE_PROPS} tone="muted">+ <MetadataBadge+ {...PROXMOX_BACKUP_METADATA_BADGE_PROPS}+ tone={artifactStateTone(props.artifact)}+ >{props.label}</MetadataBadge>);