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.

fix(web): preserve PBS host history targets in Backups

pulse-triage[bot]605643b01722
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 96ac5dcd59..2af020dfa3 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -573,6 +573,15 @@ that manual-channel consequence must stay visible at desktop and narrow widths.
## Shared Boundaries
+### PBS host history correlation
+
+The Backups surface passes its complete deduplicated route inventory to the PBS table. Only PBS servers render as rows; other resources supply correlation inputs. Preserve PBS drawer identity and use the correlated canonical history target. Missing disk utilisation does not gate CPU/memory history.
+
+Verification: ProxmoxBackupServersTable.drawer.test.tsx covers standalone and
+merged guest targets, missing disks and ambiguous identities;
+ProxmoxPageSurface.contract.test.tsx covers hydration and deduplication.
+
+
The settings panel registry supplies organisation overview, access and sharing with security-status currentUsername. An explicitly empty principal must not fall back to configured administrator identity; only older responses lacking the field use proxy/SSO/configured-username compatibility fallback. This identity plumbing must not change settings shell framing or bypass panel capability gates.
Settings navigation discoverability is part of the shared settings-shell
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 131af0d645..0bc007278e 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -305,6 +305,15 @@ command-capable profile.
## Shared Boundaries
+### PBS host history correlation
+
+Backups hydrates type=pbs,agent with source=pbs and reuses Overview guest inventory. Deduplicate combined snapshots by canonical ID before correlation, avoiding false ambiguity for agents in both queries. Standalone non-PVE PBS telemetry remains available without downloading the guest estate twice.
+
+Verification: ProxmoxBackupServersTable.drawer.test.tsx covers standalone and
+merged guest targets, missing disks and ambiguous identities;
+ProxmoxPageSurface.contract.test.tsx covers hydration and deduplication.
+
+
### Notification recovery reload ownership
Queue recovery API handlers follow router monitor replacement instead of
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 4985b05ba8..b76449c535 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -428,6 +428,15 @@ about the same disk cannot diverge.
## Shared Boundaries
+### PBS host history correlation
+
+PBS presentation correlation accepts standalone agents and VM/system-container resources with an agent facet. Preserve unique identity matching and canonical metricsTarget type and ID. Guests without telemetry and mixed ambiguous agent/guest matches must not replace the PBS target.
+
+Verification: ProxmoxBackupServersTable.drawer.test.tsx covers standalone and
+merged guest targets, missing disks and ambiguous identities;
+ProxmoxPageSurface.contract.test.tsx covers hydration and deduplication.
+
+
Platform estate orientation consumes the same canonical resource projection as
the platform's tables. Pages must not issue a second summary fetch or create a
parallel metric-card projection. Unified resources owns identity, type,
@@ -968,13 +977,13 @@ container inventory table.
contract below while owning the domain-specific artifact request.
Each row carries the canonical PBS `Resource` into the shared platform
resource-detail row. When coalescence has attached an agent facet, or when
- the product-family projection contains exactly one separate Agent resource
+ the route projection contains exactly one agent-bearing host or guest resource
with a matching normalized host identity, that same drawer must expose
host system, hardware, network, disks, thermals, history, and management
context without recreating a PBS-local host model or returning the
provider-owned resource to the standalone Machines list. Presentation-only
correlation retains the canonical PBS row id and service facet, uses the
- Agent metrics target and telemetry facets, and fails closed when no Agent
+ canonical host/guest metrics target and telemetry facets, and fails closed when no host
matches or more than one candidate matches. It must not alter registry
identity or treat input order as correlation evidence.
13. `frontend-modern/src/features/proxmox/ProxmoxCoverageTable.tsx` shared with `storage-recovery`: Proxmox workload coverage rows are both a storage/recovery protection-posture surface and a unified-resource identity consumer boundary.
@@ -2235,7 +2244,7 @@ because canonical merge preserves the provider source beside the agent source;
the pages must not admit every agent merely to recover those merged rows.
Proxmox route queries likewise declare their exact PVE, PBS, PMG, or agent
source boundary. Backups extend the source-scoped Overview guest snapshot with
-a PBS-only snapshot, so a route transition composes canonical resources rather
+a PBS-source server/agent snapshot, so a route transition composes canonical resources rather
than repeating the guest enumeration under another cache key.
TrueNAS follows the same rule: a merged agent-backed appliance retains its
`truenas` source, so the page queries that provider alone instead of admitting
diff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.json
index e6aba4ffc5..c78dbe6e15 100644
--- a/frontend-modern/browser-verification.json
+++ b/frontend-modern/browser-verification.json
@@ -1,17 +1,18 @@
{
"version": 1,
- "base_sha": "a61f1c7c82ad5c3229618a71b379b2deca0538bd",
- "verified_at": "2026-09-09T23:36:48.909107Z",
+ "base_sha": "1dcf4db9eaacf1cf4dc7d1629916d6218fe8abf1",
+ "verified_at": "2026-09-10T00:03:38.494393Z",
"result": "passed",
"changed_paths": [
- "frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/NodeCredentialSlot.tsx"
+ "frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx",
+ "frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx"
],
"content_sha256": {
- "frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/NodeCredentialSlot.tsx": "842afd8a7cd6a96309896c15ab9a428e27078f1d4176feaa24982fbae94acf9a"
+ "frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx": "092c6561bf59e1485a0602603e43da1fb5f2ce2c6b0fa312a1f3fe8fa0437c31",
+ "frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx": "0aba67a461e39a45fdddf199eb4230fbed93724f9795fa4b09c61ebc31b6715e"
},
"routes": [
- "/settings/infrastructure",
- "/settings/infrastructure?add=pve"
+ "/proxmox/backups"
],
"viewports": [
{
@@ -24,15 +25,12 @@
}
],
"states": [
- "Managed source-built Community backend with authenticated local session; discovery and impact API responses controlled by Playwright fixtures",
- "Candidate review with explicit approval; pending preview; edited endpoint; current success/error; disposed editor"
+ "Authenticated source-built local backend; resource/history API fixtures; websocket disabled to isolate fixture inventory",
+ "Standalone PBS agent and PVE VM with agent facet; disk series absent; CPU and memory series populated"
],
"interactions": [
- "At both widths: discover candidate, open review, request preview, approve then edit endpoint and assert approval resets",
- "Start replacement preview, deliver obsolete error, retain new loading state; resolve current success",
- "Request preview then change endpoint away and back; obsolete success stays hidden; current error is visible and retry enabled",
- "Close editor during pending request, resolve response, assert no preview appears outside disposed editor"
+ "Keyboard expand PBS row, select History, assert exact canonical type/id request and two utilization plot paths, collapse; repeat for both host types at both widths"
],
- "command": "pulse-heavy-run -- bash -c 'cd tests/integration && PULSE_E2E_USE_LOCAL_BACKEND=true node scripts/run-playwright.mjs tests/68-infrastructure-onboarding.spec.ts --project=chromium --grep \"import preview ignores\" --workers=1 --retries=0'",
- "notes": "Final current production build and both Chromium cases passed (8.1s). Desktop and narrow screenshots inspected. Real managed backend; discovery/impact are synthetic API fixtures, not appliance or reporter acceptance. Evidence: Web20260909T232514Z outcome browser-proof. No release qualification claim."
+ "command": "pulse-heavy-run -- bash -c 'cd tests/integration && PULSE_E2E_USE_LOCAL_BACKEND=true node scripts/run-playwright.mjs tests/63-pbs-history-targets.spec.ts --project=chromium --workers=1 --retries=0'",
+ "notes": "Two final Chromium tests pass (3.2s); desktop and narrow screenshots inspected. Synthetic API proof, not reporter/PBS installation acceptance. First attempt retained: live snapshots overwrote fixtures, and narrow pointer target was intercepted by row text; final fixture isolates websocket and uses supported keyboard expansion. Proof retained in Web20260909T235527Z outcome directory."
}
diff --git a/frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx
index f72b5538fc..5850ec5b7b 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx
@@ -133,7 +133,12 @@ const uniquelyCorrelatedAgent = (
const serverTokens = identityTokens(server);
if (serverTokens.size === 0) return undefined;
const matches = candidates.filter((candidate) => {
- if (candidate.type !== 'agent') return false;
+ // Host telemetry can be merged into a PVE guest rather than a standalone
+ // agent. Keep the unique-identity check and require an actual agent facet.
+ const guestWithAgent =
+ (candidate.type === 'vm' || candidate.type === 'system-container') &&
+ Boolean(candidate.agent ?? candidate.platformData?.agent);
+ if (candidate.type !== 'agent' && !guestWithAgent) return false;
for (const token of identityTokens(candidate)) {
if (serverTokens.has(token)) return true;
}
diff --git a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
index 0ab9390e53..5c5250116d 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
@@ -66,13 +66,13 @@ import {
} from './proxmoxPageModel';
// Each workflow hydrates only the source-scoped resource families it consumes.
-// Backups reuse the Overview guest snapshot and add only PBS rows, so opening
-// that workflow never downloads the same large guest inventory twice.
+// Backups reuse the Overview guest snapshot and add PBS servers and standalone
+// host telemetry, without downloading the same large guest inventory twice.
const PROXMOX_RESOURCE_QUERY_BY_TAB: Record<ProxmoxPageTabId, string> = {
overview: 'type=agent,vm,system-container,oci-container&source=proxmox',
storage: 'type=agent,pbs,storage,physical_disk,ceph&source=proxmox,pbs,agent',
replication: 'type=agent&source=proxmox',
- backups: 'type=pbs&source=pbs',
+ backups: 'type=pbs,agent&source=pbs',
ceph: 'type=ceph&source=proxmox',
mail: 'type=pmg&source=pmg',
};
@@ -223,10 +223,14 @@ export function ProxmoxPageSurface() {
buildProxmoxPageModel(normalizeSnapshot(snapshot));
const overviewModel = createMemo(() => buildModel(overviewResources.resources()));
const backupModel = createMemo(() =>
- buildModel([
- ...normalizeSnapshot(overviewResources.resources()),
- ...normalizeSnapshot(backupResources.resources()),
- ]),
+ buildModel(
+ Array.from(
+ new Map([
+ ...normalizeSnapshot(overviewResources.resources()),
+ ...normalizeSnapshot(backupResources.resources()),
+ ].map((resource) => [resource.id, resource])).values(),
+ ),
+ ),
);
const model = createMemo(() => {
if (activeTab() === 'overview') return overviewModel();
@@ -389,7 +393,7 @@ export function ProxmoxPageSurface() {
<ProxmoxBackupsTable
emptyIcon={<ProxmoxIcon class="h-6 w-6 text-slate-400" />}
workloads={model().guests}
- servers={model().pbs}
+ servers={model().resources}
/>
</Show>
<Show when={activeTab() === 'ceph'}>
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupServersTable.drawer.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupServersTable.drawer.test.tsx
index 08614dd45c..52ee4c9448 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupServersTable.drawer.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupServersTable.drawer.test.tsx
@@ -21,6 +21,7 @@ vi.mock('@/components/Infrastructure/ResourceDetailDrawer', () => ({
data-host-details-open={String(props.initialShowHostDetails === true)}
data-agent-id={props.resource.agent?.agentId}
data-metrics-resource-id={props.resource.metricsTarget?.resourceId}
+ data-metrics-resource-type={props.resource.metricsTarget?.resourceType}
>
<button type="button" onClick={props.onClose}>
Close details
@@ -95,7 +96,7 @@ describe('ProxmoxBackupServersTable details', () => {
expect(screen.queryByTestId('pbs-resource-detail')).not.toBeInTheDocument();
});
- it('uses the uniquely correlated agent resource for host details and metrics history', () => {
+ it.each(['agent', 'vm', 'system-container'] as const)('uses the uniquely correlated %s resource for host details and metrics history', (type) => {
const pbs = makePbsResource();
pbs.sources = ['pbs'];
pbs.agent = undefined;
@@ -106,7 +107,7 @@ describe('ProxmoxBackupServersTable details', () => {
};
const agent = {
id: 'agent-host-1',
- type: 'agent',
+ type,
name: 'pbs-main.local',
displayName: 'PBS host',
platformId: 'agent-host-1',
@@ -116,13 +117,14 @@ describe('ProxmoxBackupServersTable details', () => {
status: 'online',
lastSeen: pbs.lastSeen + 1_000,
agent: { agentId: 'agent-pbs-1', hostname: 'pbs-main.local', osName: 'Debian GNU/Linux' },
- metricsTarget: { resourceType: 'agent', resourceId: 'agent-pbs-1' },
+ metricsTarget: { resourceType: type, resourceId: 'agent-pbs-1' },
platformData: {
sources: ['agent', 'pbs'],
agent: { agentId: 'agent-pbs-1', hostname: 'pbs-main.local' },
},
} as Resource;
+ expect(agent.disk).toBeUndefined();
render(() => <ProxmoxBackupServersTable servers={[pbs, agent]} />);
fireEvent.click(screen.getByRole('button', { name: 'Expand details for pbs-main' }));
@@ -130,9 +132,23 @@ describe('ProxmoxBackupServersTable details', () => {
expect(detail).toHaveAttribute('data-resource-id', 'pbs-1');
expect(detail).toHaveAttribute('data-agent-id', 'agent-pbs-1');
expect(detail).toHaveAttribute('data-metrics-resource-id', 'agent-pbs-1');
+ expect(detail).toHaveAttribute('data-metrics-resource-type', type);
});
- it('does not guess when two agent resources share the PBS hostname', () => {
+ it('does not correlate a guest without host telemetry just by name', () => {
+ const pbs = makePbsResource();
+ pbs.metricsTarget = { resourceType: 'agent', resourceId: 'pbs-main' };
+ const guest = { ...pbs, id: 'vm-unrelated', type: 'vm',
+ agent: undefined, platformData: {}, pbs: undefined,
+ metricsTarget: { resourceType: 'vm', resourceId: 'unrelated' } } as Resource;
+ render(() => <ProxmoxBackupServersTable servers={[pbs, guest]} />);
+ fireEvent.click(screen.getByRole('button', { name: 'Expand details for pbs-main' }));
+ expect(screen.getByTestId('pbs-resource-detail')).toHaveAttribute(
+ 'data-metrics-resource-id', 'pbs-main',
+ );
+ });
+
+ it.each(['agent', 'vm'] as const)('does not guess when an agent and %s share the PBS hostname', (type) => {
const pbs = makePbsResource();
pbs.sources = ['pbs'];
pbs.agent = undefined;
@@ -140,7 +156,7 @@ describe('ProxmoxBackupServersTable details', () => {
const candidate = (id: string): Resource =>
({
id,
- type: 'agent',
+ type: id === 'agent-pbs-b' ? type : 'agent',
name: 'pbs-main.local',
displayName: id,
platformId: id,
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
index 86071e41c8..d1a8352f4c 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
@@ -399,7 +399,7 @@ describe('ProxmoxPageSurface contract', () => {
'type=agent,vm,system-container,oci-container&source=proxmox',
'type=agent,pbs,storage,physical_disk,ceph&source=proxmox,pbs,agent',
'type=agent&source=proxmox',
- 'type=pbs&source=pbs',
+ 'type=pbs,agent&source=pbs',
'type=ceph&source=proxmox',
'type=pmg&source=pmg',
]);
@@ -410,9 +410,13 @@ describe('ProxmoxPageSurface contract', () => {
expect(proxmoxPageSurfaceSource).toContain('resourceSource={storageResources}');
});
- it('reuses the overview guest snapshot and fetches only PBS rows for Backups', () => {
+ it('reuses guests and hydrates standalone PBS telemetry without duplicate candidates', () => {
mockPathname.mockReturnValue('/proxmox/backups');
- const guest = makeResource({ id: 'vm-100', type: 'vm', proxmox: { vmid: 100 } });
+ const guest = makeResource({ id: 'vm-100', type: 'vm', proxmox: { vmid: 100 },
+ agent: { agentId: 'guest-agent', hostname: 'pbs-vm' } });
+ const agent = makeResource({ id: 'pbs-agent', type: 'agent',
+ platformType: 'proxmox-pbs', sources: ['pbs', 'agent'],
+ metricsTarget: { resourceType: 'agent', resourceId: 'pbs-agent' } });
const server = makeResource({
id: 'pbs-1',
type: 'pbs',
@@ -421,8 +425,8 @@ describe('ProxmoxPageSurface contract', () => {
});
mockUseUnifiedResources.mockImplementation((options: { cacheKey: string }) => ({
resources: () => {
- if (options.cacheKey === 'proxmox-overview') return [guest];
- if (options.cacheKey === 'proxmox-backups-shell') return [server];
+ if (options.cacheKey === 'proxmox-overview') return [guest, agent];
+ if (options.cacheKey === 'proxmox-backups-shell') return [server, agent];
return [];
},
loading: () => false,
@@ -445,10 +449,10 @@ describe('ProxmoxPageSurface contract', () => {
]);
expect(options[3]).toMatchObject({
cacheKey: 'proxmox-backups-shell',
- query: 'type=pbs&source=pbs',
+ query: 'type=pbs,agent&source=pbs',
});
expect(mockBackupsTableProps).toHaveBeenCalledWith(
- expect.objectContaining({ workloads: [guest], servers: [server] }),
+ expect.objectContaining({ workloads: [guest], servers: [guest, agent, server] }),
);
});
diff --git a/tests/integration/tests/63-pbs-history-targets.spec.ts b/tests/integration/tests/63-pbs-history-targets.spec.ts
new file mode 100644
index 0000000000..2c85e80166
--- /dev/null
+++ b/tests/integration/tests/63-pbs-history-targets.spec.ts
@@ -0,0 +1,136 @@
+import fs from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { expect, test as base } from '@playwright/test';
+
+import { createAuthenticatedStorageState } from './helpers';
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+type WorkerFixtures = {
+ authStorageStatePath: string;
+};
+
+const test = base.extend<{}, WorkerFixtures>({
+ storageState: async ({ authStorageStatePath }, use) => {
+ await use(authStorageStatePath);
+ },
+ authStorageStatePath: [
+ async ({ browser }, use, workerInfo) => {
+ const storageStatePath = path.resolve(
+ __dirname,
+ '..',
+ '..',
+ 'tmp',
+ 'playwright-auth',
+ `pbs-history-targets-${workerInfo.project.name}.json`,
+ );
+ fs.mkdirSync(path.dirname(storageStatePath), { recursive: true });
+ await createAuthenticatedStorageState(browser, storageStatePath);
+ try {
+ await use(storageStatePath);
+ } finally {
+ fs.rmSync(storageStatePath, { force: true });
+ }
+ },
+ { scope: 'worker' },
+ ],
+});
+
+test.use({ serviceWorkers: 'block' });
+
+
+for (const width of [1280, 390]) {
+ test(`PBS History uses merged and standalone telemetry at ${width}px`, async ({ page }, testInfo) => {
+ test.setTimeout(120_000);
+ await page.setViewportSize({ width, height: 844 });
+ await page.addInitScript(() => {
+ class FakeWebSocket {
+ static CONNECTING = 0;
+ static OPEN = 1;
+ static CLOSING = 2;
+ static CLOSED = 3;
+
+ readonly url: string;
+ readyState = FakeWebSocket.CLOSED;
+ onopen: ((event: Event) => void) | null = null;
+ onclose:
+ | ((event: {
+ code?: number;
+ reason?: string;
+ wasClean?: boolean;
+ }) => void)
+ | null = null;
+ onerror: ((event: Event) => void) | null = null;
+ onmessage: ((event: MessageEvent) => void) | null = null;
+
+ constructor(url: string) {
+ this.url = url;
+ queueMicrotask(() => {
+ this.onclose?.({
+ code: 1006,
+ reason: 'e2e websocket disabled',
+ wasClean: false,
+ });
+ });
+ }
+
+ close() {
+ this.readyState = FakeWebSocket.CLOSED;
+ }
+
+ send() {}
+
+ addEventListener() {}
+
+ removeEventListener() {}
+ }
+
+ // @ts-expect-error Playwright init script runs in the browser context.
+ window.WebSocket = FakeWebSocket;
+ });
+
+ const common = { status: 'online', lastSeen: Date.now(), sourceType: 'hybrid',
+ cpu: { current: 10 }, memory: { current: 20, total: 1000, used: 200, free: 800 } };
+ const servers = ['vm', 'agent'].map(type => ({ ...common,
+ id: `pbs-${type}`, type: 'pbs', name: `backup-${type}`, displayName: `backup-${type}`,
+ platformId: `backup-${type}`, platformType: 'proxmox-pbs', sources: ['pbs'],
+ metricsTarget: { resourceType: 'agent', resourceId: `wrong-${type}` },
+ pbs: { instanceId: `backup-${type}`, hostname: `backup-${type}`, datastores: [] },
+ }));
+ const hosts = ['vm', 'agent'].map(type => ({ ...common, id: `host-${type}`, type,
+ name: `backup-${type}`, displayName: `backup-${type}`, platformId: `host-${type}`,
+ platformType: type === 'vm' ? 'proxmox-pve' : 'proxmox-pbs',
+ sources: type === 'vm' ? ['proxmox', 'agent'] : ['pbs', 'agent'],
+ agent: { agentId: `host-${type}`, hostname: `backup-${type}`, osName: 'Debian' },
+ metricsTarget: { resourceType: type, resourceId: `history-${type}` },
+ }));
+ await page.route('**/api/resources?**', async route => {
+ const query = new URL(route.request().url()).searchParams;
+ const types = (query.get('type') || '').split(',');
+ const source = (query.get('source') || '').split(',');
+ const data = [...servers, ...hosts].filter(r => types.includes(r.type) && r.sources.some(s => source.includes(s)));
+ await route.fulfill({ json: { data, total: data.length } });
+ });
+ const targets: string[] = [];
+ await page.route('**/api/metrics-store/history?**', async route => {
+ const q = new URL(route.request().url()).searchParams;
+ targets.push(`${q.get('resourceType')}/${q.get('resourceId')}`);
+ await route.fulfill({ json: { metrics: { cpu: [0, 1, 2].map(i => ({ timestamp: Date.now() - (2-i)*60000, value: 10+i, min: 10+i, max: 10+i, count: 1 })), memory: [0, 1, 2].map(i => ({ timestamp: Date.now() - (2-i)*60000, value: 20+i, min: 20+i, max: 20+i, count: 1 })) }, resourceId: q.get('resourceId'), resourceType: q.get('resourceType') } });
+ });
+ await page.goto('/proxmox/backups', { waitUntil: 'domcontentloaded' });
+ for (const type of ['vm', 'agent']) {
+ const expand = page.getByRole('button', { name: `Expand details for backup-${type}`, exact: true });
+ await expand.focus();
+ await page.keyboard.press('Enter');
+ await page.getByRole('tab', { name: 'History', exact: true }).click();
+ await expect.poll(() => targets).toContain(`${type}/history-${type}`);
+ expect(targets.some(t => t.includes('wrong-'))).toBe(false);
+ const utilization = page.getByTestId('guest-history-group-chart').first();
+ await expect(utilization.getByText('Collecting history')).toHaveCount(0);
+ await expect(utilization.locator('svg path')).toHaveCount(2);
+ await page.screenshot({ path: testInfo.outputPath(`pbs-${type}-${width}.png`), fullPage: true });
+ await page.getByRole('button', { name: `Collapse details for backup-${type}`, exact: true }).focus();
+ await page.keyboard.press('Enter');
+ }
+ });
+}