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 backup activity focus and readings current across polling
pulse-triage[bot]acd704a14c80
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 13d5c3bb2a..2642662287 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -10491,3 +10491,23 @@ Desktop/narrow browser proof must exercise the parsed inventory consumer,filter interactions, scoped open records and literal long labels and inspectactual pixels. This corrects evidence scope, not original incident causality ornative backup/guest recovery.+++### Backup activity preserves calendar-day interaction identity++`BackupActivityChart` retains each day control by its local calendar key across+inventory refreshes, scope changes and metric changes. The focused control must+not disappear or silently become another date when new buckets replace the+input. A removed focused day returns to the selected activity-range control,+without changing the saved day filter or moving focus from another control.++The open tooltip reads the current bucket for its day, not a retained count or+volume snapshot. Removed days withdraw the reading, including on return until a+new interaction. Unknown-volume markers and counts update together. Reconciled+chart values must not mutate the caller's inventory-derived DTOs.++Normal `BackupActivityChart.test.tsx` covers focus, rollover, disappearance,+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.diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 3bca8dbc98..e3fe61b938 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -8102,3 +8102,23 @@ Desktop/narrow browser proof must exercise the parsed inventory consumer,filter interactions, scoped open records and literal long labels and inspectactual pixels. This corrects evidence scope, not original incident causality ornative backup/guest recovery.+++### Backup activity preserves calendar-day interaction identity++`BackupActivityChart` retains each day control by its local calendar key across+inventory refreshes, scope changes and metric changes. The focused control must+not disappear or silently become another date when new buckets replace the+input. A removed focused day returns to the selected activity-range control,+without changing the saved day filter or moving focus from another control.++The open tooltip reads the current bucket for its day, not a retained count or+volume snapshot. Removed days withdraw the reading, including on return until a+new interaction. Unknown-volume markers and counts update together. Reconciled+chart values must not mutate the caller's inventory-derived DTOs.++Normal `BackupActivityChart.test.tsx` covers focus, rollover, disappearance,+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.diff --git a/frontend-modern/src/features/proxmox/BackupActivityChart.tsx b/frontend-modern/src/features/proxmox/BackupActivityChart.tsxindex 4bf562d052..a7cf8fa1ba 100644--- a/frontend-modern/src/features/proxmox/BackupActivityChart.tsx+++ b/frontend-modern/src/features/proxmox/BackupActivityChart.tsx@@ -1,4 +1,5 @@-import { createSignal, For, Show } from 'solid-js';+import { createComputed, createMemo, createSignal, For, Show, untrack } from 'solid-js';+import { createStore, reconcile } from 'solid-js/store';import type { Accessor, Component } from 'solid-js';import { TooltipPortal } from '@/components/shared/TooltipPortal';@@ -41,8 +42,7 @@ import {} from './proxmoxBackupActivityPresentation';interface TooltipState {- dateLabel: string;- point: BackupActivityPoint;+ key: string;x: number;y: number;}@@ -68,7 +68,52 @@ interface BackupActivityChartProps {export const BackupActivityChart: Component<BackupActivityChartProps> = (props) => {const [tooltip, setTooltip] = createSignal<TooltipState | null>(null);- const points = () => props.timeline().points;+ let dayControls: HTMLDivElement | undefined;+ let rangeControls: HTMLDivElement | undefined;+ const [chart, setChart] = createStore<{ points: BackupActivityPoint[] }>({ points: [] });+ // Inventory polling rebuilds every bucket. Reconcile by calendar day so a+ // keyboard user's control survives; indexing would silently change its date+ // when the window rolls over. Own the nested values, not the caller's DTOs.+ createComputed(() => {+ const next = props.timeline().points;+ const target = untrack(tooltip);+ if (target && !next.some((point) => point.key === target.key)) setTooltip(null);+ const active = document.activeElement;+ if (+ active instanceof HTMLElement &&+ dayControls?.contains(active) &&+ !next.some((point) => point.key === active.dataset.backupActivityDay)+ ) {+ // A retired day cannot keep focus. Return to the selected range without+ // changing the saved day filter or stealing focus from another control.+ untrack(() =>+ rangeControls+ ?.querySelector<HTMLButtonElement>('[aria-pressed="true"]')+ ?.focus({ preventScroll: true }),+ );+ }+ setChart(+ 'points',+ reconcile(+ next.map((point) => ({+ ...point,+ counts: { ...point.counts },+ unknownCounts: point.unknownCounts ? { ...point.unknownCounts } : undefined,+ })),+ { key: 'key' },+ ),+ );+ });+ const points = () => chart.points;+ // Retain interaction identity, never a snapshot of the displayed reading.+ // A disappearing day withdraws its tooltip rather than showing old evidence.+ const activeTooltip = createMemo(() => {+ const target = tooltip();+ const point = target && points().find((point) => point.key === target.key);+ return target && point+ ? { ...target, point, dateLabel: getRecoveryPrettyDateLabel(point.key) }+ : null;+ });const axisMax = () => props.timeline().axisMax;const hasSelection = () => props.selectedDateKey() !== null;const metricMode = (): BackupActivityMetricMode =>@@ -90,11 +135,10 @@ export const BackupActivityChart: Component<BackupActivityChartProps> = (props)const chartGapStyle = () => `${getRecoveryTimelineChartGapPx(props.range())}px`;- const showTooltip = (target: HTMLElement, point: BackupActivityPoint, dateLabel: string) => {+ const showTooltip = (target: HTMLElement, key: string) => {const rect = target.getBoundingClientRect();setTooltip({- dateLabel,- point,+ key,x: rect.left + rect.width / 2,y: rect.top,});@@ -151,6 +195,7 @@ export const BackupActivityChart: Component<BackupActivityChartProps> = (props)<divrole="group"aria-label="Activity range"+ ref={rangeControls}class="inline-flex shrink-0 rounded-sm border border-border bg-surface p-0.5"><For each={BACKUP_ACTIVITY_RANGE_DAYS}>@@ -209,6 +254,7 @@ export const BackupActivityChart: Component<BackupActivityChartProps> = (props)style={{ 'min-width': chartMinWidthStyle() }}><div+ ref={dayControls}class="absolute inset-x-0 bottom-4 top-0 flex items-stretch"style={{ gap: chartGapStyle() }}>@@ -237,12 +283,11 @@ export const BackupActivityChart: Component<BackupActivityChartProps> = (props)unknownCount(point),)}aria-pressed={isSelected() ? 'true' : 'false'}+ data-backup-activity-day={point.key}onClick={() => props.onToggleDay(point.key)}- onMouseEnter={(event) =>- showTooltip(event.currentTarget, point, dateLabel)- }+ onMouseEnter={(event) => showTooltip(event.currentTarget, point.key)}onMouseLeave={hideTooltip}- onFocus={(event) => showTooltip(event.currentTarget, point, dateLabel)}+ onFocus={(event) => showTooltip(event.currentTarget, point.key)}onBlur={hideTooltip}><div class="relative h-full w-full overflow-hidden rounded-xs">@@ -326,14 +371,14 @@ export const BackupActivityChart: Component<BackupActivityChartProps> = (props)</div><TooltipPortal- when={tooltip() !== null}- x={tooltip()?.x ?? 0}- y={tooltip()?.y ?? 0}+ when={activeTooltip() !== null}+ x={activeTooltip()?.x ?? 0}+ y={activeTooltip()?.y ?? 0}align="center"direction="up"maxWidth={240}>- <Show when={tooltip()}>+ <Show when={activeTooltip()}>{(t) => (<div class="min-w-[180px]"><div class="flex items-start justify-between gap-3 border-b border-border pb-1">diff --git a/frontend-modern/src/features/proxmox/__tests__/BackupActivityChart.test.tsx b/frontend-modern/src/features/proxmox/__tests__/BackupActivityChart.test.tsxnew file mode 100644index 0000000000..f4ae117e08--- /dev/null+++ b/frontend-modern/src/features/proxmox/__tests__/BackupActivityChart.test.tsx@@ -0,0 +1,150 @@+import { cleanup, fireEvent, render, screen, within } from '@solidjs/testing-library';+import { createSignal } from 'solid-js';+import { afterEach, describe, expect, it, vi } from 'vitest';++import { getRecoveryPrettyDateLabel } from '@/utils/recoveryDatePresentation';+import { BackupActivityChart } from '../BackupActivityChart';+import type {+ BackupActivityMetricMode,+ BackupActivityPoint,+ BackupActivityTimeline,+} from '../proxmoxBackupActivityPresentation';++vi.mock('@/components/shared/hoverCapability', () => ({ supportsHoverTooltips: () => true }));++const point = (key: string, total: number, unknown = 0): BackupActivityPoint => ({+ key,+ total,+ counts: { archive: total, pbs: 0, snapshot: 0, ok: 0, failed: 0, running: 0 },+ ...(unknown ? { unknownCounts: { pbs: unknown } } : {}),+});+const timeline = (points: BackupActivityPoint[]): BackupActivityTimeline => ({+ points,+ axisMax: Math.max(2, ...points.map((point) => point.total)),+ labelEvery: 1,+});+const day = (key: string): HTMLButtonElement =>+ document.querySelector(`[data-backup-activity-day="${key}"]`)!;+const tooltip = () => document.querySelector<HTMLElement>('[data-tooltip-portal]');++function mount() {+ const [data, setData] = createSignal(timeline([point('2026-10-27', 1), point('2026-10-28', 2)]));+ const [selected, setSelected] = createSignal<string | null>(null);+ const [mode, setMode] = createSignal<BackupActivityMetricMode>('count');+ const onToggleDay = vi.fn((key: string) => setSelected(selected() === key ? null : key));+ render(() => (+ <>+ <button type="button">Outside chart</button>+ <BackupActivityChart+ title="Restore points"+ noun="restore point"+ segmentKinds={['archive', 'pbs', 'snapshot']}+ range={() => 30}+ onRangeChange={() => {}}+ timeline={data}+ selectedDateKey={selected}+ onToggleDay={onToggleDay}+ metricToggle={{ mode, onChange: setMode }}+ />+ </>+ ));+ return { data, setData, selected, setMode, onToggleDay };+}++afterEach(cleanup);++describe('backup activity interaction continuity', () => {+ it('keeps the exact focused day across fresh inventory objects and updates its reading', () => {+ const { setData, selected } = mount();+ const target = day('2026-10-28');+ target.focus();+ expect(tooltip()).toHaveTextContent('2 restore points');++ setData(timeline([point('2026-10-27', 1), point('2026-10-28', 5)]));++ expect(day('2026-10-28')).toBe(target);+ expect(target).toHaveFocus();+ expect(target).toHaveAccessibleName(/5 restore points/);+ expect(tooltip()).toHaveTextContent('5 restore points');+ expect(tooltip()).not.toHaveTextContent('2 restore points');+ fireEvent.click(target);+ expect(selected()).toBe('2026-10-28');+ expect(target).toHaveFocus();+ expect(target).toHaveAttribute('aria-pressed', 'true');+ fireEvent.click(target);+ expect(selected()).toBeNull();+ expect(target).toHaveAttribute('aria-pressed', 'false');+ });++ it('updates a hovered day to mixed, unknown-only and known volume without retaining old counts', () => {+ const { setData, setMode } = mount();+ const target = day('2026-10-28');+ fireEvent.mouseEnter(target);+ expect(tooltip()).toHaveTextContent('2 restore points');+ setMode('volume');+ setData(timeline([point('2026-10-27', 1), point('2026-10-28', 2048, 1)]));+ expect(day('2026-10-28')).toBe(target);+ expect(tooltip()).toHaveTextContent('2.00 KB known · 1 size unknown');+ expect(target).toHaveAccessibleName(/2.00 KB known · 1 size unknown/);+ expect(target.querySelector('[data-unknown-volume]')).not.toBeNull();++ setData(timeline([point('2026-10-27', 1), point('2026-10-28', 0, 2)]));+ expect(tooltip()).toHaveTextContent('2 sizes unknown');+ expect(tooltip()).not.toHaveTextContent('2.00 KB');+ setData(timeline([point('2026-10-27', 1), point('2026-10-28', 4096)]));+ expect(tooltip()).toHaveTextContent('4.00 KB');+ expect(tooltip()).not.toHaveTextContent('unknown');+ expect(target.querySelector('[data-unknown-volume]')).toBeNull();+ fireEvent.mouseLeave(target);+ expect(tooltip()).toBeNull();+ });++ it('keeps a surviving calendar day, not its array index, when the window rolls over', () => {+ const { setData } = mount();+ const target = day('2026-10-28');+ target.focus();+ setData(timeline([point('2026-10-28', 3), point('2026-10-29', 1)]));+ expect(day('2026-10-28')).toBe(target);+ expect(target).toHaveFocus();+ expect(target).toHaveAccessibleName(+ `${getRecoveryPrettyDateLabel('2026-10-28')}: 3 restore points`,+ );+ expect(day('2026-10-29')).not.toBe(target);+ });++ it.each([false, true])(+ 'returns a retired focused day to the selected range (empty=%s)',+ (empty) => {+ const { setData, selected, onToggleDay } = mount();+ const target = day('2026-10-27');+ target.focus();+ fireEvent.click(target);+ setData(timeline(empty ? [] : [point('2026-10-28', 2), point('2026-10-29', 1)]));+ expect(target).not.toBeInTheDocument();+ expect(+ within(screen.getByRole('group', { name: 'Activity range' })).getByRole('button', {+ name: '30d',+ }),+ ).toHaveFocus();+ expect(tooltip()).toBeNull();+ expect(selected()).toBe('2026-10-27');+ expect(onToggleDay).toHaveBeenCalledTimes(1);+ },+ );++ it('withdraws a retired hover reading without stealing focus or mutating the caller data', () => {+ const { setData } = mount();+ const outside = screen.getByRole('button', { name: 'Outside chart' });+ outside.focus();+ fireEvent.mouseEnter(day('2026-10-27'));+ expect(tooltip()).toHaveTextContent('1 restore point');+ const incoming = timeline([point('2026-10-28', 9), point('2026-10-29', 1)]);+ const saved = JSON.stringify(incoming);+ setData(incoming);+ expect(tooltip()).toBeNull();+ expect(outside).toHaveFocus();+ setData(timeline([point('2026-10-28', 4), point('2026-10-29', 1)]));+ expect(JSON.stringify(incoming)).toBe(saved);+ expect(outside).toHaveFocus();+ });+});diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsxindex 38ed5fecab..2e70217987 100644--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx@@ -2498,3 +2498,59 @@ describe('backup activity follows the consuming inventory scope', () => {expect(apiFetchMock).toHaveBeenCalledTimes(calls);});});++describe('backup activity day controls survive ordinary inventory polling', () => {+ afterEach(() => vi.useRealTimers());++ it('retains the same focused date, updates its count and toggles the current parsed entries', async () => {+ vi.useFakeTimers({+ now: BACKUP_IDENTITY_NOW,+ toFake: ['Date', 'setInterval', 'clearInterval'],+ });+ let archives = [identityArchive()];+ apiFetchMock.mockImplementation((url: string) =>+ Promise.resolve(+ jsonResponse({+ data: url.endsWith('/pbs')+ ? { backups: [] }+ : {+ backupTasks: [],+ guestSnapshots: [],+ storageBackups: archives,+ },+ }),+ ),+ );+ apiFetchJSONMock.mockResolvedValue({ data: [], policy: protectionPolicy });+ window.history.replaceState({}, '', '/proxmox/backups/date');+ renderInRouter(() => (+ <ProxmoxBackupsTable+ emptyIcon={<span />}+ workloads={[identityGuest('east-100', 'east', 'pve-1')]}+ />+ ));+ const target = await screen.findByRole('button', {+ name: `${getRecoveryPrettyDateLabel('2026-10-04')}: 1 restore point`,+ });+ target.focus();+ archives = [identityArchive(), identityArchive({ id: 'second', time: '2026-10-04T10:00:00Z' })];+ await vi.advanceTimersByTimeAsync(30_000);+ expect(+ screen.getByRole('button', {+ name: `${getRecoveryPrettyDateLabel('2026-10-04')}: 2 restore points`,+ }),+ ).toBe(target);+ expect(target).toHaveFocus();+ expect(apiFetchMock).toHaveBeenCalledTimes(4);+ expect(apiFetchJSONMock).toHaveBeenCalledTimes(2);+ fireEvent.click(target);+ await waitFor(() => expect(target).toHaveAttribute('aria-pressed', 'true'));+ expect(document.querySelectorAll('[data-proxmox-backup-row="recoverable"]')).toHaveLength(2);+ expect(new URLSearchParams(window.location.search).get('day')).toBe('2026-10-04');+ fireEvent.click(target);+ await waitFor(() => expect(target).toHaveAttribute('aria-pressed', 'false'));+ expect(target).toHaveFocus();+ expect(new URLSearchParams(window.location.search).has('day')).toBe(false);+ expect(apiFetchMock).toHaveBeenCalledTimes(4);+ });+});