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.

feat(storage): restore canonical truenas source handoff

rcourtmanf941f7befe19
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 938ba63393..1715d11eb7 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -689,6 +689,12 @@ when filter options materialize asynchronously. `LabeledFilterSelect` must keep
the caller-owned `value` visibly selected after option children arrive so
dashboard, recovery, and other canonical filter bars do not drop their active
selection until the operator reopens the control.
+That same boundary also owns live option propagation through shared page-control
+composition. Callers such as storage and recovery must pass source/filter
+option collections through reactive accessors instead of snapshot arrays when
+those options depend on post-load unified-resource state, so the shared toolbar
+can reconcile late-arriving options and preserved route selections without
+requiring page-local reset hacks.
When those workspace tabs need an embedded control-bar treatment, they should
still stay on the one canonical `frontend-modern/src/components/shared/Subtabs.tsx`
primitive and reuse the established shell, list, and button class pattern
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 2bff7545bb..51ab81ba50 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -39,18 +39,19 @@ querying, and the operator-facing storage health presentation layer.
13. `frontend-modern/src/pages/Storage.tsx`
14. `frontend-modern/src/components/Storage/Storage.tsx`
15. `frontend-modern/src/features/storageBackups/storageModelCore.ts`
-16. `frontend-modern/src/hooks/useRecoveryPoints.ts`
-17. `frontend-modern/src/hooks/useRecoveryRollups.ts`
-18. `frontend-modern/src/pages/RecoveryRoute.tsx`
-19. `frontend-modern/src/routing/resourceLinks.ts`
-20. `frontend-modern/src/pages/Dashboard.tsx`
-21. `frontend-modern/src/features/dashboardOverview/dashboardWidgets.ts`
-22. `frontend-modern/src/components/Recovery/DashboardRecoveryStatusPanel.tsx`
-23. `frontend-modern/src/components/Storage/DashboardStoragePanel.tsx`
-24. `frontend-modern/src/types/recovery.ts`
-25. `frontend-modern/src/utils/recoverySummaryPresentation.ts`
-26. `frontend-modern/src/utils/recoveryTablePresentation.ts`
-27. `frontend-modern/src/utils/textPresentation.ts`
+16. `frontend-modern/src/utils/storageSources.ts`
+17. `frontend-modern/src/hooks/useRecoveryPoints.ts`
+18. `frontend-modern/src/hooks/useRecoveryRollups.ts`
+19. `frontend-modern/src/pages/RecoveryRoute.tsx`
+20. `frontend-modern/src/routing/resourceLinks.ts`
+21. `frontend-modern/src/pages/Dashboard.tsx`
+22. `frontend-modern/src/features/dashboardOverview/dashboardWidgets.ts`
+23. `frontend-modern/src/components/Recovery/DashboardRecoveryStatusPanel.tsx`
+24. `frontend-modern/src/components/Storage/DashboardStoragePanel.tsx`
+25. `frontend-modern/src/types/recovery.ts`
+26. `frontend-modern/src/utils/recoverySummaryPresentation.ts`
+27. `frontend-modern/src/utils/recoveryTablePresentation.ts`
+28. `frontend-modern/src/utils/textPresentation.ts`
## Shared Boundaries
@@ -60,7 +61,7 @@ querying, and the operator-facing storage health presentation layer.
1. Add or change recovery-point persistence, rollups, or series derivation through `internal/recovery/`
2. Add or change recovery page UX through `frontend-modern/src/components/Recovery/` and keep canonical route/query/filter state ownership in `frontend-modern/src/features/recovery/useRecoverySurfaceState.ts`
-3. Add or change storage page UX through `frontend-modern/src/pages/Storage.tsx`, `frontend-modern/src/components/Storage/`, and `frontend-modern/src/features/storageBackups/`
+3. Add or change storage page UX through `frontend-modern/src/pages/Storage.tsx`, `frontend-modern/src/components/Storage/`, `frontend-modern/src/features/storageBackups/`, and the shared storage-source contract in `frontend-modern/src/utils/storageSources.ts`
4. Route transport changes for storage and recovery endpoints through `internal/api/` and the owning `api-contracts` proof routes
5. Route canonical storage/recovery resource selection through `frontend-modern/src/hooks/useUnifiedResources.ts` and the owning `unified-resources` contract
That shared hook now also projects resource `clusterId` through the shared cluster-name helper, so storage and recovery links keep the same cluster-context label as other unified-resource consumers instead of rebuilding a local fallback chain.
@@ -129,6 +130,11 @@ they do not own the timeline store itself. The canonical resource-change
history now lives in `internal/unifiedresources/store.go` and is surfaced
through the shared API/resource wiring, which keeps storage and recovery focused
on presentation and query shape rather than re-implementing change persistence.
+That same storage ownership also includes the shared storage-source presentation
+contract in `frontend-modern/src/utils/storageSources.ts`: storage pages and
+cross-surface storage links must reuse one canonical ordering, label, tone, and
+default-option model for sources like PVE, PBS, Ceph, and TrueNAS instead of
+re-sorting or re-presenting those source options locally.
The recovery backend is a real product boundary, not just a helper package:
`internal/recovery/` owns per-tenant SQLite persistence, rollup derivation,
diff --git a/frontend-modern/src/components/Storage/Storage.tsx b/frontend-modern/src/components/Storage/Storage.tsx
index d221e7b46e..23cbd0785e 100644
--- a/frontend-modern/src/components/Storage/Storage.tsx
+++ b/frontend-modern/src/components/Storage/Storage.tsx
@@ -79,7 +79,7 @@ const Storage: Component = () => {
setStatusFilter={setStorageFilterStatus}
sourceFilter={sourceFilter}
setSourceFilter={setSourceFilter}
- sourceOptions={sourceFilterOptions()}
+ sourceOptions={sourceFilterOptions}
nodeFilterOptions={nodeFilterOptions()}
selectedNodeId={selectedNodeId}
setSelectedNodeId={setSelectedNodeId}
diff --git a/frontend-modern/src/components/Storage/StorageControls.tsx b/frontend-modern/src/components/Storage/StorageControls.tsx
index b4a2ba6fc9..9cdec931a0 100644
--- a/frontend-modern/src/components/Storage/StorageControls.tsx
+++ b/frontend-modern/src/components/Storage/StorageControls.tsx
@@ -31,7 +31,7 @@ type StorageControlsProps = {
setStatusFilter: (value: StorageStatusFilter) => void;
sourceFilter: () => string;
setSourceFilter: (value: string) => void;
- sourceOptions: StorageSourceOption[];
+ sourceOptions: () => StorageSourceOption[];
nodeFilterOptions: Array<{ value: string; label: string }>;
selectedNodeId: () => string;
setSelectedNodeId: (value: string) => void;
diff --git a/frontend-modern/src/components/Storage/StorageFilter.tsx b/frontend-modern/src/components/Storage/StorageFilter.tsx
index 62f9cb8546..e21fef0359 100644
--- a/frontend-modern/src/components/Storage/StorageFilter.tsx
+++ b/frontend-modern/src/components/Storage/StorageFilter.tsx
@@ -1,4 +1,4 @@
-import { Component, Show, type JSX } from 'solid-js';
+import { Component, For, Show, type JSX } from 'solid-js';
import { Card } from '@/components/shared/Card';
import {
FilterDivider,
@@ -51,7 +51,7 @@ interface StorageFilterProps {
setStatusFilter?: (value: StorageStatusFilter) => void;
sourceFilter?: () => string;
setSourceFilter?: (value: string) => void;
- sourceOptions?: StorageSourceOption[];
+ sourceOptions?: () => StorageSourceOption[];
// Slot for page-specific filters (e.g., view toggle, node selector).
leadingFilters?: JSX.Element;
// Column visibility (optional)
@@ -173,9 +173,9 @@ export const StorageFilter: Component<StorageFilterProps> = (props) => {
onChange={(e) => props.setSourceFilter!(e.currentTarget.value)}
selectClass={STORAGE_FILTER_COMPACT_SELECT_CLASS}
>
- {sourceOptions().map((option: StorageSourceOption) => (
- <option value={option.key}>{option.label}</option>
- ))}
+ <For each={sourceOptions()}>
+ {(option: StorageSourceOption) => <option value={option.key}>{option.label}</option>}
+ </For>
</LabeledFilterSelect>
<FilterDivider />
</Show>
diff --git a/frontend-modern/src/components/Storage/StoragePageControls.tsx b/frontend-modern/src/components/Storage/StoragePageControls.tsx
index 5e38bb6ae9..120608f754 100644
--- a/frontend-modern/src/components/Storage/StoragePageControls.tsx
+++ b/frontend-modern/src/components/Storage/StoragePageControls.tsx
@@ -22,7 +22,7 @@ type StoragePageControlsProps = {
setStatusFilter: (value: StorageStatusFilter) => void;
sourceFilter: () => string;
setSourceFilter: (value: string) => void;
- sourceOptions: StorageSourceOption[];
+ sourceOptions: () => StorageSourceOption[];
nodeFilterOptions: Array<{ value: string; label: string }>;
selectedNodeId: () => string;
setSelectedNodeId: (value: string) => void;
diff --git a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
index 1e99270f0b..c0d0e182cf 100644
--- a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
+++ b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
@@ -751,6 +751,87 @@ describe('Storage', () => {
});
});
+ it('restores canonical TrueNAS source filters from the storage route', async () => {
+ nodeResources = [
+ {
+ id: 'truenas-main',
+ type: 'agent',
+ name: 'TrueNAS Main',
+ displayName: 'TrueNAS Main',
+ platformId: 'truenas-main',
+ platformType: 'truenas',
+ sourceType: 'hybrid',
+ status: 'online',
+ uptime: 1000,
+ lastSeen: Date.now(),
+ canonicalIdentity: { hostname: 'truenas-main' },
+ platformData: { sources: ['agent', 'truenas'] },
+ } as Resource,
+ {
+ id: 'pve-main',
+ type: 'agent',
+ name: 'PVE Main',
+ displayName: 'PVE Main',
+ platformId: 'cluster-main',
+ platformType: 'proxmox-pve',
+ sourceType: 'hybrid',
+ status: 'online',
+ uptime: 1000,
+ lastSeen: Date.now(),
+ canonicalIdentity: { hostname: 'pve-main' },
+ platformData: { proxmox: { instance: 'cluster-main' }, sources: ['agent', 'proxmox-pve'] },
+ } as Resource,
+ ];
+ hookResources = [
+ buildStorageResource('storage-truenas-display', 'tank', 'truenas-main', {
+ platformId: 'truenas-1',
+ platformType: 'truenas',
+ parentId: 'truenas-main',
+ parentName: 'truenas-main',
+ includePlatformNode: false,
+ storageType: 'zfs-pool',
+ storage: {
+ platform: 'truenas',
+ type: 'zfs-pool',
+ topology: 'pool',
+ isZfs: true,
+ },
+ }),
+ buildStorageResource('storage-pve-main', 'local-zfs', 'pve-main', {
+ parentId: 'pve-main',
+ parentName: 'pve-main',
+ includePlatformNode: false,
+ storage: {
+ platform: 'proxmox-pve',
+ type: 'zfspool',
+ topology: 'pool',
+ isZfs: true,
+ },
+ }),
+ ];
+ mockLocationSearch = '?source=truenas&node=truenas-main';
+
+ render(() => <Storage />);
+
+ await waitFor(() => {
+ expect(screen.getByLabelText('Source')).toHaveValue('truenas');
+ });
+
+ expect(screen.getByLabelText('Node')).toHaveValue('truenas-main');
+ expect(
+ Array.from(screen.getByLabelText('Source').querySelectorAll('option')).map((option) => ({
+ value: option.value,
+ label: option.textContent,
+ })),
+ ).toEqual([
+ { value: 'all', label: 'All Sources' },
+ { value: 'proxmox-pve', label: 'PVE' },
+ { value: 'truenas', label: 'TrueNAS' },
+ ]);
+ expect(screen.getByText('tank')).toBeInTheDocument();
+ expect(screen.queryByText('local-zfs')).not.toBeInTheDocument();
+ });
+
it('canonicalizes whitespace-padded resource deep-links without dropping other params', async () => {
hookResources = [
buildStorageResource('storage-ceph-link', 'Ceph-Link-Store', 'pve1', {
diff --git a/frontend-modern/src/components/Storage/__tests__/StorageControls.test.tsx b/frontend-modern/src/components/Storage/__tests__/StorageControls.test.tsx
index 85d3d34a48..f75e3cc423 100644
--- a/frontend-modern/src/components/Storage/__tests__/StorageControls.test.tsx
+++ b/frontend-modern/src/components/Storage/__tests__/StorageControls.test.tsx
@@ -1,4 +1,4 @@
-import { fireEvent, render, screen } from '@solidjs/testing-library';
+import { fireEvent, render, screen, waitFor } from '@solidjs/testing-library';
import { createSignal } from 'solid-js';
import { describe, expect, it } from 'vitest';
import { StorageControls } from '@/components/Storage/StorageControls';
@@ -13,6 +13,10 @@ describe('StorageControls', () => {
const [statusFilter, setStatusFilter] =
createSignal<'all' | 'warning' | 'critical'>('all');
const [sourceFilter, setSourceFilter] = createSignal('all');
+ const [sourceOptions] = createSignal([
+ { key: 'all', label: 'All Sources', tone: 'slate' as const },
+ { key: 'proxmox-pve', label: 'PVE', tone: 'orange' as const },
+ ]);
const [selectedNodeId, setSelectedNodeId] = createSignal('all');
render(() => (
@@ -31,10 +35,7 @@ describe('StorageControls', () => {
setStatusFilter={setStatusFilter}
sourceFilter={sourceFilter}
setSourceFilter={setSourceFilter}
- sourceOptions={[
- { key: 'all', label: 'All Sources', tone: 'slate' },
- { key: 'proxmox-pve', label: 'PVE', tone: 'orange' },
- ]}
+ sourceOptions={sourceOptions}
nodeFilterOptions={[
{ value: 'all', label: 'All Nodes' },
{ value: 'node-1', label: 'pve1' },
@@ -52,4 +53,62 @@ describe('StorageControls', () => {
});
expect(selectedNodeId()).toBe('node-1');
});
+
+ it('updates source filter options when storage data arrives after first render', async () => {
+ const [view, setView] = createSignal<'pools' | 'disks'>('pools');
+ const [search, setSearch] = createSignal('');
+ const [groupBy, setGroupBy] = createSignal<'none' | 'node'>('node');
+ const [sortKey, setSortKey] = createSignal<'priority' | 'name' | 'usage' | 'type'>('name');
+ const [sortDirection, setSortDirection] = createSignal<'asc' | 'desc'>('asc');
+ const [statusFilter, setStatusFilter] =
+ createSignal<'all' | 'warning' | 'critical'>('all');
+ const [sourceFilter, setSourceFilter] = createSignal('truenas');
+ const [sourceOptions, setSourceOptions] = createSignal([
+ { key: 'all', label: 'All Sources', tone: 'slate' as const },
+ ]);
+ const [selectedNodeId, setSelectedNodeId] = createSignal('all');
+
+ render(() => (
+ <StorageControls
+ view={view()}
+ onViewChange={setView}
+ search={search}
+ setSearch={setSearch}
+ groupBy={groupBy}
+ setGroupBy={setGroupBy}
+ sortKey={sortKey}
+ setSortKey={setSortKey}
+ sortDirection={sortDirection}
+ setSortDirection={setSortDirection}
+ statusFilter={statusFilter}
+ setStatusFilter={setStatusFilter}
+ sourceFilter={sourceFilter}
+ setSourceFilter={setSourceFilter}
+ sourceOptions={sourceOptions}
+ nodeFilterOptions={[{ value: 'all', label: 'All Nodes' }]}
+ selectedNodeId={selectedNodeId}
+ setSelectedNodeId={setSelectedNodeId}
+ />
+ ));
+
+ setSourceOptions([
+ { key: 'all', label: 'All Sources', tone: 'slate' as const },
+ { key: 'proxmox-pve', label: 'PVE', tone: 'orange' as const },
+ { key: 'truenas', label: 'TrueNAS', tone: 'blue' as const },
+ ]);
+
+ expect(
+ Array.from(screen.getByLabelText('Source').querySelectorAll('option')).map((option) => ({
+ value: option.value,
+ label: option.textContent,
+ })),
+ ).toEqual([
+ { value: 'all', label: 'All Sources' },
+ { value: 'proxmox-pve', label: 'PVE' },
+ { value: 'truenas', label: 'TrueNAS' },
+ ]);
+ await waitFor(() => {
+ expect(screen.getByLabelText('Source')).toHaveValue('truenas');
+ });
+ });
});
diff --git a/frontend-modern/src/components/Storage/__tests__/storageSourceOptions.test.ts b/frontend-modern/src/components/Storage/__tests__/storageSourceOptions.test.ts
index 0109a0e112..f1066273cf 100644
--- a/frontend-modern/src/components/Storage/__tests__/storageSourceOptions.test.ts
+++ b/frontend-modern/src/components/Storage/__tests__/storageSourceOptions.test.ts
@@ -73,8 +73,15 @@ describe('storageSourceOptions', () => {
label: 'PBS',
tone: 'indigo',
});
+ expect(getStorageSourceOption('truenas')).toMatchObject({
+ key: 'truenas',
+ label: 'TrueNAS',
+ tone: 'blue',
+ });
expect(
- buildStorageSourceOptionsFromKeys(['all', 'pbs', 'ceph']).map((option) => option.key),
- ).toEqual(['all', 'proxmox-pbs', 'ceph']);
+ buildStorageSourceOptionsFromKeys(['all', 'truenas', 'pbs', 'ceph']).map(
+ (option) => option.key,
+ ),
+ ).toEqual(['all', 'proxmox-pbs', 'ceph', 'truenas']);
});
});
diff --git a/frontend-modern/src/components/Storage/__tests__/useStorageFilterState.test.ts b/frontend-modern/src/components/Storage/__tests__/useStorageFilterState.test.ts
index 49fee255b2..23f08f6a02 100644
--- a/frontend-modern/src/components/Storage/__tests__/useStorageFilterState.test.ts
+++ b/frontend-modern/src/components/Storage/__tests__/useStorageFilterState.test.ts
@@ -15,7 +15,7 @@ describe('useStorageFilterState', () => {
{ id: 'node-2', label: 'tower' },
]);
const [selectedNodeId, setSelectedNodeId] = createSignal('node-1');
- const [sourceOptions] = createSignal(['all', 'proxmox-pve', 'agent']);
+ const [sourceOptions] = createSignal(['all', 'truenas', 'proxmox-pve', 'agent']);
const [healthFilter, setHealthFilter] = createSignal<'all' | NormalizedHealth>('all');
const [groupBy] = createSignal<StorageGroupKey>('node');
@@ -36,6 +36,7 @@ describe('useStorageFilterState', () => {
expect(result.sourceFilterOptions()).toEqual([
{ key: 'all', label: 'All Sources', tone: 'slate' },
{ key: 'proxmox-pve', label: 'PVE', tone: 'orange' },
+ { key: 'truenas', label: 'TrueNAS', tone: 'blue' },
{ key: 'agent', label: 'Agent', tone: 'slate' },
]);
expect(result.nodeFilterOptions()).toEqual([
diff --git a/frontend-modern/src/components/Storage/__tests__/useStorageFilterToolbarModel.test.ts b/frontend-modern/src/components/Storage/__tests__/useStorageFilterToolbarModel.test.ts
index cad4c40491..bab76584e2 100644
--- a/frontend-modern/src/components/Storage/__tests__/useStorageFilterToolbarModel.test.ts
+++ b/frontend-modern/src/components/Storage/__tests__/useStorageFilterToolbarModel.test.ts
@@ -48,4 +48,39 @@ describe('useStorageFilterToolbarModel', () => {
expect(statusFilter()).toBe('all');
expect(sourceFilter()).toBe('all');
});
+
+ it('keeps storage source options reactive for restored route state', () => {
+ const [search, setSearch] = createSignal('');
+ const [sortKey, setSortKey] = createSignal('priority');
+ const [sortDirection, setSortDirection] = createSignal<'asc' | 'desc'>('desc');
+ const [sourceOptions, setSourceOptions] = createSignal([
+ { key: 'all', label: 'All Sources', tone: 'slate' as const },
+ ]);
+
+ const { result } = renderHook(() =>
+ useStorageFilterToolbarModel({
+ search,
+ setSearch,
+ sortKey,
+ setSortKey,
+ sortDirection,
+ setSortDirection,
+ sourceOptions,
+ }),
+ );
+
+ expect(result.sourceOptions()).toEqual([{ key: 'all', label: 'All Sources', tone: 'slate' }]);
+
+ setSourceOptions([
+ { key: 'all', label: 'All Sources', tone: 'slate' },
+ { key: 'proxmox-pve', label: 'PVE', tone: 'orange' },
+ { key: 'truenas', label: 'TrueNAS', tone: 'blue' },
+ ]);
+
+ expect(result.sourceOptions()).toEqual([
+ { key: 'all', label: 'All Sources', tone: 'slate' },
+ { key: 'proxmox-pve', label: 'PVE', tone: 'orange' },
+ { key: 'truenas', label: 'TrueNAS', tone: 'blue' },
+ ]);
+ });
});
diff --git a/frontend-modern/src/components/Storage/useStorageFilterToolbarModel.ts b/frontend-modern/src/components/Storage/useStorageFilterToolbarModel.ts
index 7487ed60c0..b9af032692 100644
--- a/frontend-modern/src/components/Storage/useStorageFilterToolbarModel.ts
+++ b/frontend-modern/src/components/Storage/useStorageFilterToolbarModel.ts
@@ -31,7 +31,7 @@ type UseStorageFilterToolbarModelOptions = {
sourceFilter?: Accessor<string | undefined>;
setSourceFilter?: (value: string) => void;
sortOptions?: StorageOption[];
- sourceOptions?: StorageSourceOption[];
+ sourceOptions?: Accessor<StorageSourceOption[] | undefined>;
};
export const useStorageFilterToolbarModel = (options: UseStorageFilterToolbarModelOptions) => {
@@ -60,7 +60,9 @@ export const useStorageFilterToolbarModel = (options: UseStorageFilterToolbarMod
);
const sortOptions = createMemo(() => options.sortOptions ?? []);
- const sourceOptions = createMemo(() => options.sourceOptions ?? DEFAULT_STORAGE_SOURCE_OPTIONS);
+ const sourceOptions = createMemo(
+ () => options.sourceOptions?.() ?? DEFAULT_STORAGE_SOURCE_OPTIONS,
+ );
const sortDirectionTitle = createMemo(() =>
getStorageSortDirectionTitle(options.sortDirection()),
);
diff --git a/frontend-modern/src/features/storageBackups/__tests__/storageModelCore.test.ts b/frontend-modern/src/features/storageBackups/__tests__/storageModelCore.test.ts
index e2d1cd45f5..158a1f9bea 100644
--- a/frontend-modern/src/features/storageBackups/__tests__/storageModelCore.test.ts
+++ b/frontend-modern/src/features/storageBackups/__tests__/storageModelCore.test.ts
@@ -62,8 +62,23 @@ describe('storageModelCore', () => {
adapterId: 'resource-storage',
},
}),
+ makeRecord({
+ id: 'storage-3',
+ name: 'tank',
+ source: {
+ platform: 'truenas',
+ family: 'storage',
+ origin: 'resource',
+ adapterId: 'resource-storage',
+ },
+ }),
];
- expect(buildStorageSourceOptions(records)).toEqual(['all', 'proxmox-pbs', 'proxmox-pve']);
+ expect(buildStorageSourceOptions(records)).toEqual([
+ 'all',
+ 'proxmox-pve',
+ 'proxmox-pbs',
+ 'truenas',
+ ]);
expect(matchesStorageRecordSearch(makeRecord(), 'tank')).toBe(true);
expect(matchesStorageRecordSearch(makeRecord(), 'missing')).toBe(false);
});
diff --git a/frontend-modern/src/features/storageBackups/storageModelCore.ts b/frontend-modern/src/features/storageBackups/storageModelCore.ts
index 0400067eaf..4c82347c6b 100644
--- a/frontend-modern/src/features/storageBackups/storageModelCore.ts
+++ b/frontend-modern/src/features/storageBackups/storageModelCore.ts
@@ -1,6 +1,5 @@
import type { NormalizedHealth, StorageRecord } from './models';
-import { getSourcePlatformLabel } from '@/utils/sourcePlatforms';
-import { normalizeStorageSourceKey } from '@/utils/storageSources';
+import { normalizeStorageSourceKey, orderStorageSourceKeys } from '@/utils/storageSources';
import {
getStorageRecordActionSummary,
getStorageRecordContent,
@@ -75,9 +74,9 @@ export const matchesStorageRecordNode = (
};
export const buildStorageSourceOptions = (records: StorageRecord[]): string[] => {
- const values = Array.from(
- new Set(records.map((record) => normalizeStorageSourceKey(record.source.platform))),
- ).sort((a, b) => getSourcePlatformLabel(a).localeCompare(getSourcePlatformLabel(b)));
+ const values = orderStorageSourceKeys(
+ records.map((record) => normalizeStorageSourceKey(record.source.platform)),
+ ).filter((key) => key !== 'all');
return ['all', ...values];
};
diff --git a/frontend-modern/src/utils/storageSources.ts b/frontend-modern/src/utils/storageSources.ts
index 5d169f1b8e..a8dc37d320 100644
--- a/frontend-modern/src/utils/storageSources.ts
+++ b/frontend-modern/src/utils/storageSources.ts
@@ -2,7 +2,14 @@ import type { Storage } from '@/types/api';
import { getSourcePlatformLabel, normalizeSourcePlatformKey } from '@/utils/sourcePlatforms';
import { titleCaseDelimitedLabel } from '@/utils/textPresentation';
-export type StorageSourceTone = 'slate' | 'orange' | 'indigo' | 'rose' | 'violet' | 'cyan';
+export type StorageSourceTone =
+ | 'slate'
+ | 'orange'
+ | 'indigo'
+ | 'rose'
+ | 'violet'
+ | 'cyan'
+ | 'blue';
export interface StorageSourceOption {
key: string;
@@ -21,6 +28,7 @@ const STORAGE_SOURCE_TONES: Record<string, StorageSourceTone> = {
'proxmox-pbs': 'indigo',
'proxmox-pmg': 'rose',
ceph: 'violet',
+ truenas: 'blue',
kubernetes: 'cyan',
};
@@ -39,7 +47,14 @@ const PROXMOX_STORAGE_TYPES = new Set([
'btrfs',
]);
-const STORAGE_SOURCE_ORDER = ['proxmox-pve', 'proxmox-pbs', 'ceph', 'kubernetes', 'proxmox-pmg'];
+const STORAGE_SOURCE_ORDER = [
+ 'proxmox-pve',
+ 'proxmox-pbs',
+ 'ceph',
+ 'truenas',
+ 'kubernetes',
+ 'proxmox-pmg',
+];
const slugifySource = (value: string): string =>
value
@@ -131,7 +146,7 @@ export const buildStorageSourceOptionsFromKeys = (
};
export const DEFAULT_STORAGE_SOURCE_OPTIONS: StorageSourceOption[] =
- buildStorageSourceOptionsFromKeys(['proxmox-pve', 'proxmox-pbs', 'ceph']);
+ buildStorageSourceOptionsFromKeys(['proxmox-pve', 'proxmox-pbs', 'ceph', 'truenas']);
export const buildStorageSourceOptions = (storageList: Storage[]): StorageSourceOption[] =>
buildStorageSourceOptionsFromKeys(storageList.map((storage) => resolveStorageSourceKey(storage)));
diff --git a/tests/integration/tests/24-truenas-storage-source-filter.spec.ts b/tests/integration/tests/24-truenas-storage-source-filter.spec.ts
new file mode 100644
index 0000000000..6903968872
--- /dev/null
+++ b/tests/integration/tests/24-truenas-storage-source-filter.spec.ts
@@ -0,0 +1,210 @@
+import fs from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { test as base, expect } from '@playwright/test';
+import { createAuthenticatedStorageState } from './helpers';
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+
+type WorkerFixtures = {
+ authStorageStatePath: string;
+};
+
+const SCREENSHOT_PATH = '/tmp/truenas-storage-source-filter.png';
+
+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',
+ `truenas-storage-source-filter-${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.describe('TrueNAS storage source filter', () => {
+ test.setTimeout(180_000);
+
+ test('restores the canonical TrueNAS storage handoff on the storage route', async ({ page }) => {
+ await page.route('**/api/resources**', async (route) => {
+ const requestUrl = new URL(route.request().url());
+ if (requestUrl.pathname !== '/api/resources') {
+ await route.continue();
+ return;
+ }
+
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify({
+ data: [
+ {
+ id: 'truenas-main',
+ type: 'agent',
+ name: 'truenas-main',
+ displayName: 'TrueNAS Main',
+ platformId: 'truenas-main',
+ platformType: 'truenas',
+ sourceType: 'hybrid',
+ sources: ['agent', 'truenas'],
+ status: 'online',
+ lastSeen: '2026-03-29T22:00:00Z',
+ canonicalIdentity: {
+ displayName: 'TrueNAS Main',
+ hostname: 'truenas-main',
+ platformId: 'truenas-main',
+ },
+ agent: {
+ hostname: 'truenas-main',
+ platform: 'TrueNAS SCALE',
+ uptimeSeconds: 86400,
+ },
+ platformData: {
+ sources: ['agent', 'truenas'],
+ },
+ },
+ {
+ id: 'pve-main',
+ type: 'agent',
+ name: 'pve-main',
+ displayName: 'PVE Main',
+ platformId: 'pve-main',
+ platformType: 'proxmox-pve',
+ sourceType: 'hybrid',
+ sources: ['agent', 'proxmox-pve'],
+ status: 'online',
+ lastSeen: '2026-03-29T22:00:00Z',
+ canonicalIdentity: {
+ displayName: 'PVE Main',
+ hostname: 'pve-main',
+ platformId: 'pve-main',
+ },
+ agent: {
+ hostname: 'pve-main',
+ platform: 'Debian',
+ uptimeSeconds: 86400,
+ },
+ platformData: {
+ sources: ['agent', 'proxmox-pve'],
+ },
+ },
+ {
+ id: 'storage-truenas-display',
+ type: 'storage',
+ name: 'tank',
+ displayName: 'tank',
+ parentId: 'truenas-main',
+ parentName: 'truenas-main',
+ platformId: 'truenas-1',
+ platformType: 'truenas',
+ sourceType: 'api',
+ sources: ['truenas'],
+ status: 'online',
+ lastSeen: '2026-03-29T22:00:00Z',
+ canonicalIdentity: {
+ displayName: 'tank',
+ platformId: 'truenas-1',
+ },
+ metrics: {
+ disk: {
+ total: 2_000 * 1024 * 1024 * 1024,
+ used: 840 * 1024 * 1024 * 1024,
+ percent: 42,
+ },
+ },
+ storage: {
+ platform: 'truenas',
+ type: 'zfs-pool',
+ topology: 'pool',
+ isZfs: true,
+ },
+ platformData: {
+ sources: ['truenas'],
+ },
+ },
+ {
+ id: 'storage-pve-local',
+ type: 'storage',
+ name: 'local-zfs',
+ displayName: 'local-zfs',
+ parentId: 'pve-main',
+ parentName: 'pve-main',
+ platformId: 'cluster-a',
+ platformType: 'proxmox-pve',
+ sourceType: 'api',
+ sources: ['proxmox-pve'],
+ status: 'online',
+ lastSeen: '2026-03-29T22:00:00Z',
+ canonicalIdentity: {
+ displayName: 'local-zfs',
+ platformId: 'cluster-a',
+ },
+ metrics: {
+ disk: {
+ total: 1_000 * 1024 * 1024 * 1024,
+ used: 400 * 1024 * 1024 * 1024,
+ percent: 40,
+ },
+ },
+ storage: {
+ platform: 'proxmox-pve',
+ type: 'zfspool',
+ topology: 'pool',
+ isZfs: true,
+ },
+ platformData: {
+ node: 'pve-main',
+ sources: ['proxmox-pve'],
+ },
+ },
+ ],
+ meta: {
+ page: 1,
+ limit: 200,
+ total: 4,
+ totalPages: 1,
+ },
+ }),
+ });
+ });
+
+ await page.goto('/storage?source=truenas&node=truenas-main', {
+ waitUntil: 'domcontentloaded',
+ });
+
+ await expect(page).toHaveURL(/\/storage\?source=truenas&node=truenas-main/);
+ await expect(page.locator('#storage-source-filter')).toHaveValue('truenas');
+ await expect(page.getByLabel('Node')).toHaveValue('truenas-main');
+
+ const sourceOptions = await page.locator('#storage-source-filter option').evaluateAll((options) =>
+ options.map((option) => ({
+ value: option.getAttribute('value'),
+ label: option.textContent?.trim(),
+ })),
+ );
+ expect(sourceOptions).toEqual([
+ { value: 'all', label: 'All Sources' },
+ { value: 'proxmox-pve', label: 'PVE' },
+ { value: 'truenas', label: 'TrueNAS' },
+ ]);
+
+ const storageTable = page.locator('table').first();
+ await expect(storageTable).toContainText('tank');
+ await expect(storageTable).not.toContainText('local-zfs');
+
+ await page.screenshot({ path: SCREENSHOT_PATH, fullPage: true });
+ });
+});