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.

Open a Proxmox storage alert's pool on the Storage page

rcourtmaneb42ada79a1c
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index 043778c66f..7c034d6f76 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -4063,9 +4063,10 @@ alert's own resource id. The shared workloads table resolves that id
(including a Proxmox source id such as `<cluster>-<node>-<vmid>`) through
the resource registry, opens the guest's drawer and reveals it, so a
notification reaches the affected guest in one tap instead of the top of a
-page with every guest on it. Other alerts (hosts, storage, Docker
+page with every guest on it. Other alerts (hosts, Docker
containers, Kubernetes, TrueNAS, Pulse system alerts) keep their platform
-page link, because their pages do not read `?resource=`. So do orphaned
+page link, because their pages do not read `?resource=`; Proxmox storage
+alerts open their pool (below). So do orphaned
backup alerts (`backup-subject:...`), whose ids name no resource the
registry can open. A guest's per-filesystem alert (`<guest>-disk-<key>`,
marked by `mountpoint` or `diskIndex` metadata) names no registry resource
@@ -4079,6 +4080,21 @@ stamp) keeps the platform page link and never falls back to its own id.
The platform used for the monitoring policy menu is still read from the
page path alone.
+### A Proxmox storage alert's name opens its pool
+
+A storage alert (`resourceType` `storage`) whose platform page is Proxmox
+links its name to `/proxmox/storage?resource=`, so a full or degraded pool
+opens on Storage instead of the top of the Proxmox overview. ZFS pool-state,
+pool-error and device alerts are raised under
+`<storage>/zfs-pool:<pool>[/device:<device>]` ids, which the resource
+registry cannot open, so `checkZFSPoolHealth` in `internal/alerts/storage.go`
+stamps the owning storage as `storageResourceId` metadata
+(`TestZFSAlertsNameTheirStorage`); the card prefers that key, then the
+alert's own id. An unstamped composite id (raised before the stamp, or a
+pool-error alert whose counters have not grown since) opens Storage without
+naming a pool and never passes the composite id. TrueNAS and vSphere storage
+alerts keep their platform page, which does not read `?resource=`.
+
### Thresholds lead with each group's default limits
The Thresholds page answers "what will alert me, and at what limits" before
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index b7a85f461b..f08ee6c7a9 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -8832,6 +8832,15 @@ state resolves non-row ids through the resource registry, and the summary
focus bridge reveals the selected row, so the alert link and every other
`?resource=` link share one resolution and reveal path.
+### Alert cards deep-link storage through the storage route search
+
+`AlertOverviewAlertCard` builds a Proxmox storage alert's link with
+`buildStorageRouteSearch({ resource })` on `/proxmox/storage`, preferring the
+alert's `storageResourceId` metadata, and adds no identity mapping of its
+own. `ProxmoxPageSurface` passes `routeActive` to the Storage surface it keeps
+mounted behind its other tabs, so a guest tab's `?resource=` link is not read
+as a storage deep link.
+
### Alert groups use the shared localization boundary
Alert group disclosure and group acknowledgement copy routes through
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index c2734277aa..7ebb0ea5b2 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -6546,6 +6546,25 @@ windowing test pins the row shape, and the 50-node browser fixture exercises
expanded rows and History at desktop and phone widths. This is presentation
work only; it changes no storage evidence, alert state or recovery authority.
+### Storage deep links resolve through the registry and open the pool
+
+`useStorageResourceHighlight` matches `?resource=` against a record's id,
+then its metrics resource id (alerts and history use it), then its name only
+when exactly one record carries that name, because every Proxmox node can
+have a `local-zfs` and two PBS servers can both expose `primary-vault`. Any
+other reference is resolved by `ResourceAPI.getResource` (the registry owns
+aliases, succession and ambiguity) and matched by the resolved id; a shared
+name is never looked up. Every matched pool is opened, not only Ceph, so the
+shared summary focus bridge reveals its row and details. The Proxmox page
+keeps Storage mounted behind its other tabs, whose guest links also use
+`?resource=`, so the hook acts only while Storage is the active tab
+(`routeActive`). A visit is one stretch of Storage showing one link: a
+refusal lasts for the visit, so live updates do not repeat the request but a
+later visit (another link, or the tab again) retries, and a resolved pool not
+listed yet opens when its record arrives. Once a visit has needed a lookup,
+any pool the operator opens or closes outranks the link, whether the lookup
+or a record update finds the pool first.
+
### App-shell AI navigation gating opens no recovery path
`App.tsx` now passes the `assistantEnabled` session capability to the keyboard
diff --git a/frontend-modern/browser-verification/4940f43511bb0bef.json b/frontend-modern/browser-verification/4940f43511bb0bef.json
new file mode 100644
index 0000000000..17e8335b82
--- /dev/null
+++ b/frontend-modern/browser-verification/4940f43511bb0bef.json
@@ -0,0 +1,48 @@
+{
+ "version": 1,
+ "base_sha": "fcc3e695f364602a2a13301a676567f9115d2ffc",
+ "verified_at": "2026-10-14T19:05:00Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/components/Storage/Storage.tsx",
+ "frontend-modern/src/components/Storage/useStoragePageModel.ts",
+ "frontend-modern/src/components/Storage/useStorageResourceHighlight.ts",
+ "frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx",
+ "frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/components/Storage/Storage.tsx": "b3a4ec12816c18e8486578fc58dad6287c73d8cb59224a9c99d8ae1a666f3b25",
+ "frontend-modern/src/components/Storage/useStoragePageModel.ts": "5dc75a52dda01a042117fb4419bc053e8d5457234cda643bb88fe8f261f2031d",
+ "frontend-modern/src/components/Storage/useStorageResourceHighlight.ts": "3cbd5a714fe74c9af119d1586d378e6cbfe8ac656ed484a87b56837b22263462",
+ "frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx": "4eb7f3ef132a98d85a351446a45b186e67787eface48d769a7258f5897a41420",
+ "frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx": "df2e75399ed9c140d3a0360ec1cfe7aea2926a7fc6e324eab7361691bc4c431c"
+ },
+ "routes": [
+ "/alerts/overview",
+ "/proxmox/storage",
+ "/proxmox/overview"
+ ],
+ "viewports": [
+ {
+ "width": 1280,
+ "height": 800
+ },
+ {
+ "width": 375,
+ "height": 812
+ }
+ ],
+ "states": [
+ "Alerts overview Proxmox storage alerts link to /proxmox/storage?resource=<storage id>; ZFS pool-state and device alerts link to their storage (storageResourceId), never the composite zfs-pool id",
+ "Storage opened from a pool alert expands that pool and highlights its row; its inline detail (capacity trend) is in view at 1280 and 375 wide, no horizontal overflow at 375",
+ "An alert source id the records do not carry (mock-cluster-1-pve1-local) resolves through one registry lookup and opens its pool",
+ "An unresolved ?resource= on Storage makes exactly one registry request and opens nothing",
+ "Storage mounted behind the Overview tab ignores a guest ?resource= link; only the workloads table looks it up"
+ ],
+ "interactions": [
+ "Clicked a ZFS device alert name and a pool alert name on Alerts overview, landing on Storage with the pool open",
+ "Opened another pool by hand, followed an unresolved storage link (operator pool stayed open), then followed the first pool link again (it reopened)",
+ "Followed a guest link on the Overview tab, then a storage link, and the linked pool opened",
+ "Repeated the alert-to-Storage click at 375x812 and 1280x800"
+ ]
+}
diff --git a/frontend-modern/src/components/Storage/Storage.tsx b/frontend-modern/src/components/Storage/Storage.tsx
index 8672588b1b..5cad2cb872 100644
--- a/frontend-modern/src/components/Storage/Storage.tsx
+++ b/frontend-modern/src/components/Storage/Storage.tsx
@@ -19,6 +19,9 @@ type StorageProps = {
filterSearchPlaceholder?: string;
filterSearchEmptyMessage?: string;
resourceSource?: StoragePageResourceSource;
+ // False while the platform page shows another tab; `?resource=` links
+ // then belong to that tab.
+ routeActive?: boolean;
};
const Storage: Component<StorageProps> = (props) => {
@@ -75,6 +78,7 @@ const Storage: Component<StorageProps> = (props) => {
} = useStoragePageModel({
forcedSourceFilter: () => props.forcedSourceFilter,
resourceSource: props.resourceSource,
+ routeActive: () => props.routeActive ?? true,
});
createEffect(() => {
diff --git a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
index 9e8cb8d55b..2f12ce8688 100644
--- a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
+++ b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
@@ -1179,6 +1179,36 @@ describe('Storage', () => {
});
});
+ it('opens a deep-linked pool only once its Storage tab is showing', async () => {
+ // The Proxmox page keeps Storage mounted behind its other tabs, whose
+ // guest links also use ?resource=.
+ hookResources = [
+ buildStorageResource('storage-zfs-link', 'Zfs-Link-Store', 'pve1'),
+ buildStorageResource('storage-other', 'Other-Store', 'pve2'),
+ ];
+ mockLocationSearch = '?resource=storage-zfs-link';
+ const [routeActive, setRouteActive] = createSignal(false);
+
+ render(() => <Storage routeActive={routeActive()} />);
+
+ const poolRow = (await screen.findByText('Zfs-Link-Store')).closest(
+ 'tr[data-summary-series-id]',
+ );
+ expect(document.querySelector('tr[data-inline-detail-for]')).toBeNull();
+ expect(poolRow).toHaveAttribute('data-resource-highlighted', 'false');
+
+ setRouteActive(true);
+
+ await waitFor(() => {
+ expect(
+ document
+ .querySelector('tr[data-inline-detail-for]')
+ ?.getAttribute('data-inline-detail-for'),
+ ).toBe(poolRow?.getAttribute('data-summary-series-id'));
+ expect(poolRow).toHaveAttribute('data-resource-highlighted', 'true');
+ });
+ });
+
it('restores canonical TrueNAS source filters from the storage route', async () => {
nodeResources = [
{
diff --git a/frontend-modern/src/components/Storage/__tests__/useStorageResourceHighlight.test.ts b/frontend-modern/src/components/Storage/__tests__/useStorageResourceHighlight.test.ts
index 7b73bf85b7..1915cf0956 100644
--- a/frontend-modern/src/components/Storage/__tests__/useStorageResourceHighlight.test.ts
+++ b/frontend-modern/src/components/Storage/__tests__/useStorageResourceHighlight.test.ts
@@ -1,9 +1,13 @@
-import { renderHook } from '@solidjs/testing-library';
+import { renderHook, waitFor } from '@solidjs/testing-library';
import { createSignal } from 'solid-js';
-import { describe, expect, it, vi } from 'vitest';
+import { afterEach, describe, expect, it, vi } from 'vitest';
import type { StorageRecord } from '@/features/storageBackups/models';
import { useStorageResourceHighlight } from '@/components/Storage/useStorageResourceHighlight';
+const getResource = vi.hoisted(() => vi.fn());
+vi.mock('@/api/resources', () => ({ ResourceAPI: { getResource } }));
+afterEach(() => getResource.mockReset());
+
const makeRecord = (overrides: Partial<StorageRecord> = {}): StorageRecord =>
({
id: 'storage-ceph',
@@ -24,93 +28,260 @@ const makeRecord = (overrides: Partial<StorageRecord> = {}): StorageRecord =>
...overrides,
}) as StorageRecord;
-describe('useStorageResourceHighlight', () => {
- it('highlights matching deep-linked resources and expands ceph pools', () => {
- const [locationPathname] = createSignal('/proxmox/storage');
- const [locationSearch] = createSignal('?resource=storage-ceph');
- const [records] = createSignal<StorageRecord[]>([makeRecord()]);
- const navigate = vi.fn();
- const expandedIds: Array<string | null> = [];
-
- const { result } = renderHook(() =>
- useStorageResourceHighlight({
- locationPathname,
- locationSearch,
- navigate,
- records,
- isStorageRecordCeph: () => true,
- setExpandedPoolId: (value) => {
- if (typeof value === 'function') {
- expandedIds.push(value(expandedIds.at(-1) ?? null));
- return;
- }
- expandedIds.push(value);
- },
- }),
- );
+// Mounts the hook with live search, records, active and expanded state, and
+// records every pool the hook opens.
+const mountHighlight = (search: string, records: StorageRecord[], active = true) => {
+ const [locationPathname] = createSignal('/proxmox/storage');
+ const [locationSearch, setLocationSearch] = createSignal(search);
+ const [recordList, setRecords] = createSignal<StorageRecord[]>(records);
+ const [isActive, setActive] = createSignal(active);
+ const [expandedPoolId, setExpandedPoolIdSignal] = createSignal<string | null>(null);
+ const navigate = vi.fn();
+ const opened: Array<string | null> = [];
+ const { result } = renderHook(() =>
+ useStorageResourceHighlight({
+ locationPathname,
+ locationSearch,
+ navigate,
+ records: recordList,
+ expandedPoolId,
+ setExpandedPoolId: (value) => {
+ const next = typeof value === 'function' ? value(expandedPoolId()) : value;
+ opened.push(next);
+ setExpandedPoolIdSignal(next);
+ },
+ active: isActive,
+ }),
+ );
+ return {
+ result,
+ opened,
+ navigate,
+ setLocationSearch,
+ setActive,
+ setRecords,
+ setExpandedPoolIdSignal,
+ };
+};
+describe('useStorageResourceHighlight', () => {
+ it('highlights a deep-linked pool and opens it', () => {
+ const { result, opened, navigate } = mountHighlight('?resource=storage-ceph', [makeRecord()]);
expect(result()).toBe('storage-ceph');
- expect(expandedIds).toEqual(['storage-ceph']);
+ expect(opened).toEqual(['storage-ceph']);
expect(navigate).not.toHaveBeenCalled();
});
- it('does nothing when no resource match exists', () => {
- const [locationPathname] = createSignal('/proxmox/storage');
- const [locationSearch] = createSignal('?resource=missing');
- const [records] = createSignal<StorageRecord[]>([makeRecord()]);
- const navigate = vi.fn();
- const expandedIds: Array<string | null> = [];
-
- const { result } = renderHook(() =>
- useStorageResourceHighlight({
- locationPathname,
- locationSearch,
- navigate,
- records,
- isStorageRecordCeph: () => true,
- setExpandedPoolId: (value) => {
- if (typeof value === 'function') {
- expandedIds.push(value(expandedIds.at(-1) ?? null));
- return;
- }
- expandedIds.push(value);
- },
- }),
- );
-
+ it('does nothing when the registry cannot resolve the reference', async () => {
+ getResource.mockRejectedValue(new Error('not found'));
+ const { result, opened, navigate } = mountHighlight('?resource=missing', [makeRecord()]);
+ await waitFor(() => expect(getResource).toHaveBeenCalledWith('missing', expect.anything()));
expect(result()).toBeNull();
- expect(expandedIds).toEqual([]);
+ expect(opened).toEqual([]);
expect(navigate).not.toHaveBeenCalled();
});
it('rewrites whitespace-padded resource deep-links to the canonical storage URL', () => {
- const [locationPathname] = createSignal('/proxmox/storage');
- const [locationSearch] = createSignal('?resource=%20storage-ceph%20&from=overview');
- const [records] = createSignal<StorageRecord[]>([makeRecord()]);
- const navigate = vi.fn();
- const expandedIds: Array<string | null> = [];
-
- const { result } = renderHook(() =>
- useStorageResourceHighlight({
- locationPathname,
- locationSearch,
- navigate,
- records,
- isStorageRecordCeph: () => true,
- setExpandedPoolId: (value) => {
- if (typeof value === 'function') {
- expandedIds.push(value(expandedIds.at(-1) ?? null));
- return;
- }
- expandedIds.push(value);
- },
- }),
+ const { result, opened, navigate } = mountHighlight(
+ '?resource=%20storage-ceph%20&from=overview',
+ [makeRecord()],
);
-
expect(navigate).toHaveBeenCalledWith('/proxmox/storage?resource=storage-ceph&from=overview', {
replace: true,
});
expect(result()).toBe('storage-ceph');
- expect(expandedIds).toEqual(['storage-ceph']);
+ expect(opened).toEqual(['storage-ceph']);
+ });
+
+ it('opens any deep-linked pool, not only Ceph, so the page can reveal it', () => {
+ const { result, opened } = mountHighlight('?resource=storage-zfs', [
+ makeRecord({ id: 'storage-zfs', name: 'local-zfs' }),
+ ]);
+ expect(result()).toBe('storage-zfs');
+ expect(opened).toEqual(['storage-zfs']);
+ expect(getResource).not.toHaveBeenCalled();
+ });
+
+ it('matches the metrics id alerts use for a pool', () => {
+ const { opened } = mountHighlight('?resource=cluster-pve1-local', [
+ makeRecord({
+ id: 'storage-local',
+ name: 'local',
+ metricsTarget: { resourceType: 'storage', resourceId: 'cluster-pve1-local' },
+ } as Partial<StorageRecord>),
+ ]);
+ expect(opened).toEqual(['storage-local']);
+ });
+
+ it('does not open a pool by a name several pools share', () => {
+ // Every Proxmox node can carry a `local-zfs`.
+ const { result, opened } = mountHighlight('?resource=local-zfs', [
+ makeRecord({ id: 'storage-pve1-zfs', name: 'local-zfs' }),
+ makeRecord({ id: 'storage-pve2-zfs', name: 'local-zfs' }),
+ ]);
+ expect(result()).toBeNull();
+ expect(opened).toEqual([]);
+ // The registry resolves ids, not names, so no lookup is made.
+ expect(getResource).not.toHaveBeenCalled();
+ });
+
+ it('opens the pool the resource registry resolves an alert source id to', async () => {
+ getResource.mockResolvedValue({ id: 'storage-2b0d' });
+ const { result, opened } = mountHighlight('?resource=mock-cluster-1-pve1-local', [
+ makeRecord({ id: 'storage-2b0d', name: 'west-a-iso-library' }),
+ ]);
+ await waitFor(() => expect(opened).toEqual(['storage-2b0d']));
+ expect(getResource).toHaveBeenCalledWith('mock-cluster-1-pve1-local', expect.anything());
+ expect(result()).toBe('storage-2b0d');
+ });
+
+ it('ignores another tab’s link while Storage is hidden, then applies it when shown', async () => {
+ // The Proxmox page keeps Storage mounted behind its other tabs, whose
+ // guest links also use ?resource=.
+ getResource.mockResolvedValue({ id: 'storage-2b0d' });
+ const records = [makeRecord({ id: 'storage-2b0d', name: 'west-a-iso-library' })];
+ const hidden = mountHighlight('?resource=mock-cluster-1-pve2-121', records, false);
+ expect(getResource).not.toHaveBeenCalled();
+ expect(hidden.opened).toEqual([]);
+
+ hidden.setLocationSearch('?resource=mock-cluster-1-pve1-local');
+ hidden.setActive(true);
+ await waitFor(() => expect(hidden.opened).toEqual(['storage-2b0d']));
+ });
+
+ it('retries a refused reference on a later visit, not on every update', async () => {
+ getResource.mockRejectedValueOnce(new Error('not yet registered'));
+ const records = [makeRecord({ id: 'storage-new', name: 'new-pool' })];
+ const view = mountHighlight('?resource=pve1-new-pool', records);
+ await waitFor(() => expect(getResource).toHaveBeenCalledTimes(1));
+ expect(view.opened).toEqual([]);
+
+ getResource.mockResolvedValue({ id: 'storage-new' });
+ view.setLocationSearch('');
+ view.setLocationSearch('?resource=pve1-new-pool');
+ await waitFor(() => expect(view.opened).toEqual(['storage-new']));
+ expect(getResource).toHaveBeenCalledTimes(2);
+ });
+
+ it('keeps the pool the operator opened while the lookup was running', async () => {
+ let resolveLookup: (value: { id: string }) => void = () => undefined;
+ getResource.mockReturnValue(
+ new Promise<{ id: string }>((resolve) => {
+ resolveLookup = resolve;
+ }),
+ );
+ const records = [
+ makeRecord({ id: 'storage-linked', name: 'linked-pool' }),
+ makeRecord({ id: 'storage-chosen', name: 'chosen-pool' }),
+ ];
+ const view = mountHighlight('?resource=pve1-linked-pool', records);
+ await waitFor(() => expect(getResource).toHaveBeenCalled());
+
+ view.setExpandedPoolIdSignal('storage-chosen');
+ resolveLookup({ id: 'storage-linked' });
+ await Promise.resolve();
+ await Promise.resolve();
+ expect(view.opened).toEqual([]);
+ expect(view.result()).toBeNull();
+ });
+ it('waits for a resolved pool to be listed instead of asking again', async () => {
+ getResource.mockResolvedValue({ id: 'storage-late' });
+ const view = mountHighlight('?resource=pve1-late-pool', [makeRecord()]);
+ await waitFor(() => expect(getResource).toHaveBeenCalledTimes(1));
+ await Promise.resolve();
+ await Promise.resolve();
+ view.setRecords([makeRecord(), makeRecord({ id: 'other', name: 'other-pool' })]);
+ expect(getResource).toHaveBeenCalledTimes(1);
+
+ view.setRecords([makeRecord(), makeRecord({ id: 'storage-late', name: 'late-pool' })]);
+ await waitFor(() => expect(view.opened).toEqual(['storage-late']));
+ expect(getResource).toHaveBeenCalledTimes(1);
+ });
+
+ it('retries a refused reference after visiting another pool', async () => {
+ getResource.mockRejectedValueOnce(new Error('not yet registered'));
+ const records = [
+ makeRecord({ id: 'storage-new', name: 'new-pool' }),
+ makeRecord({ id: 'storage-other', name: 'other-pool' }),
+ ];
+ const view = mountHighlight('?resource=pve1-new-pool', records);
+ await waitFor(() => expect(getResource).toHaveBeenCalledTimes(1));
+
+ view.setLocationSearch('?resource=storage-other');
+ expect(view.opened).toEqual(['storage-other']);
+ getResource.mockResolvedValue({ id: 'storage-new' });
+ view.setLocationSearch('?resource=pve1-new-pool');
+ await waitFor(() => expect(view.opened).toEqual(['storage-other', 'storage-new']));
+ expect(getResource).toHaveBeenCalledTimes(2);
+ });
+
+ it('keeps the operator’s pool when the linked record arrives during the lookup', async () => {
+ getResource.mockReturnValue(new Promise(() => undefined));
+ const chosen = makeRecord({ id: 'storage-chosen', name: 'chosen-pool' });
+ const view = mountHighlight('?resource=storage-linked', [chosen]);
+ await waitFor(() => expect(getResource).toHaveBeenCalled());
+
+ view.setExpandedPoolIdSignal('storage-chosen');
+ view.setRecords([chosen, makeRecord({ id: 'storage-linked', name: 'linked-pool' })]);
+ expect(view.opened).toEqual([]);
+ expect(view.result()).toBeNull();
+ });
+ it('reopens a pool when its link is followed again after an unresolved one', async () => {
+ getResource.mockRejectedValue(new Error('not found'));
+ const records = [
+ makeRecord({ id: 'storage-a', name: 'pool-a' }),
+ makeRecord({ id: 'storage-c', name: 'pool-c' }),
+ ];
+ const view = mountHighlight('?resource=storage-a', records);
+ expect(view.opened).toEqual(['storage-a']);
+ view.setExpandedPoolIdSignal('storage-c');
+
+ view.setLocationSearch('?resource=pve1-missing');
+ await waitFor(() => expect(getResource).toHaveBeenCalledTimes(1));
+ view.setLocationSearch('?resource=storage-a');
+ expect(view.opened).toEqual(['storage-a', 'storage-a']);
+ });
+
+ it('does not reopen the linked pool when Storage is shown again on the same link', () => {
+ const view = mountHighlight('?resource=storage-a', [makeRecord({ id: 'storage-a' })]);
+ expect(view.opened).toEqual(['storage-a']);
+ view.setActive(false);
+ view.setActive(true);
+ expect(view.opened).toEqual(['storage-a']);
+ });
+ it('reopens a pool when its link returns after another tab’s link', () => {
+ const records = [
+ makeRecord({ id: 'storage-a', name: 'pool-a' }),
+ makeRecord({ id: 'storage-c', name: 'pool-c' }),
+ ];
+ const view = mountHighlight('?resource=storage-a', records);
+ view.setExpandedPoolIdSignal('storage-c');
+ view.setActive(false);
+ view.setLocationSearch('?resource=mock-cluster-1-pve2-121');
+ view.setLocationSearch('?resource=storage-a');
+ view.setActive(true);
+ expect(view.opened).toEqual(['storage-a', 'storage-a']);
+ expect(getResource).not.toHaveBeenCalled();
+ });
+ it('keeps the operator’s choice when they reopen and close a pool during the lookup', async () => {
+ let resolveLookup: (value: { id: string }) => void = () => undefined;
+ getResource.mockReturnValue(
+ new Promise<{ id: string }>((resolve) => {
+ resolveLookup = resolve;
+ }),
+ );
+ const records = [
+ makeRecord({ id: 'storage-linked', name: 'linked-pool' }),
+ makeRecord({ id: 'storage-chosen', name: 'chosen-pool' }),
+ ];
+ const view = mountHighlight('?resource=pve1-linked-pool', records);
+ await waitFor(() => expect(getResource).toHaveBeenCalled());
+
+ view.setExpandedPoolIdSignal('storage-chosen');
+ view.setExpandedPoolIdSignal(null);
+ resolveLookup({ id: 'storage-linked' });
+ await Promise.resolve();
+ await Promise.resolve();
+ expect(view.opened).toEqual([]);
});
});
diff --git a/frontend-modern/src/components/Storage/useStoragePageModel.ts b/frontend-modern/src/components/Storage/useStoragePageModel.ts
index 7d064318d8..1ab0d658cd 100644
--- a/frontend-modern/src/components/Storage/useStoragePageModel.ts
+++ b/frontend-modern/src/components/Storage/useStoragePageModel.ts
@@ -24,12 +24,13 @@ import {
DEFAULT_STORAGE_SOURCE_FILTER,
DEFAULT_STORAGE_DISK_GROUP_FILTER,
DEFAULT_STORAGE_DISK_ROLE_FILTER,
- isStorageRecordCeph,
} from './storagePageState';
type UseStoragePageModelOptions = {
forcedSourceFilter?: () => string | undefined;
resourceSource?: StoragePageResourceSource;
+ // False while a platform page keeps Storage mounted behind another tab.
+ routeActive?: () => boolean;
};
export const useStoragePageModel = (options: UseStoragePageModelOptions = {}) => {
@@ -253,8 +254,9 @@ export const useStoragePageModel = (options: UseStoragePageModelOptions = {}) =>
locationSearch: () => location.search,
navigate,
records,
- isStorageRecordCeph,
+ expandedPoolId,
setExpandedPoolId,
+ active: options.routeActive,
});
const summaryInteraction = useSummaryPageInteractionState({
clearPinnedScope: clearPinnedSummaryScope,
diff --git a/frontend-modern/src/components/Storage/useStorageResourceHighlight.ts b/frontend-modern/src/components/Storage/useStorageResourceHighlight.ts
index ad67de3c03..3f4176ef23 100644
--- a/frontend-modern/src/components/Storage/useStorageResourceHighlight.ts
+++ b/frontend-modern/src/components/Storage/useStorageResourceHighlight.ts
@@ -1,5 +1,7 @@
-import { createEffect, createSignal, onCleanup, type Accessor } from 'solid-js';
+import { createEffect, createSignal, on, onCleanup, type Accessor } from 'solid-js';
+import { ResourceAPI } from '@/api/resources';
import type { StorageRecord } from '@/features/storageBackups/models';
+import { resolveStorageRecordMetricResourceId } from '@/features/storageBackups/storageMetricsIdentity';
import { parseStorageLinkSearch, STORAGE_QUERY_PARAMS } from '@/routing/resourceLinks';
type UseStorageResourceHighlightOptions = {
@@ -7,26 +9,113 @@ type UseStorageResourceHighlightOptions = {
locationSearch: Accessor<string>;
navigate: (path: string, options: { replace: true }) => void;
records: Accessor<StorageRecord[]>;
- isStorageRecordCeph: (record: StorageRecord) => boolean;
+ expandedPoolId: Accessor<string | null>;
setExpandedPoolId: (value: string | null | ((current: string | null) => string | null)) => void;
+ // A page that keeps Storage mounted behind another tab reads that tab's
+ // `?resource=` too; the deep link only applies while Storage is showing.
+ active?: Accessor<boolean>;
};
+// A deep link names a record by its id, by the metrics id alerts and history
+// use, or by name. A name only counts when one record carries it: every
+// Proxmox node can have a `local-zfs`.
export const findHighlightedStorageRecord = (
records: StorageRecord[],
resource: string | null | undefined,
): StorageRecord | null => {
if (!resource) return null;
- return records.find((record) => record.id === resource || record.name === resource) ?? null;
+ const byId = records.find((record) => record.id === resource);
+ if (byId) return byId;
+ const byMetricId = records.filter(
+ (record) => resolveStorageRecordMetricResourceId(record) === resource,
+ );
+ if (byMetricId.length > 0) return byMetricId.length === 1 ? byMetricId[0] : null;
+ const byName = records.filter((record) => record.name === resource);
+ return byName.length === 1 ? byName[0] : null;
};
export const useStorageResourceHighlight = (
options: UseStorageResourceHighlightOptions,
): Accessor<string | null> => {
+ const active = () => options.active?.() ?? true;
const [highlightedRecordId, setHighlightedRecordId] = createSignal<string | null>(null);
const [handledResourceId, setHandledResourceId] = createSignal<string | null>(null);
+ // Other ids (an alert's source id, a superseded id) are resolved by the
+ // resource registry, which owns aliases, succession and ambiguity.
+ const [resolvedReference, setResolvedReference] = createSignal<{
+ reference: string;
+ id: string;
+ } | null>(null);
+ let pendingLookup: { reference: string; controller: AbortController } | undefined;
+ // A visit is one stretch of Storage showing one `?resource=`. A refusal
+ // lasts for the visit, so live record updates do not repeat the request
+ // but a later visit retries. Once the visit has needed a lookup, any pool
+ // opened or closed since is the operator's choice and outranks the link.
+ let visitReference: string | null = null;
+ let refusedReference: string | null = null;
+ let lookupReference: string | null = null;
+ let operatorChoseDuringLookup = false;
let highlightTimer: number | undefined;
+ const cancelLookup = () => {
+ pendingLookup?.controller.abort();
+ pendingLookup = undefined;
+ };
+
+ const startVisit = (reference: string | null) => {
+ if (reference === visitReference) return;
+ cancelLookup();
+ visitReference = reference;
+ refusedReference = null;
+ lookupReference = null;
+ operatorChoseDuringLookup = false;
+ setResolvedReference(null);
+ };
+
+ createEffect(
+ on(
+ options.expandedPoolId,
+ () => {
+ if (lookupReference) operatorChoseDuringLookup = true;
+ },
+ { defer: true },
+ ),
+ );
+
+ const operatorChoseAnotherPool = (reference: string) =>
+ lookupReference === reference && operatorChoseDuringLookup;
+
+ const lookUpReference = (reference: string) => {
+ if (pendingLookup?.reference === reference || refusedReference === reference) return;
+ cancelLookup();
+ const controller = new AbortController();
+ pendingLookup = { reference, controller };
+ lookupReference ??= reference;
+ void ResourceAPI.getResource(reference, { signal: controller.signal })
+ .then((resource) => {
+ if (controller.signal.aborted) return;
+ pendingLookup = undefined;
+ const id = resource.id?.trim();
+ if (!id) {
+ refusedReference = reference;
+ return;
+ }
+ if (operatorChoseAnotherPool(reference)) {
+ setHandledResourceId(reference);
+ return;
+ }
+ setResolvedReference({ reference, id });
+ })
+ .catch(() => {
+ // An unresolved or refused reference must not open another pool.
+ if (controller.signal.aborted) return;
+ pendingLookup = undefined;
+ refusedReference = reference;
+ });
+ };
+
createEffect(() => {
+ if (!active()) return;
const search = options.locationSearch();
const params = new URLSearchParams(search);
const rawResource = params.get(STORAGE_QUERY_PARAMS.resource);
@@ -53,15 +142,41 @@ export const useStorageResourceHighlight = (
createEffect(() => {
const { resource } = parseStorageLinkSearch(options.locationSearch());
- if (!resource || resource === handledResourceId()) return;
-
- const match = findHighlightedStorageRecord(options.records(), resource);
- if (!match) return;
+ const handled = handledResourceId();
+ // Handling one link does not carry over to another, even one followed
+ // while Storage was hidden; hiding and showing the same link keeps it.
+ if (handled && handled !== resource) setHandledResourceId(null);
+ if (!active() || !resource) {
+ // Leaving the link (or the tab) ends this visit.
+ startVisit(null);
+ return;
+ }
+ startVisit(resource);
+ if (resource === handled) return;
- if (options.isStorageRecordCeph(match)) {
- options.setExpandedPoolId(match.id);
+ const records = options.records();
+ const resolved = resolvedReference();
+ const match =
+ findHighlightedStorageRecord(records, resource) ??
+ (resolved?.reference === resource
+ ? (records.find((record) => record.id === resolved.id) ?? null)
+ : null);
+ if (!match) {
+ // A resolved pool not listed yet opens when its record arrives. The
+ // registry resolves ids, not names; a name several pools share stays
+ // unopened rather than costing a lookup that cannot succeed.
+ if (resolved?.reference === resource) return;
+ if (!records.some((record) => record.name === resource)) lookUpReference(resource);
+ return;
}
+ cancelLookup();
+ if (operatorChoseAnotherPool(resource)) {
+ setHandledResourceId(resource);
+ return;
+ }
+ // Opening the pool lets the page's focus bridge reveal its row and details.
+ options.setExpandedPoolId(match.id);
setHighlightedRecordId(match.id);
setHandledResourceId(resource);
@@ -70,6 +185,7 @@ export const useStorageResourceHighlight = (
});
onCleanup(() => {
+ cancelLookup();
if (highlightTimer) window.clearTimeout(highlightTimer);
});
diff --git a/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx b/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
index 0e3763989c..82858872f5 100644
--- a/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
+++ b/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
@@ -55,6 +55,7 @@ import {
buildStandalonePath,
buildTrueNASPath,
buildVmwarePath,
+ buildStorageRouteSearch,
buildWorkloadsRouteSearch,
} from '@/routing/resourceLinks';
import {
@@ -238,7 +239,32 @@ export function AlertOverviewAlertCard(props: AlertOverviewAlertCardProps) {
// The name opens the guest an alert is about; other resources keep their
// platform page.
+ // A Proxmox storage alert opens its pool on Storage, which resolves the id
+ // through the resource registry and reveals the pool. ZFS pool and device
+ // alerts are raised under "<storage>/zfs-pool:..." ids the registry cannot
+ // open, so they carry their storage as storageResourceId; one raised before
+ // that stamp still opens the Storage page, without naming a pool.
+ const storagePoolLink = (): string | undefined => {
+ const metadata = props.alert.metadata;
+ const resourceType = metadata?.resourceType;
+ if (
+ typeof resourceType !== 'string' ||
+ resourceType.trim().toLowerCase() !== 'storage' ||
+ platformLink() !== buildProxmoxPath()
+ ) {
+ return undefined;
+ }
+ const stamped =
+ typeof metadata?.storageResourceId === 'string' ? metadata.storageResourceId.trim() : '';
+ const ownId = props.alert.resourceId?.trim() ?? '';
+ const resourceId = stamped || (ownId.includes('/zfs-pool:') ? '' : ownId);
+ const search = resourceId ? buildStorageRouteSearch({ resource: resourceId }) : '';
+ return `${buildProxmoxPath('storage')}${search}`;
+ };
+
const resourceLink = (): string => {
+ const storageLink = storagePoolLink();
+ if (storageLink) return storageLink;
const page = platformLink();
const metadata = props.alert.metadata;
const resourceType = metadata?.resourceType;
diff --git a/frontend-modern/src/features/alerts/__tests__/AlertOverviewAlertCard.system-scope.test.tsx b/frontend-modern/src/features/alerts/__tests__/AlertOverviewAlertCard.system-scope.test.tsx
index 2e573fbf7b..4b07d42aa9 100644
--- a/frontend-modern/src/features/alerts/__tests__/AlertOverviewAlertCard.system-scope.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/AlertOverviewAlertCard.system-scope.test.tsx
@@ -301,7 +301,8 @@ describe('Pulse system-alert overview scope', () => {
incidentCode: 'capacity_runway_low',
resourceSources: ['pbs'],
},
- href: '/proxmox/overview',
+ // Storage resolves the datastore's id through the registry and opens it.
+ href: '/proxmox/storage?resource=storage%3Apbs-1%3Amain',
platformType: 'proxmox-pbs',
},
{
@@ -614,7 +615,27 @@ describe('Pulse system-alert overview scope', () => {
).toBe('/proxmox/overview');
});
- it('keeps the platform page for resources the workloads table does not list', () => {
+ it('opens the storage a ZFS pool or device alert names', () => {
+ // "<storage>/zfs-pool:..." ids name nothing the registry can open.
+ expect(
+ linkFor({
+ resourceId: 'pve5-local-zfs/zfs-pool:local-zfs/device:sdb2',
+ resourceName: 'west-e-service-pool (local-zfs, sdb2)',
+ metadata: { resourceType: 'storage', storageResourceId: 'pve5-local-zfs' },
+ }),
+ ).toBe('/proxmox/storage?resource=pve5-local-zfs');
+ cleanup();
+ // Raised before the stamp: the Storage page, without naming a pool.
+ expect(
+ linkFor({
+ resourceId: 'pve5-local-zfs/zfs-pool:local-zfs',
+ resourceName: 'west-e-service-pool (local-zfs)',
+ metadata: { resourceType: 'storage' },
+ }),
+ ).toBe('/proxmox/storage');
+ });
+
+ it('opens a storage pool on Storage and keeps Docker on its platform page', () => {
expect(
linkFor({
resourceId: 'docker:nebula-1-mock/nebula-1-c94124aef15b',
@@ -629,7 +650,7 @@ describe('Pulse system-alert overview scope', () => {
resourceName: 'west-a-iso-library',
metadata: { resourceType: 'storage' },
}),
- ).toBe('/proxmox/overview');
+ ).toBe('/proxmox/storage?resource=mock-cluster-1-pve1-local');
});
});
});
diff --git a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
index 7acad9e832..e050b1a868 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
@@ -407,6 +407,7 @@ export function ProxmoxPageSurface() {
aria-hidden={activeTab() !== 'storage' ? 'true' : undefined}
>
<StorageSurface
+ routeActive={activeTab() === 'storage'}
forcedSourceFilter={PROXMOX_PLATFORM_FILTER}
resourceSource={storageResources}
suppressNodeFilter
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 be256ab56e..762d1ad082 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
@@ -252,6 +252,27 @@ describe('ProxmoxPageSurface contract', () => {
);
});
+ it('tells the Storage surface whether its tab is the one showing', () => {
+ // Storage stays mounted behind the other tabs; their ?resource= links
+ // must not open a pool.
+ mockPathname.mockReturnValue('/proxmox/storage');
+ setResources([
+ makeResource({
+ id: 'pbs-datastore-1',
+ type: 'storage',
+ platformType: 'proxmox-pbs',
+ sources: ['pbs'],
+ }),
+ ]);
+
+ renderSurface();
+
+ expect(screen.getByTestId('storage-surface')).toBeInTheDocument();
+ const props = mockStorageProps.mock.lastCall?.[0] as { routeActive?: boolean };
+ expect(props.routeActive).toBe(true);
+ expect(proxmoxPageSurfaceSource).toContain("routeActive={activeTab() === 'storage'}");
+ });
+
it('surfaces stale agent-backed Proxmox nodes', () => {
mockVersionInfo.mockReturnValue({
version: 'v6.0.0-rc.6',
diff --git a/internal/alerts/alerts_test.go b/internal/alerts/alerts_test.go
index 43fa5b1dea..2d94b8c2b8 100644
--- a/internal/alerts/alerts_test.go
+++ b/internal/alerts/alerts_test.go
@@ -22992,3 +22992,39 @@ func TestCheckNodeTemperatureJudgesPrimaryCPUReading(t *testing.T) {
t.Fatalf("alert value = %v, want the primary reading 92 (rule gave %v)", alert.Value, want)
}
}
+
+// ZFS pool and device alerts are raised under "<storage>/zfs-pool:..." ids
+// that the resource registry cannot open; each names its storage so the
+// Alerts overview can open the pool on the Storage page.
+func TestZFSAlertsNameTheirStorage(t *testing.T) {
+ m := newTestManager(t)
+ storage := models.Storage{
+ ID: "pve1-local-zfs",
+ Name: "Local ZFS",
+ Node: "pve1",
+ Instance: "lab",
+ ZFSPool: &models.ZFSPool{
+ Name: "rpool",
+ State: "DEGRADED",
+ ReadErrors: 3,
+ Devices: []models.ZFSDevice{
+ {Name: "sda", State: "FAULTED", ReadErrors: 3},
+ },
+ },
+ }
+
+ m.checkZFSPoolHealth(storage)
+
+ m.mu.RLock()
+ defer m.mu.RUnlock()
+ for _, id := range []string{
+ buildCanonicalStateID("pve1-local-zfs/zfs-pool:rpool", "pve1-local-zfs/zfs-pool:rpool-state"),
+ buildCanonicalStateID("pve1-local-zfs/zfs-pool:rpool", "pve1-local-zfs/zfs-pool:rpool-errors"),
+ buildCanonicalStateID("pve1-local-zfs/zfs-pool:rpool/device:sda", "pve1-local-zfs/zfs-pool:rpool/device:sda-health"),
+ } {
+ alert := testRequireActiveAlert(t, m, id)
+ if got := alert.Metadata["storageResourceId"]; got != "pve1-local-zfs" {
+ t.Errorf("%s: storageResourceId = %v, want pve1-local-zfs", id, got)
+ }
+ }
+}
diff --git a/internal/alerts/storage.go b/internal/alerts/storage.go
index 3bb2ac80ef..4763eab676 100644
--- a/internal/alerts/storage.go
+++ b/internal/alerts/storage.go
@@ -286,9 +286,14 @@ func (m *Manager) checkZFSPoolHealth(storage models.Storage) {
// Check pool state (DEGRADED, FAULTED, etc.)
stateAlertID := fmt.Sprintf("zfs-pool-state-%s", storage.ID)
+ // Pool and device alerts are raised under "<storage>/zfs-pool:..." ids,
+ // which name nothing the resource registry can open. storageResourceId
+ // names the storage the pool belongs to, so the Alerts overview can open
+ // it on the Storage page.
stateMetadata := map[string]interface{}{
- "pool_name": pool.Name,
- "pool_state": pool.State,
+ "pool_name": pool.Name,
+ "pool_state": pool.State,
+ "storageResourceId": storage.ID,
}
stateReasons := filterStorageHealthReasonsByCodes(poolAssessment.Reasons, zfsPoolAssessmentCodes)
stateResult, _ := m.syncCanonicalHealthAssessmentAlert(canonicalHealthAssessmentAlertParams{
@@ -323,10 +328,11 @@ func (m *Manager) checkZFSPoolHealth(storage models.Storage) {
existingValue, exists := m.activeAlertValue(buildCanonicalStateID(errorsSpecResourceID, errorsSpecID))
if !exists || float64(totalErrors) > existingValue {
errorMetadata := map[string]interface{}{
- "pool_name": pool.Name,
- "read_errors": pool.ReadErrors,
- "write_errors": pool.WriteErrors,
- "checksum_errors": pool.ChecksumErrors,
+ "pool_name": pool.Name,
+ "read_errors": pool.ReadErrors,
+ "write_errors": pool.WriteErrors,
+ "checksum_errors": pool.ChecksumErrors,
+ "storageResourceId": storage.ID,
}
errorReasons := filterStorageHealthReasonsByCodes(poolAssessment.Reasons, zfsPoolErrorAssessmentCodes)
result, _ := m.syncCanonicalHealthAssessmentAlert(canonicalHealthAssessmentAlertParams{
@@ -369,12 +375,13 @@ func (m *Manager) checkZFSPoolHealth(storage models.Storage) {
alertID := fmt.Sprintf("zfs-device-%s-%s", storage.ID, device.Name)
deviceAssessment := zfsDeviceAssessment(device)
metadata := map[string]interface{}{
- "pool_name": pool.Name,
- "device_name": device.Name,
- "device_state": device.State,
- "read_errors": device.ReadErrors,
- "write_errors": device.WriteErrors,
- "checksum_errors": device.ChecksumErrors,
+ "pool_name": pool.Name,
+ "device_name": device.Name,
+ "device_state": device.State,
+ "read_errors": device.ReadErrors,
+ "write_errors": device.WriteErrors,
+ "checksum_errors": device.ChecksumErrors,
+ "storageResourceId": storage.ID,
}
result, _ := m.syncCanonicalHealthAssessmentAlert(canonicalHealthAssessmentAlertParams{
SpecID: storage.ID + "/zfs-pool:" + sanitizeHostComponent(pool.Name) + "/device:" + sanitizeHostComponent(device.Name) + "-health",