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(infrastructure): add canonical truenas storage handoff

rcourtmanec81da63f2ad
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 4e413881f1..2bff7545bb 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -98,6 +98,7 @@ querying, and the operator-facing storage health presentation layer.
10. Letting explicit recovery `all` sentinels survive in canonical route state; shared recovery URLs must collapse case- or whitespace-variant `all` values for `cluster`, `node`, `namespace`, and `itemType` back to the canonical unset route state so copied links do not preserve fake active filters
11. Letting non-canonical recovery platform values survive in route or transport state; shared recovery URLs must collapse unsupported or fake `platform` values back to the canonical unset state, and only owned source-platform options or canonical legacy aliases may reach rollups, points, series, and facets transport filters
11a. Letting adjacent workload-route changes in shared `frontend-modern/src/routing/resourceLinks.ts` perturb recovery parse/build semantics; expanding canonical `/workloads` platform scoping must not alter the owned `/recovery` `platform` and `itemType` vocabulary, legacy alias rewrites, or recovery drill-down workspace selection
+11b. Letting adjacent storage-link additions in shared `frontend-modern/src/routing/resourceLinks.ts` perturb recovery route semantics; expanding canonical `/storage` deep links for unified resources must not reuse recovery-owned query names or alter the owned `/recovery` parse/build contract while those surfaces continue sharing the same route-helper module
12. Letting protected-item recovery outcome filtering fork from the canonical history status filter; the protected inventory status control must drive the same route-backed `status` field and the same rollups, points, series, and facets transport filters as the history surface instead of keeping a protected-only local outcome branch
13. Letting visible protected-item filters fall out of shared recovery links; the protected `Stale only` toggle must restore from the canonical recovery URL and rewrite to one owned `stale=1` route form instead of disappearing on refresh or copy/paste
14. Reintroducing stacked full-width recovery tables as the primary desktop layout; the governed recovery surface must expose one primary data region at a time with explicit protected-items versus recovery-events view switching so Pulse stays inventory-first for Proxmox operators without collapsing the page back into a single-platform backup screen
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index b48e25923f..9e7b2170f6 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -501,6 +501,15 @@ workload-to-infrastructure href builder used by dashboard row and drawer
consumers. Future workload-to-resource navigation changes must extend through
that shared routing contract instead of reintroducing dashboard-local path
builders.
+That same shared routing boundary now also owns storage deep links for unified
+resources. Infrastructure drawers and other cross-surface consumers must route
+storage-centric systems and exact storage resources through canonical
+`/storage` route state there, using owned `source`, `node`, and `resource`
+queries instead of rebuilding drawer-local storage paths or provider-local
+highlight rules. When a top-level system is a merged hybrid surface, that
+helper must resolve the deep-link source from the canonical merged source set
+before falling back to raw `platformType`, so TrueNAS-backed hybrid systems do
+not lose their storage handoff just because agent telemetry is also present.
That same routing contract now also owns canonical `/workloads` platform
scoping. Shared workloads links, dashboard URL-sync state, and infrastructure
drill-down helpers must preserve `platform=<owned-source-key>` for API-backed
@@ -774,6 +783,14 @@ The shared workloads-link helper now also uses that preferred-label helper
for Kubernetes-cluster navigation fallbacks, so drawer/table navigation
context stays inside the same governed resource-label boundary instead of
repeating a raw display-name fork.
+That same shared workloads-link path now also owns top-level TrueNAS system
+handoffs to the canonical app-container workloads route, so infrastructure
+drawers and related-link surfaces do not strand canonical `truenas` resources
+on infrastructure-only navigation while API-backed apps already exist in the
+shared workloads model. That same helper must also honor merged
+`agent`+`truenas` source sets for top-level systems, so hybrid TrueNAS
+surfaces keep the same workload handoff even when the resource shape presents
+through the canonical host path instead of a raw `type='truenas'` row.
The resource drawer's Kubernetes namespace and deployment tabs use the
canonical cluster-name helper for backend fetch keys, keeping lookup identity
separate from the governed display-label contract.
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.discovery.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.discovery.test.ts
index 870919ec60..c79951f0a1 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.discovery.test.ts
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.discovery.test.ts
@@ -248,7 +248,9 @@ describe('buildWorkloadsHref', () => {
},
};
- expect(buildWorkloadsHref(resource)).toBe('/workloads?type=pod&context=cluster-a');
+ expect(buildWorkloadsHref(resource)).toBe(
+ '/workloads?type=pod&platform=kubernetes&context=cluster-a',
+ );
});
it('builds k8s workload route for node resources using cluster context', () => {
@@ -266,7 +268,9 @@ describe('buildWorkloadsHref', () => {
},
};
- expect(buildWorkloadsHref(resource)).toBe('/workloads?type=pod&context=cluster-a');
+ expect(buildWorkloadsHref(resource)).toBe(
+ '/workloads?type=pod&platform=kubernetes&context=cluster-a',
+ );
});
it('returns null for non-kubernetes infrastructure resources', () => {
@@ -305,7 +309,9 @@ describe('buildWorkloadsHref', () => {
docker: { hostname: 'docker-host-1' },
},
};
- expect(buildWorkloadsHref(resource)).toBe('/workloads?type=app-container&agent=docker-host-1');
+ expect(buildWorkloadsHref(resource)).toBe(
+ '/workloads?type=app-container&platform=docker&agent=docker-host-1',
+ );
});
it('reuses the shared preferred hostname fallback for docker and agent workloads links', () => {
@@ -324,7 +330,7 @@ describe('buildWorkloadsHref', () => {
};
expect(buildWorkloadsHref(dockerResource)).toBe(
- '/workloads?type=app-container&agent=docker-agent-host.local',
+ '/workloads?type=app-container&platform=docker&agent=docker-agent-host.local',
);
const agentResource: Resource = {
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerOperationalModel.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerOperationalModel.test.ts
index 5fd56a9db8..2aa640c85d 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerOperationalModel.test.ts
+++ b/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerOperationalModel.test.ts
@@ -134,7 +134,7 @@ describe('resourceDetailDrawerOperationalModel', () => {
),
).toEqual([
{
- href: '/workloads?type=app-container&agent=agent-1',
+ href: '/workloads?type=app-container&platform=docker&agent=agent-1',
label: 'Open in Workloads',
compactLabel: 'Workloads',
ariaLabel: 'Open related workloads for Host 1',
@@ -142,6 +142,65 @@ describe('resourceDetailDrawerOperationalModel', () => {
]);
});
+ it('builds canonical workloads and storage links for top-level truenas systems', () => {
+ expect(
+ buildRelatedLinks(
+ baseResource({
+ id: 'truenas-main',
+ type: 'truenas',
+ name: 'truenas-main',
+ platformId: 'truenas-main',
+ platformType: 'truenas',
+ platformData: { sources: ['truenas'] },
+ }),
+ 'TrueNAS Main',
+ ),
+ ).toEqual([
+ {
+ href: '/workloads?type=app-container&platform=truenas&agent=truenas-main',
+ label: 'Open in Workloads',
+ compactLabel: 'Workloads',
+ ariaLabel: 'Open related workloads for TrueNAS Main',
+ },
+ {
+ href: '/storage?source=truenas&node=truenas-main',
+ label: 'Open in Storage',
+ compactLabel: 'Storage',
+ ariaLabel: 'Open related storage for TrueNAS Main',
+ },
+ ]);
+ });
+
+ it('builds canonical workloads and storage links for hybrid agent resources with merged truenas sources', () => {
+ expect(
+ buildRelatedLinks(
+ baseResource({
+ id: 'truenas-main',
+ type: 'agent',
+ name: 'truenas-main',
+ displayName: 'TrueNAS Main',
+ platformId: 'truenas-main',
+ platformType: 'agent',
+ platformData: { sources: ['agent', 'truenas'] },
+ }),
+ 'TrueNAS Main',
+ ),
+ ).toEqual([
+ {
+ href: '/workloads?type=app-container&platform=truenas&agent=truenas-main',
+ label: 'Open in Workloads',
+ compactLabel: 'Workloads',
+ ariaLabel: 'Open related workloads for TrueNAS Main',
+ },
+ {
+ href: '/storage?source=truenas&node=truenas-main',
+ label: 'Open in Storage',
+ compactLabel: 'Storage',
+ ariaLabel: 'Open related storage for TrueNAS Main',
+ },
+ ]);
+ });
+
it('omits generic host-wide workloads links from drawer quick links', () => {
expect(
buildRelatedLinks(
@@ -162,7 +221,7 @@ describe('resourceDetailDrawerOperationalModel', () => {
hasWebInterface: true,
links: [
{
- href: '/workloads?type=app-container&agent=agent-1',
+ href: '/workloads?type=app-container&platform=docker&agent=agent-1',
label: 'Open in Workloads',
compactLabel: 'Workloads',
ariaLabel: 'Open related workloads for Host 1',
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/workloadsLink.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/workloadsLink.test.ts
index a468fdad8a..c5be2c012f 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/workloadsLink.test.ts
+++ b/frontend-modern/src/components/Infrastructure/__tests__/workloadsLink.test.ts
@@ -343,6 +343,33 @@ describe('buildWorkloadsHref', () => {
'/workloads?type=app-container&platform=truenas&agent=truenas-main',
);
});
+
+ it('routes hybrid agent resources with merged truenas sources to platform-scoped app workloads', () => {
+ const resource = makeResource({
+ type: 'agent',
+ platformType: 'agent',
+ name: 'truenas-main',
+ platformData: {
+ sources: ['agent', 'truenas'],
+ },
+ });
+
+ expect(buildWorkloadsHref(resource)).toBe(
+ '/workloads?type=app-container&platform=truenas&agent=truenas-main',
+ );
+ });
+
+ it('routes top-level truenas resources to platform-scoped app workloads', () => {
+ const resource = makeResource({
+ type: 'truenas',
+ platformType: 'truenas',
+ name: 'truenas-main',
+ });
+
+ expect(buildWorkloadsHref(resource)).toBe(
+ '/workloads?type=app-container&platform=truenas&agent=truenas-main',
+ );
+ });
});
// ── Unsupported types ───────────────────────────────────────────
@@ -369,7 +396,6 @@ describe('buildWorkloadsHref', () => {
'dataset',
'physical_disk',
'ceph',
- 'truenas',
] as const)('returns null for %s', (type) => {
const resource = makeResource({ type } as Partial<Resource>);
expect(buildWorkloadsHref(resource)).toBeNull();
diff --git a/frontend-modern/src/components/Infrastructure/resourceDetailDrawerOperationalModel.ts b/frontend-modern/src/components/Infrastructure/resourceDetailDrawerOperationalModel.ts
index 06ab7578d7..05631e06a8 100644
--- a/frontend-modern/src/components/Infrastructure/resourceDetailDrawerOperationalModel.ts
+++ b/frontend-modern/src/components/Infrastructure/resourceDetailDrawerOperationalModel.ts
@@ -2,6 +2,7 @@ import type { Resource } from '@/types/resource';
import type { KubernetesMetricCapabilities, PlatformData } from './resourceDetailMappers';
import { buildServiceDetailLinks, type ServiceDetailLink } from './serviceDetailLinks';
import { buildWorkloadsHref } from './workloadsLink';
+import { buildStorageHrefForResource } from '@/routing/resourceLinks';
export type ResourceDetailDrawerOperationalBadge = {
label: string;
@@ -209,6 +210,15 @@ export const buildRelatedLinks = (
ariaLabel: `Open related workloads for ${displayName}`,
});
}
+ const storage = buildStorageHrefForResource(resource);
+ if (storage) {
+ links.push({
+ href: storage,
+ label: 'Open in Storage',
+ compactLabel: 'Storage',
+ ariaLabel: `Open related storage for ${displayName}`,
+ });
+ }
links.push(...buildServiceDetailLinks(resource));
const seen = new Set<string>();
diff --git a/frontend-modern/src/components/Infrastructure/workloadsLink.ts b/frontend-modern/src/components/Infrastructure/workloadsLink.ts
index ad2856eff1..11475c7dc0 100644
--- a/frontend-modern/src/components/Infrastructure/workloadsLink.ts
+++ b/frontend-modern/src/components/Infrastructure/workloadsLink.ts
@@ -2,6 +2,7 @@ import type { Resource } from '@/types/resource';
import { buildWorkloadsPath } from '@/routing/resourceLinks';
import {
getActionableDockerRuntimeIdFromResource,
+ getPlatformDataRecord,
hasDockerWorkloadsScope,
} from '@/utils/agentResources';
import {
@@ -10,6 +11,7 @@ import {
getPreferredResourceKubernetesContext,
} from '@/utils/resourceIdentity';
import { requiresGovernedResourceDisplay } from '@/types/resource';
+import { normalizeSourcePlatformKey } from '@/utils/sourcePlatforms';
const firstNonEmpty = (values: Array<string | undefined | null>): string | undefined => {
for (const value of values) {
@@ -44,6 +46,12 @@ const resolveHostHint = (resource: Resource): string | undefined => {
const resolveDockerWorkloadsHint = (resource: Resource): string | undefined =>
getActionableDockerRuntimeIdFromResource(resource) || resolveHostHint(resource);
+const hasMergedSource = (resource: Resource, source: string): boolean => {
+ const platformData = getPlatformDataRecord(resource);
+ const mergedSources = Array.isArray(platformData?.sources) ? platformData.sources : [];
+ return mergedSources.some((value) => normalizeSourcePlatformKey(value) === source);
+};
+
export const buildWorkloadsHref = (resource: Resource): string | null => {
if (resource.type === 'k8s-cluster' || resource.type === 'k8s-node') {
const context = resolveKubernetesContext(resource);
@@ -55,9 +63,14 @@ export const buildWorkloadsHref = (resource: Resource): string | null => {
return buildWorkloadsPath({ type: 'app-container', platform: 'docker', agent });
}
+ if (resource.type === 'truenas') {
+ const agent = resolveHostHint(resource);
+ return buildWorkloadsPath({ type: 'app-container', platform: 'truenas', agent });
+ }
+
if (resource.type === 'agent') {
const agent = resolveHostHint(resource);
- if (resource.platformType === 'truenas') {
+ if (resource.platformType === 'truenas' || hasMergedSource(resource, 'truenas')) {
return buildWorkloadsPath({ type: 'app-container', platform: 'truenas', agent });
}
if (hasDockerWorkloadsScope(resource)) {
diff --git a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
index 9b19f43fc4..10337e3e4f 100644
--- a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
+++ b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
@@ -7,6 +7,7 @@ import {
buildRecoveryPath,
buildInfrastructurePath,
buildInfrastructureResourceHref,
+ buildStorageHrefForResource,
buildStoragePath,
buildWorkloadsPath,
parseRecoveryLinkSearch,
@@ -217,6 +218,58 @@ describe('resource link routing contract', () => {
expect(STORAGE_QUERY_PARAMS.order).toBe('order');
});
+ it('builds storage deep links for exact TrueNAS storage resources', () => {
+ const href = buildStorageHrefForResource({
+ id: 'storage-truenas-display',
+ type: 'storage',
+ name: 'tank',
+ displayName: 'tank',
+ platformId: 'truenas-1',
+ platformType: 'truenas',
+ sourceType: 'api',
+ status: 'online',
+ lastSeen: Date.now(),
+ storage: { platform: 'truenas', type: 'zfs-pool' },
+ } as any);
+
+ expect(href).toBe('/storage?source=truenas&resource=storage-truenas-display');
+ });
+
+ it('builds storage deep links for top-level TrueNAS systems', () => {
+ const href = buildStorageHrefForResource({
+ id: 'truenas-main',
+ type: 'truenas',
+ name: 'truenas-main',
+ displayName: 'TrueNAS Main',
+ platformId: 'truenas-main',
+ platformType: 'truenas',
+ sourceType: 'hybrid',
+ status: 'online',
+ lastSeen: Date.now(),
+ } as any);
+
+ expect(href).toBe('/storage?source=truenas&node=truenas-main');
+ });
+
+ it('builds storage deep links for hybrid agent resources with merged truenas sources', () => {
+ const href = buildStorageHrefForResource({
+ id: 'truenas-main',
+ type: 'agent',
+ name: 'truenas-main',
+ displayName: 'TrueNAS Main',
+ platformId: 'truenas-main',
+ platformType: 'agent',
+ sourceType: 'hybrid',
+ status: 'online',
+ lastSeen: Date.now(),
+ platformData: {
+ sources: ['agent', 'truenas'],
+ },
+ } as any);
+
+ expect(href).toBe('/storage?source=truenas&node=truenas-main');
+ });
+
it('canonicalizes legacy storage source aliases when parsing links', () => {
expect(parseStorageLinkSearch('?source=pbs')).toMatchObject({ source: 'proxmox-pbs' });
expect(parseStorageLinkSearch('?source=proxmox')).toMatchObject({ source: 'proxmox-pve' });
diff --git a/frontend-modern/src/routing/resourceLinks.ts b/frontend-modern/src/routing/resourceLinks.ts
index 99699eea53..c07a321a52 100644
--- a/frontend-modern/src/routing/resourceLinks.ts
+++ b/frontend-modern/src/routing/resourceLinks.ts
@@ -1,4 +1,7 @@
-import { normalizeSourcePlatformQueryValue } from '@/utils/sourcePlatforms';
+import {
+ normalizeSourcePlatformQueryValue,
+ resolvePlatformTypeFromSources,
+} from '@/utils/sourcePlatforms';
import { normalizeStorageSourceKey } from '@/utils/storageSources';
import { normalizeRecoveryItemTypeQueryValue } from '@/utils/recoveryItemTypePresentation';
import {
@@ -6,6 +9,7 @@ import {
resolveWorkloadType,
} from '@/utils/workloads';
import type { WorkloadGuest } from '@/types/workloads';
+import type { Resource } from '@/types/resource';
export const WORKLOADS_QUERY_PARAMS = {
type: 'type',
@@ -221,6 +225,44 @@ export const buildInfrastructureHrefForWorkload = (guest: WorkloadGuest): string
return buildInfrastructurePath();
};
+const resolveStorageRouteSource = (resource: Resource): string => {
+ const mergedPlatform = Array.isArray(resource.platformData?.sources)
+ ? resolvePlatformTypeFromSources(resource.platformData.sources)
+ : undefined;
+
+ return normalizeStorageSourceKey(
+ resource.storage?.platform || mergedPlatform || resource.platformType || resource.type,
+ );
+};
+
+export const buildStorageHrefForResource = (resource: Resource): string | null => {
+ const source = resolveStorageRouteSource(resource);
+ if (!source || source === 'all') return null;
+
+ if (resource.type === 'storage' || resource.type === 'datastore') {
+ return buildStoragePath({
+ source,
+ resource: resource.id,
+ });
+ }
+
+ if (resource.type === 'truenas' || resource.type === 'pbs') {
+ return buildStoragePath({
+ source,
+ node: resource.id,
+ });
+ }
+
+ if (resource.type === 'agent' && source === 'truenas') {
+ return buildStoragePath({
+ source,
+ node: resource.id,
+ });
+ }
+
+ return null;
+};
+
export const parseStorageLinkSearch = (search: string) => {
const params = new URLSearchParams(search);
return {
diff --git a/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts b/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts
index 914a708e9f..1efbfa5e02 100644
--- a/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts
+++ b/frontend-modern/src/utils/__tests__/resourceIdentity.test.ts
@@ -539,5 +539,19 @@ describe('resourceIdentity', () => {
}),
),
).toBe('pve1');
+
+ expect(
+ getPreferredWorkloadsAgentHint(
+ makeResource({
+ type: 'truenas',
+ platformType: 'truenas',
+ id: 'truenas-id',
+ identity: { hostname: 'identity-host' },
+ platformData: {
+ truenas: { hostname: 'truenas-main' },
+ },
+ }),
+ ),
+ ).toBe('truenas-main');
});
});
diff --git a/frontend-modern/src/utils/resourceIdentity.ts b/frontend-modern/src/utils/resourceIdentity.ts
index 24978ebd80..affe51f870 100644
--- a/frontend-modern/src/utils/resourceIdentity.ts
+++ b/frontend-modern/src/utils/resourceIdentity.ts
@@ -366,6 +366,7 @@ export const getPreferredWorkloadsAgentHint = (resource: Resource): string | und
const platformData = getPlatformDataRecord(resource);
const proxmox = platformData?.proxmox as Record<string, unknown> | undefined;
const docker = platformData?.docker as Record<string, unknown> | undefined;
+ const truenas = platformData?.truenas as Record<string, unknown> | undefined;
if (resource.type === 'docker-host') {
return (
@@ -373,6 +374,12 @@ export const getPreferredWorkloadsAgentHint = (resource: Resource): string | und
);
}
+ if (resource.type === 'truenas') {
+ return (
+ asTrimmedString(truenas?.hostname) || getPreferredResourceHostname(resource) || resource.id
+ );
+ }
+
if (resource.type === 'agent') {
return (
asTrimmedString(proxmox?.nodeName) || getPreferredResourceHostname(resource) || resource.id
diff --git a/tests/integration/tests/23-truenas-infrastructure-storage-links.spec.ts b/tests/integration/tests/23-truenas-infrastructure-storage-links.spec.ts
new file mode 100644
index 0000000000..2e87fd2e00
--- /dev/null
+++ b/tests/integration/tests/23-truenas-infrastructure-storage-links.spec.ts
@@ -0,0 +1,154 @@
+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-infrastructure-storage-links.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-infrastructure-storage-links-${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 infrastructure storage links', () => {
+ test.setTimeout(180_000);
+
+ test('surfaces canonical workloads and storage links for top-level TrueNAS systems', async ({
+ page,
+ }) => {
+ await page.route('**/api/resources**', async (route) => {
+ const requestUrl = new URL(route.request().url());
+
+ if (requestUrl.pathname === '/api/resources') {
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify({
+ data: [
+ {
+ id: 'truenas-main',
+ type: 'truenas',
+ 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',
+ },
+ platformData: {
+ sources: ['agent', 'truenas'],
+ },
+ },
+ {
+ 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',
+ },
+ storage: {
+ platform: 'truenas',
+ type: 'zfs-pool',
+ topology: 'pool',
+ },
+ platformData: {
+ sources: ['truenas'],
+ },
+ },
+ ],
+ meta: {
+ page: 1,
+ limit: 200,
+ total: 2,
+ totalPages: 1,
+ },
+ }),
+ });
+ return;
+ }
+
+ if (requestUrl.pathname === '/api/resources/truenas-main/facets') {
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify({
+ recentChanges: [],
+ counts: {
+ recentChanges: 0,
+ },
+ }),
+ });
+ return;
+ }
+
+ await route.continue();
+ });
+
+ await page.goto('/infrastructure?source=truenas&resource=truenas-main', {
+ waitUntil: 'domcontentloaded',
+ });
+
+ await expect(page).toHaveURL(/\/infrastructure\?source=truenas&resource=truenas-main/);
+ await expect(page.getByTestId('infrastructure-page')).toBeVisible();
+ await page.getByRole('button', { name: 'List' }).click();
+
+ const showAccessButton = page.getByRole('button', { name: 'Show access' });
+ await expect(showAccessButton).toBeVisible();
+ await showAccessButton.click();
+
+ const workloadsLink = page.getByRole('link', { name: 'Open related workloads for TrueNAS Main' });
+ const storageLink = page.getByRole('link', { name: 'Open related storage for TrueNAS Main' });
+
+ await expect(workloadsLink).toHaveAttribute(
+ 'href',
+ '/workloads?type=app-container&platform=truenas&agent=truenas-main',
+ );
+ await expect(storageLink).toHaveAttribute(
+ 'href',
+ '/storage?source=truenas&node=truenas-main',
+ );
+
+ await page.screenshot({ path: SCREENSHOT_PATH, fullPage: true });
+ });
+});