From 2e5e54d598e4f428513c23d8faa42fe6e9e8b186 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Thu, 21 May 2026 16:50:40 +0100 Subject: [PATCH] Fit TrueNAS detail tables --- .../platformOverviewLayout.guardrails.test.ts | 12 ++++ .../src/features/truenas/TrueNASAppsTable.tsx | 57 +++---------------- .../truenas/TrueNASNetworkSharesTable.tsx | 28 +++------ .../truenas/TrueNASStorageTopologyTable.tsx | 14 ++--- .../truenas/TrueNASVirtualMachinesTable.tsx | 7 ++- 5 files changed, 41 insertions(+), 77 deletions(-) diff --git a/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts b/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts index 1965ca6f7b..c9aecae460 100644 --- a/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts +++ b/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts @@ -16,6 +16,8 @@ import proxmoxPageSurfaceSource from '@/features/proxmox/ProxmoxPageSurface.tsx? import proxmoxReplicationTableSource from '@/features/proxmox/ProxmoxReplicationTable.tsx?raw'; import sharedPlatformPageSource from '@/features/platformPage/sharedPlatformPage.tsx?raw'; import truenasAlertsTableSource from '@/features/truenas/TrueNASAlertsTable.tsx?raw'; +import truenasAppsTableSource from '@/features/truenas/TrueNASAppsTable.tsx?raw'; +import truenasNetworkSharesTableSource from '@/features/truenas/TrueNASNetworkSharesTable.tsx?raw'; import truenasPageSurfaceSource from '@/features/truenas/TrueNASPageSurface.tsx?raw'; import truenasProtectionTableSource from '@/features/truenas/TrueNASProtectionTable.tsx?raw'; import truenasStorageTopologyTableSource from '@/features/truenas/TrueNASStorageTopologyTable.tsx?raw'; @@ -32,6 +34,8 @@ const platformTableSources = [ kubernetesNodesTableSource, kubernetesDeploymentsTableSource, truenasAlertsTableSource, + truenasAppsTableSource, + truenasNetworkSharesTableSource, truenasProtectionTableSource, truenasStorageTopologyTableSource, truenasSystemsTableSource, @@ -175,8 +179,16 @@ describe('platform overview layout guardrails', () => { expect(truenasPageSurfaceSource).not.toContain('[] = [ @@ -80,9 +75,6 @@ const appContainerCount = (app: ResourceTrueNASAppMeta | undefined): number => { return app?.containers?.length ?? 0; }; -const plural = (count: number, singular: string): string => - `${count} ${count === 1 ? singular : `${singular}s`}`; - const formatHostPort = (port: ResourceTrueNASAppPort): string => { const protocol = (asTrimmedString(port.protocol) ?? '').toLowerCase() || 'tcp'; const target = typeof port.containerPort === 'number' ? String(port.containerPort) : ''; @@ -121,24 +113,6 @@ const formatImages = ( return { label: `${visible.join(', ')}${suffix}`, title: images.join(', ') }; }; -const volumeLabel = (volume: ResourceTrueNASAppVolume): string => { - const source = asTrimmedString(volume.source); - const destination = asTrimmedString(volume.destination); - if (source && destination) return `${source}->${destination}`; - return source || destination || ''; -}; - -const formatVolumes = ( - app: ResourceTrueNASAppMeta | undefined, -): { label: string; title: string } => { - const volumes = app?.volumes ?? []; - if (volumes.length === 0) return { label: '-', title: '' }; - return { - label: plural(volumes.length, 'volume'), - title: volumes.map(volumeLabel).filter(Boolean).join(', '), - }; -}; - const UpdatePills: Component<{ app: ResourceTrueNASAppMeta | undefined }> = (props) => { const hasAppUpdate = () => props.app?.upgradeAvailable === true; const hasImageUpdate = () => props.app?.imageUpdatesAvailable === true; @@ -221,10 +195,10 @@ export const TrueNASAppsTable: Component<{ > - +
- + App Version - + CPU Memory - - + Updates @@ -284,7 +253,6 @@ export const TrueNASAppsTable: Component<{ const canRenderMetrics = () => indicator().variant !== 'muted'; const ports = createMemo(() => formatPorts(app())); const images = createMemo(() => formatImages(app())); - const volumes = createMemo(() => formatVolumes(app())); const detailRowId = () => drawer.detailRowId(resource); const isExpanded = () => drawer.isExpanded(resource); return ( @@ -365,13 +333,6 @@ export const TrueNASAppsTable: Component<{ {images().label} - @@ -380,7 +341,7 @@ export const TrueNASAppsTable: Component<{ resource={resource} open={isExpanded()} detailRowId={detailRowId()} - colSpan={9} + colSpan={8} resolveResourceLabel={resolveResourceLabel} onClose={() => drawer.close(resource)} /> diff --git a/frontend-modern/src/features/truenas/TrueNASNetworkSharesTable.tsx b/frontend-modern/src/features/truenas/TrueNASNetworkSharesTable.tsx index 3a24563a5c..fedeb4e10b 100644 --- a/frontend-modern/src/features/truenas/TrueNASNetworkSharesTable.tsx +++ b/frontend-modern/src/features/truenas/TrueNASNetworkSharesTable.tsx @@ -169,34 +169,29 @@ export const TrueNASNetworkSharesTable: Component<{ > -
+
- + Share - + Protocol - - + Access - + State @@ -249,13 +244,6 @@ export const TrueNASNetworkSharesTable: Component<{ {formatProtocol(share())} -
+
- + Resource - + Kind - + Usage / Size - + Health diff --git a/frontend-modern/src/features/truenas/TrueNASVirtualMachinesTable.tsx b/frontend-modern/src/features/truenas/TrueNASVirtualMachinesTable.tsx index c84b4a1cab..c5a9c44575 100644 --- a/frontend-modern/src/features/truenas/TrueNASVirtualMachinesTable.tsx +++ b/frontend-modern/src/features/truenas/TrueNASVirtualMachinesTable.tsx @@ -163,7 +163,7 @@ export const TrueNASVirtualMachinesTable: Component<{ > -
+
@@ -235,7 +235,10 @@ export const TrueNASVirtualMachinesTable: Component<{ {name()}
- {vm()?.description || vm()?.uuid || resource.parentName || 'TrueNAS'} + {vm()?.description || + vm()?.uuid || + resource.parentName || + 'TrueNAS'}