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.

Scope backup activity to the displayed inventory filters

pulse-triage[bot]e8d65faa4171
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 2b40dd5a88..35a7612d06 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -20,6 +20,22 @@
## Purpose
+### Backup filters also scope activity
+
+The existing Proxmox By date chart and date warning consume the same
+feature-owned filtered inventory as the table, before the selected-day facet.
+Changing source/verification, search, node, type or exact location updates
+both counts and volume without a new read. Selecting a day narrows only the
+list and leaves other scoped days selectable; clearing restores the scope.
+An empty or unresolved scope does not advertise estate-wide activity.
+The page explains this relationship beside the existing chart. Aggregate
+backup-health counts remain server-owned and estate-wide.
+
+The registered `ProxmoxBackupsTable.test.tsx` scope cases and source-bound
+desktop/narrow browser journeys cover the shared filter rail, keyboard/touch
+day selection, metric switching, empty matches and recovery. No shared-filter,
+route, navigation, access or backup operation changes.
+
### Backup activity uses calendar-day chart slots
The Proxmox backup activity producer supplies one slot per consecutive local
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 58aa71bfca..a01da392fa 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -21,6 +21,24 @@
## Purpose
+### Backup activity shares the list's inventory scope
+
+By date activity counts and volume use the same search, node, workload type,
+exact backup location and source/verification filters as the restore-point
+list. Unresolved locations and empty matches cannot draw another scope's
+activity. Day selection is applied afterwards only to the list, so the chart
+continues to offer all dates in that inventory scope. Unknown-date notices
+also describe only the matching inventory. Completed-only admission, local
+calendar buckets, aggregate server-owned posture, query cadence and all
+backup/recovery operations are unchanged.
+
+`ProxmoxBackupsTable.test.tsx` exercises every facet, combined filters,
+case-sensitive/ambiguous locations, empty matches, count/volume, and switching
+and clearing days/filters without extra reads. Source-bound desktop/narrow
+browser proof exercises the actual inventory parser/model/chart/list and
+shared filter controls. This corrects inspection, not #3248's original stale
+timestamps or native guest recovery.
+
### Backup activity ranges follow local calendar dates
The existing 7/30/90/365-day Proxmox backup activity windows contain exactly
diff --git a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
index 4a84b51f67..9f625a1c3d 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
@@ -510,10 +510,31 @@ export const ProxmoxBackupsTable: Component<{
'snapshot',
];
+ // The chart and list share every inventory facet. Day selection narrows
+ // only the list so other days remain available to select in the chart.
+ const scopedRecoverableArtifacts = createMemo(() => {
+ const term = search().trim().toLowerCase();
+ const filter = recoverableFilter();
+ return recoveryModel().recoverableArtifacts.filter((artifact) => {
+ if (!nodeMatches(artifact.workload.node)) return false;
+ if (!typeMatches(artifact.workload.type)) return false;
+ if (!locationMatches(artifact)) return false;
+ if (
+ (filter === 'pbs' || filter === 'archive' || filter === 'snapshot') &&
+ artifact.sourceKind !== filter
+ ) {
+ return false;
+ }
+ if (filter === 'verified' && artifact.verified !== true) return false;
+ if (filter === 'unverified' && artifact.verified !== false) return false;
+ return recoverableArtifactMatchesSearch(artifact, term);
+ });
+ });
+
const recoverableTimeline = createMemo(() =>
buildBackupActivityTimeline<RecoverableArtifact>(
chartRange(),
- recoveryModel().recoverableArtifacts,
+ scopedRecoverableArtifacts(),
(artifact) => artifact.createdMs,
(artifact) =>
!isCompletedRecoveryArtifact(artifact)
@@ -537,30 +558,13 @@ export const ProxmoxBackupsTable: Component<{
);
const filteredRecoverableArtifacts = createMemo(() => {
- const term = search().trim().toLowerCase();
- const filter = recoverableFilter();
const dateKey = selectedDateKey();
- const list = recoveryModel().recoverableArtifacts.filter((artifact) => {
- if (!nodeMatches(artifact.workload.node)) return false;
- if (!typeMatches(artifact.workload.type)) return false;
- if (!locationMatches(artifact)) return false;
- if (
- (filter === 'pbs' || filter === 'archive' || filter === 'snapshot') &&
- artifact.sourceKind !== filter
- ) {
- return false;
- }
- if (filter === 'verified' && artifact.verified !== true) return false;
- if (filter === 'unverified' && artifact.verified !== false) return false;
- if (
- dateKey &&
- (artifact.createdMs === undefined ||
- recoveryDateKeyFromTimestamp(artifact.createdMs) !== dateKey)
- ) {
- return false;
- }
- return recoverableArtifactMatchesSearch(artifact, term);
- });
+ const list = scopedRecoverableArtifacts().filter(
+ (artifact) =>
+ !dateKey ||
+ (artifact.createdMs !== undefined &&
+ recoveryDateKeyFromTimestamp(artifact.createdMs) === dateKey),
+ );
const sortKey = recoverableSortKey();
const direction = recoverableSortDirection();
list.sort((a, b) => {
@@ -852,7 +856,7 @@ export const ProxmoxBackupsTable: Component<{
<Show when={view() === 'date' && recoveryModel().recoverableArtifacts.length > 0}>
<Show
- when={recoveryModel().recoverableArtifacts.some(
+ when={scopedRecoverableArtifacts().some(
(artifact) => artifact.createdMs === undefined,
)}
>
@@ -889,21 +893,29 @@ export const ProxmoxBackupsTable: Component<{
</div>
}
>
- <BackupActivityChart
- title={
- recoverableMetricMode() === 'volume'
- ? 'Completed restore volume per day'
- : 'Completed restore points per day'
- }
- noun="restore point"
- segmentKinds={RECOVERABLE_SEGMENT_KINDS}
- range={chartRange}
- onRangeChange={setChartRange}
- timeline={recoverableTimeline}
- selectedDateKey={selectedDateKey}
- onToggleDay={toggleDay}
- metricToggle={{ mode: recoverableMetricMode, onChange: setRecoverableMetricMode }}
- />
+ <div class="space-y-1">
+ <p class="text-xs text-muted">
+ Activity follows the backup filters. Selecting a day narrows only the list.
+ </p>
+ <BackupActivityChart
+ title={
+ recoverableMetricMode() === 'volume'
+ ? 'Completed restore volume per day'
+ : 'Completed restore points per day'
+ }
+ noun="restore point"
+ segmentKinds={RECOVERABLE_SEGMENT_KINDS}
+ range={chartRange}
+ onRangeChange={setChartRange}
+ timeline={recoverableTimeline}
+ selectedDateKey={selectedDateKey}
+ onToggleDay={toggleDay}
+ metricToggle={{
+ mode: recoverableMetricMode,
+ onChange: setRecoverableMetricMode,
+ }}
+ />
+ </div>
</Show>
</Show>
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
index 8ce75247f1..7efe63e0f9 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
@@ -24,7 +24,10 @@ import { TABLE_CARD_FRAME_CLASS } from '@/components/shared/TableCard';
import type { Resource } from '@/types/resource';
import type { ProtectionPosturesResponse } from '@/types/recovery';
import { protectionPolicy } from '@/utils/__fixtures__/protectionPosture';
-import { getRecoveryFullDateLabel } from '@/utils/recoveryDatePresentation';
+import {
+ getRecoveryFullDateLabel,
+ getRecoveryPrettyDateLabel,
+} from '@/utils/recoveryDatePresentation';
import { eventBus } from '@/stores/events';
import { resetCreateNonSuspendingQueryCacheForTest } from '@/hooks/createNonSuspendingQuery';
@@ -2073,3 +2076,137 @@ describe('backup location identity in the consuming views', () => {
}
});
});
+
+describe('backup activity follows the consuming inventory scope', () => {
+ afterEach(() => vi.restoreAllMocks());
+
+ const mountScopedInventory = (query = '') => {
+ vi.spyOn(Date, 'now').mockReturnValue(BACKUP_IDENTITY_NOW);
+ apiFetchMock.mockImplementation((url: string) =>
+ Promise.resolve(
+ jsonResponse({
+ data: url.endsWith('/pbs')
+ ? {
+ backups: [
+ identityPBS(),
+ identityPBS({
+ id: 'upper',
+ datastore: 'Main',
+ verified: false,
+ backupTime: '2026-10-03T10:00:00Z',
+ size: 16384,
+ }),
+ identityPBS({ id: 'running', inProgress: true, size: 1048576 }),
+ ],
+ }
+ : {
+ storageBackups: [
+ identityArchive(),
+ identityArchive({ id: 'old', time: '2026-10-03T11:00:00Z', size: 4096 }),
+ identityArchive({
+ id: 'west',
+ instance: 'west',
+ node: 'pve-2',
+ vmid: 200,
+ type: 'ct',
+ time: '2026-10-03T11:00:00Z',
+ size: 8192,
+ }),
+ ],
+ guestSnapshots: [identitySnapshot()],
+ backupTasks: [],
+ },
+ }),
+ ),
+ );
+ apiFetchJSONMock.mockResolvedValue({ data: [], policy: protectionPolicy });
+ window.history.replaceState({}, '', `/proxmox/backups/date${query ? `?${query}` : ''}`);
+ return renderInRouter(() => (
+ <ProxmoxBackupsTable
+ emptyIcon={<span />}
+ workloads={[
+ identityGuest('east-100', 'east', 'pve-1'),
+ {
+ ...identityGuest('west-200', 'west', 'pve-2', { vmid: 200 }),
+ type: 'system-container',
+ },
+ ]}
+ />
+ ));
+ };
+ const day = (date: string, value: string, selected = false) =>
+ screen.getByRole('button', {
+ name: `${getRecoveryPrettyDateLabel(date)}: ${value}${selected ? ', selected' : ''}`,
+ });
+ const rows = () => document.querySelectorAll('[data-proxmox-backup-row="recoverable"]');
+
+ it.each([
+ ['source', 'source=archive', 3, '1 restore point', '2 restore points', '1.00 KB', '12.0 KB'],
+ ['verified', 'source=verified', 1, '1 restore point', '0 restore points', '2.00 KB', '0 B'],
+ ['unverified', 'source=unverified', 1, '0 restore points', '1 restore point', '0 B', '16.0 KB'],
+ ['node', 'node=pve-2', 1, '0 restore points', '1 restore point', '0 B', '8.00 KB'],
+ ['type', 'type=ct', 1, '0 restore points', '1 restore point', '0 B', '8.00 KB'],
+ ['search', 'q=west-200', 1, '0 restore points', '1 restore point', '0 B', '8.00 KB'],
+ [
+ 'combined',
+ 'node=pve-1&type=vm&source=archive',
+ 2,
+ '1 restore point',
+ '1 restore point',
+ '1.00 KB',
+ '4.00 KB',
+ ],
+ [
+ 'case-sensitive location',
+ `location=${encodeURIComponent('["pbs","pbs-server","Main"]')}`,
+ 1,
+ '0 restore points',
+ '1 restore point',
+ '0 B',
+ '16.0 KB',
+ ],
+ ])(
+ 'keeps %s-filtered count and volume in agreement with the list',
+ async (_label, query, count, today, yesterday, todayBytes, yesterdayBytes) => {
+ mountScopedInventory(String(query));
+ await waitFor(() => expect(rows()).toHaveLength(Number(count)));
+ expect(day('2026-10-04', String(today))).toBeInTheDocument();
+ expect(day('2026-10-03', String(yesterday))).toBeInTheDocument();
+ await fireEvent.click(screen.getByRole('button', { name: 'Volume' }));
+ expect(day('2026-10-04', String(todayBytes))).toBeInTheDocument();
+ expect(day('2026-10-03', String(yesterdayBytes))).toBeInTheDocument();
+ },
+ );
+
+ it.each(['q=no-such-workload', 'location=missing', 'location=pbs%3Apbs-server%3Amain'])(
+ 'does not show another scope activity for empty or unresolved %s',
+ async (query) => {
+ mountScopedInventory(query);
+ await screen.findByText(/7 backup entries/);
+ expect(rows()).toHaveLength(0);
+ expect(screen.queryByRole('group', { name: 'Activity metric' })).not.toBeInTheDocument();
+ expect(screen.getByText(/No completed restore points with known dates/)).toBeInTheDocument();
+ },
+ );
+
+ it('keeps other scoped days available while selecting, clearing and changing filters', async () => {
+ mountScopedInventory('source=archive');
+ await waitFor(() => expect(rows()).toHaveLength(3));
+ const calls = apiFetchMock.mock.calls.length;
+ await fireEvent.click(day('2026-10-04', '1 restore point'));
+ await waitFor(() => expect(rows()).toHaveLength(1));
+ expect(day('2026-10-04', '1 restore point', true)).toBeInTheDocument();
+ expect(day('2026-10-03', '2 restore points')).toBeInTheDocument();
+ await fireEvent.click(day('2026-10-03', '2 restore points'));
+ await waitFor(() => expect(rows()).toHaveLength(2));
+ await fireEvent.click(screen.getByRole('button', { name: 'Clear date filter' }));
+ await waitFor(() => expect(rows()).toHaveLength(3));
+ await fireEvent.click(
+ within(screen.getByRole('group', { name: 'Source' })).getByRole('button', { name: 'All' }),
+ );
+ await waitFor(() => expect(rows()).toHaveLength(7));
+ expect(day('2026-10-04', '3 restore points')).toBeInTheDocument();
+ expect(day('2026-10-03', '3 restore points')).toBeInTheDocument();
+ expect(apiFetchMock).toHaveBeenCalledTimes(calls);
+ });
+});