Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix(workloads): keep canonical app-container identity

rcourtman4b6cc07bfe64
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 581dbeab89..ce9ae0c1c0 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -152,7 +152,7 @@ regression protection.
10. Extend dashboard drawer derivations and runtime wiring through `frontend-modern/src/components/Dashboard/guestDrawerModel.ts` and `frontend-modern/src/components/Dashboard/useGuestDrawerState.ts`, and extend drawer overview rendering through `frontend-modern/src/components/Dashboard/GuestDrawerOverview.tsx`, rather than rebuilding canonical guest identity, discovery routing, or drawer-local normalization inside `frontend-modern/src/components/Dashboard/GuestDrawer.tsx`
11. Extend dashboard disk-list derivations and fallback runtime wiring through `frontend-modern/src/components/Dashboard/diskListModel.ts` and `frontend-modern/src/components/Dashboard/useDiskListState.ts` rather than rebuilding usage math, progress-state mapping, or tooltip fallback logic inside `frontend-modern/src/components/Dashboard/DiskList.tsx`
12. Extend dashboard guest metadata cache persistence, metadata refresh, org-scope switching, and optimistic custom-URL updates through `frontend-modern/src/components/Dashboard/useDashboardGuestMetadataState.ts` rather than rebuilding dashboard-local storage caches, event listeners, or guest metadata API wiring inside `frontend-modern/src/components/Dashboard/useDashboardState.ts`
-13. Extend dashboard deep-link selection and hovered-row continuity semantics through `frontend-modern/src/components/Dashboard/dashboardSelectionModel.ts`, and extend table scroll preservation plus reactive selection state through `frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts`, rather than rebuilding resource-query parsing, selected-row scroll pinning, or hovered-row invalidation inside `frontend-modern/src/components/Dashboard/useDashboardState.ts`
+13. Extend dashboard deep-link selection and hovered-row continuity semantics through `frontend-modern/src/components/Dashboard/dashboardSelectionModel.ts`, and extend table scroll preservation plus reactive selection state through `frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts`, rather than rebuilding resource-query parsing, selected-row scroll pinning, or hovered-row invalidation inside `frontend-modern/src/components/Dashboard/useDashboardState.ts`; canonical typed workload IDs such as `app-container:<host>:<provider-id>` must remain exact route/selection keys and must not be reinterpreted into synthetic node scopes
14. Extend dashboard workload route ownership, route-driven option catalogs, and toolbar filter config through `frontend-modern/src/components/Dashboard/useDashboardWorkloadRouteState.ts`, `frontend-modern/src/components/Dashboard/useDashboardWorkloadFilterOptions.ts`, `frontend-modern/src/components/Dashboard/dashboardWorkloadRouteModel.ts`, `frontend-modern/src/components/Dashboard/dashboardWorkloadFilterConfigModel.ts`, and `frontend-modern/src/components/Dashboard/dashboardWorkloadRouteStateModel.ts`, and extend query-param synchronization plus managed workload URL semantics through `frontend-modern/src/components/Dashboard/useDashboardWorkloadUrlSync.ts` and `frontend-modern/src/components/Dashboard/dashboardWorkloadUrlSyncModel.ts`, rather than rebuilding route sync, alias parsing, option derivation, toolbar callback/config wiring, reset policy, node-selection compatibility rules, param precedence, or managed workload URLs inside `frontend-modern/src/components/Dashboard/useDashboardState.ts`
15. Extend grouped dashboard workload derivation, summary fallbacks, and grouped/windowed table presentation through `frontend-modern/src/components/Dashboard/useDashboardWorkloadDerivedState.ts`, extend viewport-driven grouped table synchronization through `frontend-modern/src/components/Dashboard/useDashboardWorkloadViewportSync.ts`, and extend node parent mapping through `frontend-modern/src/components/Dashboard/workloadTopology.ts`, rather than rebuilding grouped selectors, summary snapshot math, scroll listeners, or topology lookups inside `frontend-modern/src/components/Dashboard/useDashboardState.ts`
16. Extend dashboard control defaults, persistent view preferences, keyboard reset behavior, column-visibility ownership, and tag-search flow through `frontend-modern/src/components/Dashboard/useDashboardControlsState.ts` and `frontend-modern/src/components/Dashboard/dashboardFilterModel.ts` rather than rebuilding sort/search/grouping state, reset drift, or column-toggle plumbing inside `frontend-modern/src/components/Dashboard/useDashboardState.ts`
@@ -252,6 +252,14 @@ generic app-container host path for discovery and navigation while keeping
Docker runtime action identifiers explicit. TrueNAS app-containers may reuse
runtime metadata such as image and runtime strings, but they must not inherit
Docker-only update affordances or fallback host IDs on the dashboard row path.
+That same row-and-selection boundary also requires canonical app-container
+identity to stay intact on the workload surface. `/workloads` rows, deep links,
+drawer selection, anomaly correlation, and route-owned filters must key on the
+unified resource ID such as `app-container:truenas-main:nextcloud`, while
+Docker-native runtime IDs stay in a separate action-only field for Docker
+controls like image updates. Performance work must not collapse API-backed
+platforms back onto runtime-native container IDs or derive fake node scopes
+from typed canonical resource IDs.
The shared infrastructure table hot path now also treats operator-facing
resource identity as a protected boundary: sorting, searching, summary-series
matching, and row titles on the infrastructure page must use the canonical
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 7053b74919..c3c5e28c94 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -821,6 +821,13 @@ separate from the governed display-label contract.
The shared workloads projection in `useWorkloads` also uses that helper for
pod context labels, so dashboard Kubernetes grouping follows the same
canonical cluster-name contract instead of re-encoding the fallback locally.
+That same shared workloads projection now also owns canonical app-container
+identity on the `/workloads` surface. Frontend workload records must keep the
+unified resource `id` intact for drawer selection, deep links, anomalies, and
+discovery, while Docker-native action fields such as `containerId` stay
+separate and are only consumed by Docker-specific controls. API-backed
+platforms such as TrueNAS must not regress that path back to runtime-native
+container ids just because they expose Docker-compatible runtime metadata.
The drawer's discovery mapper also reuses that helper for pod fallback agent
IDs, so the resource-detail path and the dashboard path stay aligned on the
same cluster-name source of truth.
diff --git a/frontend-modern/src/components/Dashboard/GuestRow.tsx b/frontend-modern/src/components/Dashboard/GuestRow.tsx
index 8b262b74f6..bbce639f2a 100644
--- a/frontend-modern/src/components/Dashboard/GuestRow.tsx
+++ b/frontend-modern/src/components/Dashboard/GuestRow.tsx
@@ -534,7 +534,7 @@ export function GuestRow(props: GuestRowProps) {
<UpdateButton
updateStatus={props.guest.updateStatus}
agentId={dockerHostId()}
- containerId={props.guest.id ?? ''}
+ containerId={props.guest.containerId ?? ''}
containerName={props.guest.name}
compact={true}
/>
diff --git a/frontend-modern/src/components/Dashboard/__tests__/GuestRow.test.tsx b/frontend-modern/src/components/Dashboard/__tests__/GuestRow.test.tsx
index 869068001d..1d4dab670b 100644
--- a/frontend-modern/src/components/Dashboard/__tests__/GuestRow.test.tsx
+++ b/frontend-modern/src/components/Dashboard/__tests__/GuestRow.test.tsx
@@ -13,6 +13,7 @@ const { isMobileMock } = vi.hoisted(() => {
// ── Module mocks ───────────────────────────────────────────────────────
const mockNavigate = vi.fn();
+const updateButtonSpy = vi.fn();
vi.mock('@solidjs/router', () => ({
useNavigate: () => mockNavigate,
@@ -88,7 +89,10 @@ vi.mock('@/components/shared/TagBadges', () => ({
}));
vi.mock('@/components/shared/ContainerUpdateBadge', () => ({
- UpdateButton: () => <div data-testid="update-button" />,
+ UpdateButton: (props: { agentId: string; containerId: string; containerName: string }) => {
+ updateButtonSpy(props);
+ return <div data-testid="update-button" />;
+ },
}));
vi.mock('@/components/shared/workloadTypeBadges', () => ({
@@ -964,6 +968,10 @@ describe('event propagation', () => {
});
describe('app-container update button visibility', () => {
+ afterEach(() => {
+ updateButtonSpy.mockReset();
+ });
+
it('does not show update button when dockerHostId is missing', () => {
renderGuestRow({
guest: makeGuest({
@@ -979,14 +987,24 @@ describe('app-container update button visibility', () => {
it('shows update button when dockerHostId is present', () => {
renderGuestRow({
guest: makeGuest({
+ id: 'app-container:docker-main:grafana',
type: 'app-container',
workloadType: 'app-container',
platformType: 'docker',
dockerHostId: 'host-1',
+ containerId: 'docker-grafana',
+ name: 'grafana',
}),
visibleColumnIds: ['name', 'update'],
});
expect(screen.getByTestId('update-button')).toBeTruthy();
+ expect(updateButtonSpy).toHaveBeenCalledWith(
+ expect.objectContaining({
+ agentId: 'host-1',
+ containerId: 'docker-grafana',
+ containerName: 'grafana',
+ }),
+ );
});
it('does not show Docker update button for TrueNAS app containers', () => {
diff --git a/frontend-modern/src/components/Dashboard/__tests__/dashboardSelectionModel.test.ts b/frontend-modern/src/components/Dashboard/__tests__/dashboardSelectionModel.test.ts
index 6f1a164f84..9f58138745 100644
--- a/frontend-modern/src/components/Dashboard/__tests__/dashboardSelectionModel.test.ts
+++ b/frontend-modern/src/components/Dashboard/__tests__/dashboardSelectionModel.test.ts
@@ -13,6 +13,20 @@ describe('dashboardSelectionModel', () => {
resourceId: 'cluster-a:node-1:101',
selectedNode: 'cluster-a-node-1',
});
+ expect(
+ resolveDashboardResourceSelection(
+ '?type=app-container&resource=app-container:truenas-main:nextcloud',
+ ),
+ ).toEqual({
+ resourceId: 'app-container:truenas-main:nextcloud',
+ selectedNode: null,
+ });
+ expect(
+ resolveDashboardResourceSelection('?resource=app-container:docker-main:container-123'),
+ ).toEqual({
+ resourceId: 'app-container:docker-main:container-123',
+ selectedNode: null,
+ });
expect(resolveDashboardResourceSelection('?resource=guest-1')).toEqual({
resourceId: 'guest-1',
selectedNode: null,
diff --git a/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts b/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts
index 35b08af66e..1be91a0d7a 100644
--- a/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts
+++ b/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts
@@ -71,4 +71,21 @@ describe('useDashboardSelectionState', () => {
setFilteredGuests([]);
expect(result.hoveredWorkloadId()).toBeNull();
});
+
+ it('does not invent node filters for canonical app-container deep links', () => {
+ locationSearch = '?type=app-container&resource=app-container:truenas-main:nextcloud';
+ const [filteredGuests] = createSignal<WorkloadGuest[]>([]);
+ const setSelectedNode = vi.fn();
+
+ const { result } = renderHook(() =>
+ useDashboardSelectionState({
+ filteredGuests,
+ setSelectedNode,
+ }),
+ );
+
+ expect(result.selectedGuestId()).toBe('app-container:truenas-main:nextcloud');
+ expect(setSelectedNode).not.toHaveBeenCalled();
+ expect(resolveDashboardResourceSelection(locationSearch)?.selectedNode).toBeNull();
+ });
});
diff --git a/frontend-modern/src/components/Dashboard/__tests__/workloadTopology.test.ts b/frontend-modern/src/components/Dashboard/__tests__/workloadTopology.test.ts
index b8941ae034..a3dcfd043f 100644
--- a/frontend-modern/src/components/Dashboard/__tests__/workloadTopology.test.ts
+++ b/frontend-modern/src/components/Dashboard/__tests__/workloadTopology.test.ts
@@ -166,14 +166,15 @@ describe('workloadTopology', () => {
it('maps discovery host and resource IDs for app-container, pod, and vm', () => {
const docker = makeGuest(1, {
- id: 'container-abc123',
+ id: 'app-container:docker-host-1:container-abc123',
type: 'app-container',
workloadType: 'app-container',
platformType: 'docker',
dockerHostId: 'docker-host-1',
+ containerId: 'container-abc123',
});
const truenas = makeGuest(2, {
- id: 'ix-nextcloud',
+ id: 'app-container:truenas-main:nextcloud',
type: 'app-container',
workloadType: 'app-container',
platformType: 'truenas',
@@ -198,9 +199,13 @@ describe('workloadTopology', () => {
});
expect(getDiscoveryHostIdForWorkload(docker)).toBe('docker-host-1');
- expect(getDiscoveryResourceIdForWorkload(docker)).toBe('container-abc123');
+ expect(getDiscoveryResourceIdForWorkload(docker)).toBe(
+ 'app-container:docker-host-1:container-abc123',
+ );
expect(getDiscoveryHostIdForWorkload(truenas)).toBe('truenas-main');
- expect(getDiscoveryResourceIdForWorkload(truenas)).toBe('ix-nextcloud');
+ expect(getDiscoveryResourceIdForWorkload(truenas)).toBe(
+ 'app-container:truenas-main:nextcloud',
+ );
expect(getDiscoveryHostIdForWorkload(k8s)).toBe('k8s-agent-1');
expect(getDiscoveryResourceIdForWorkload(k8s)).toBe('pod-uid-1');
diff --git a/frontend-modern/src/components/Dashboard/dashboardSelectionModel.ts b/frontend-modern/src/components/Dashboard/dashboardSelectionModel.ts
index 4136b3d9bb..447782ed7f 100644
--- a/frontend-modern/src/components/Dashboard/dashboardSelectionModel.ts
+++ b/frontend-modern/src/components/Dashboard/dashboardSelectionModel.ts
@@ -1,6 +1,6 @@
import { parseWorkloadsLinkSearch } from '@/routing/resourceLinks';
import type { WorkloadGuest } from '@/types/workloads';
-import { getCanonicalWorkloadId } from '@/utils/workloads';
+import { getCanonicalWorkloadId, normalizeWorkloadViewModeParam } from '@/utils/workloads';
export interface DashboardResourceSelection {
resourceId: string;
@@ -10,11 +10,20 @@ export interface DashboardResourceSelection {
export const resolveDashboardResourceSelection = (
search: string,
): DashboardResourceSelection | null => {
- const { resource: resourceId } = parseWorkloadsLinkSearch(search);
+ const { resource: resourceId, type } = parseWorkloadsLinkSearch(search);
if (!resourceId) return null;
- const [instance, node, vmid] = resourceId.split(':');
- const selectedNode = instance && node && vmid ? `${instance}-${node}` : null;
+ const normalizedViewMode = normalizeWorkloadViewModeParam(type || '');
+ const [firstSegment] = resourceId.split(':');
+ const structuredResourceType = normalizeWorkloadViewModeParam(firstSegment || '');
+ const legacyScopedMatch =
+ normalizedViewMode !== 'app-container' &&
+ normalizedViewMode !== 'pod' &&
+ structuredResourceType !== 'app-container' &&
+ structuredResourceType !== 'pod'
+ ? resourceId.match(/^([^:]+):([^:]+):(\d+)$/)
+ : null;
+ const selectedNode = legacyScopedMatch ? `${legacyScopedMatch[1]}-${legacyScopedMatch[2]}` : null;
return {
resourceId,
diff --git a/frontend-modern/src/hooks/__tests__/useWorkloads.test.ts b/frontend-modern/src/hooks/__tests__/useWorkloads.test.ts
index 63acbf61cd..b5d2c871a2 100644
--- a/frontend-modern/src/hooks/__tests__/useWorkloads.test.ts
+++ b/frontend-modern/src/hooks/__tests__/useWorkloads.test.ts
@@ -139,7 +139,7 @@ describe('useWorkloads', () => {
{ ...sampleResource, id: 'vm-pmg', sources: ['pmg'], name: 'vm-pmg' },
{
...sampleResource,
- id: 'truenas-nextcloud',
+ id: 'app-container:truenas-main:nextcloud',
type: 'app-container',
name: 'nextcloud',
status: 'healthy',
@@ -170,6 +170,8 @@ describe('useWorkloads', () => {
expect(byName.get('vm-pbs')?.platformType).toBe('proxmox-pbs');
expect(byName.get('vm-pmg')?.platformType).toBe('proxmox-pmg');
expect(byName.get('nextcloud')?.platformType).toBe('truenas');
+ expect(byName.get('nextcloud')?.id).toBe('app-container:truenas-main:nextcloud');
+ expect(byName.get('nextcloud')?.containerId).toBe('nextcloud-ctr');
expect(byName.get('nextcloud')?.dockerHostId).toBeUndefined();
dispose();
diff --git a/frontend-modern/src/hooks/useWorkloads.ts b/frontend-modern/src/hooks/useWorkloads.ts
index 52ca0eb31f..1c909a3722 100644
--- a/frontend-modern/src/hooks/useWorkloads.ts
+++ b/frontend-modern/src/hooks/useWorkloads.ts
@@ -319,8 +319,13 @@ const mapResourceToWorkload = (resource: APIResource): WorkloadGuest | null => {
const cpuPercent = resource.metrics?.cpu?.percent ?? resource.metrics?.cpu?.value ?? 0;
- // For Proxmox guests, use the metrics API guest ID format (instance:node:vmid)
- // so sparklines resolve to the backend's chart keys.
+ const appContainerRuntimeId =
+ workloadType === 'app-container' ? (resource.docker?.containerId || '').trim() : '';
+
+ // Keep workload identity on the canonical unified resource id. Platform-native
+ // runtime ids such as Docker container ids must stay separate so workload
+ // routing, discovery, anomalies, and drawer selection align with the shared
+ // resource model.
const guestId = (() => {
if (
(workloadType === 'vm' || workloadType === 'system-container') &&
@@ -330,9 +335,6 @@ const mapResourceToWorkload = (resource: APIResource): WorkloadGuest | null => {
) {
return `${instance}:${node}:${vmid}`;
}
- if (workloadType === 'app-container') {
- return resource.docker?.containerId || resource.id;
- }
if (workloadType === 'pod') {
const clusterId = resource.kubernetes?.clusterId;
const podUid = resource.kubernetes?.podUid;
@@ -401,6 +403,7 @@ const mapResourceToWorkload = (resource: APIResource): WorkloadGuest | null => {
osTemplate: undefined,
workloadType,
displayId,
+ containerId: appContainerRuntimeId || undefined,
image:
workloadType === 'app-container'
? resource.docker?.image || resource.docker?.imageName || resource.docker?.imageRef
diff --git a/frontend-modern/src/types/workloads.ts b/frontend-modern/src/types/workloads.ts
index 3bd7fbbdd1..a5d58266ca 100644
--- a/frontend-modern/src/types/workloads.ts
+++ b/frontend-modern/src/types/workloads.ts
@@ -7,6 +7,9 @@ export type WorkloadGuest = (VM | Container) & {
workloadType?: WorkloadType;
displayId?: string;
image?: string;
+ // Provider/runtime-native identifier for app-container actions such as Docker image updates.
+ // Canonical workload identity remains `id`.
+ containerId?: string;
namespace?: string;
contextLabel?: string;
/** Cluster name from Proxmox (for badge display in workloads table). */
diff --git a/frontend-modern/src/utils/__tests__/workloads.test.ts b/frontend-modern/src/utils/__tests__/workloads.test.ts
index ec82df3b90..4072ae0ad2 100644
--- a/frontend-modern/src/utils/__tests__/workloads.test.ts
+++ b/frontend-modern/src/utils/__tests__/workloads.test.ts
@@ -168,14 +168,14 @@ describe('getCanonicalWorkloadId', () => {
it('returns id for app-container workloads (no instance/node/vmid)', () => {
const guest = {
- id: 'docker-123',
+ id: 'app-container:docker-main:container-123',
type: 'docker',
workloadType: 'app-container' as const,
instance: '',
node: '',
vmid: 0,
};
- expect(getCanonicalWorkloadId(guest)).toBe('docker-123');
+ expect(getCanonicalWorkloadId(guest)).toBe('app-container:docker-main:container-123');
});
it('returns id for pod workloads (no instance/node/vmid)', () => {
diff --git a/tests/integration/tests/22-truenas-workloads-platform-filter.spec.ts b/tests/integration/tests/22-truenas-workloads-platform-filter.spec.ts
index b8a4c1ee0f..7f34940aa2 100644
--- a/tests/integration/tests/22-truenas-workloads-platform-filter.spec.ts
+++ b/tests/integration/tests/22-truenas-workloads-platform-filter.spec.ts
@@ -55,7 +55,7 @@ test.describe('TrueNAS workloads platform filter', () => {
body: JSON.stringify({
data: [
{
- id: 'truenas-app-nextcloud',
+ id: 'app-container:truenas-main:nextcloud',
type: 'app-container',
name: 'nextcloud',
status: 'running',
@@ -87,7 +87,7 @@ test.describe('TrueNAS workloads platform filter', () => {
},
},
{
- id: 'docker-app-grafana',
+ id: 'app-container:docker-main:grafana',
type: 'app-container',
name: 'grafana',
status: 'running',
@@ -135,7 +135,11 @@ test.describe('TrueNAS workloads platform filter', () => {
const workloadTable = page.locator('table').first();
await expect(workloadTable).toContainText('nextcloud');
await expect(workloadTable).not.toContainText('grafana');
- await expect(page.locator('tr[data-guest-id="ix-nextcloud"] [data-prevent-toggle]')).toHaveCount(0);
+ await expect(
+ page.locator(
+ 'tr[data-guest-id="app-container:truenas-main:nextcloud"] [data-prevent-toggle]',
+ ),
+ ).toHaveCount(0);
await page.screenshot({ path: SCREENSHOT_PATH, fullPage: true });
});
diff --git a/tests/integration/tests/32-truenas-workloads-resource-deeplink.spec.ts b/tests/integration/tests/32-truenas-workloads-resource-deeplink.spec.ts
new file mode 100644
index 0000000000..26d1721e2a
--- /dev/null
+++ b/tests/integration/tests/32-truenas-workloads-resource-deeplink.spec.ts
@@ -0,0 +1,127 @@
+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-workloads-resource-deeplink.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-workloads-resource-deeplink-${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 workloads resource deep links', () => {
+ test.setTimeout(180_000);
+
+ test('opens the canonical workload drawer without inventing a node scope', async ({ page }) => {
+ await page.route('**/api/resources**', async (route) => {
+ const requestUrl = new URL(route.request().url());
+ if (
+ requestUrl.pathname !== '/api/resources' ||
+ requestUrl.searchParams.get('type') !== 'vm,system-container,app-container,pod'
+ ) {
+ await route.continue();
+ return;
+ }
+
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify({
+ data: [
+ {
+ id: 'app-container:truenas-main:nextcloud',
+ type: 'app-container',
+ name: 'nextcloud',
+ status: 'running',
+ lastSeen: '2026-03-29T21:00:00Z',
+ node: 'truenas-main',
+ instance: 'truenas-main',
+ sources: ['truenas'],
+ parentName: 'truenas-main',
+ metrics: {
+ cpu: { value: 12, percent: 12 },
+ memory: { total: 8 * 1024 * 1024 * 1024, used: 2 * 1024 * 1024 * 1024 },
+ disk: { total: 100 * 1024 * 1024 * 1024, used: 40 * 1024 * 1024 * 1024 },
+ netIn: { value: 2048 },
+ netOut: { value: 1024 },
+ diskRead: { value: 512 },
+ diskWrite: { value: 256 },
+ },
+ docker: {
+ containerId: 'ix-nextcloud',
+ hostname: 'truenas-main',
+ imageName: 'nextcloud:29',
+ runtime: 'docker',
+ hostSourceId: 'truenas-main',
+ },
+ },
+ {
+ id: 'cluster-a:pve1:101',
+ type: 'vm',
+ name: 'vm-101',
+ status: 'running',
+ lastSeen: '2026-03-29T21:00:00Z',
+ node: 'pve1',
+ instance: 'cluster-a',
+ vmid: 101,
+ sources: ['proxmox'],
+ },
+ ],
+ meta: {
+ page: 1,
+ limit: 200,
+ total: 2,
+ totalPages: 1,
+ },
+ }),
+ });
+ });
+
+ await page.goto(
+ '/workloads?type=app-container&platform=truenas&agent=truenas-main&resource=app-container%3Atruenas-main%3Anextcloud',
+ {
+ waitUntil: 'domcontentloaded',
+ },
+ );
+
+ await page.waitForURL(
+ /\/workloads\?type=app-container&platform=truenas&agent=truenas-main&resource=app-container%3Atruenas-main%3Anextcloud/,
+ );
+ await expect(page.locator('#dashboard-type-filter')).toHaveValue('app-container');
+ await expect(page.locator('#workloads-platform-filter')).toHaveValue('truenas');
+ await expect(page.locator('#workloads-node-filter')).toHaveValue(/truenas-main/);
+ await expect(
+ page.locator('tr[data-guest-id="app-container:truenas-main:nextcloud"]'),
+ ).toContainText('nextcloud');
+ await expect(page.getByText('Open related infrastructure', { exact: true })).toBeVisible();
+ await expect(page.getByRole('button', { name: 'Overview' })).toBeVisible();
+
+ await page.screenshot({ path: SCREENSHOT_PATH, fullPage: true });
+ });
+});