From e082c6067771e3354e5e66950ffcb766b282ff85 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Thu, 19 Feb 2026 06:48:01 -0500 Subject: [PATCH] fix: repair brace mismatch in DataContext and replace PV Pool column with Dataset - TnsCsiDataContext: pool stats fetch was outside the outer try block due to a brace mismatch introduced when adding TrueNAS API integration; this caused the entire fetchAsync function to throw a syntax-level error, breaking the OverviewPage - StorageClassColumns (PV): replace non-populating Pool column with Dataset column (tns-csi driver writes datasetName, not pool, into PV volumeAttributes) Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- src/api/TnsCsiDataContext.tsx | 46 +++++++++---------- .../integrations/StorageClassColumns.tsx | 12 ++--- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/api/TnsCsiDataContext.tsx b/src/api/TnsCsiDataContext.tsx index 591f706..04ca028 100644 --- a/src/api/TnsCsiDataContext.tsx +++ b/src/api/TnsCsiDataContext.tsx @@ -168,32 +168,32 @@ export function TnsCsiDataProvider({ children }: { children: React.ReactNode }) setVolumeSnapshots([]); } } - // TrueNAS pool stats (only when API key is configured) - const config = getTnsCsiConfig(); - if (config.truenasApiKey.trim()) { - // Determine server: explicit override → first SC server param → fail gracefully - const server = config.truenasServerOverride.trim(); - if (server) { - try { - const pools = await fetchTruenasPoolStats(server, config.truenasApiKey.trim()); - if (!cancelled) { - setPoolStats(pools); - setPoolStatsError(null); - } - } catch (err: unknown) { - if (!cancelled) { - setPoolStats([]); - setPoolStatsError(err instanceof Error ? err.message : String(err)); + + // TrueNAS pool stats (only when API key is configured) + const config = getTnsCsiConfig(); + if (config.truenasApiKey.trim()) { + const server = config.truenasServerOverride.trim(); + if (server) { + try { + const pools = await fetchTruenasPoolStats(server, config.truenasApiKey.trim()); + if (!cancelled) { + setPoolStats(pools); + setPoolStatsError(null); + } + } catch (err: unknown) { + if (!cancelled) { + setPoolStats([]); + setPoolStatsError(err instanceof Error ? err.message : String(err)); + } } } + } else { + if (!cancelled) { + setPoolStats([]); + setPoolStatsError(null); + } } - } else { - if (!cancelled) { - setPoolStats([]); - setPoolStatsError(null); - } - } - } catch (err: unknown) { + } catch (err: unknown) { if (!cancelled) { setAsyncError(err instanceof Error ? err.message : String(err)); } diff --git a/src/components/integrations/StorageClassColumns.tsx b/src/components/integrations/StorageClassColumns.tsx index 6fc9aff..9ff3f5a 100644 --- a/src/components/integrations/StorageClassColumns.tsx +++ b/src/components/integrations/StorageClassColumns.tsx @@ -2,7 +2,7 @@ * StorageClassColumns — registerResourceTableColumnsProcessor for StorageClass and PV tables. * * Adds Protocol/Pool/Server columns to the native /storage-classes table and - * Protocol/Volume Handle columns to the native /persistent-volumes table. + * Protocol/Dataset columns to the native /persistent-volumes table. * * Items in column processors are KubeObject class instances from Headlamp. * Raw Kubernetes JSON fields (parameters, spec, status) must be accessed @@ -131,18 +131,18 @@ export function buildPVColumns() { }, }, { - label: 'Volume Handle', + label: 'Dataset', getValue: (pv: unknown): string | null => { const driver = getField(pv, 'spec', 'csi', 'driver') as string | undefined; if (driver !== TNS_CSI_PROVISIONER) return null; - const h = getField(pv, 'spec', 'csi', 'volumeHandle'); - return typeof h === 'string' ? h : null; + const d = getField(pv, 'spec', 'csi', 'volumeAttributes', 'datasetName'); + return typeof d === 'string' ? d : null; }, render: (pv: unknown) => { const driver = getField(pv, 'spec', 'csi', 'driver') as string | undefined; if (driver !== TNS_CSI_PROVISIONER) return ; - const handle = getField(pv, 'spec', 'csi', 'volumeHandle') as string | undefined; - return {handle ?? '—'}; + const dataset = getField(pv, 'spec', 'csi', 'volumeAttributes', 'datasetName') as string | undefined; + return {dataset ?? '—'}; }, }, ];