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 ?? '—'}; }, }, ];