From e7336f2a8e2db433493bb41ea710f5ffcee6089b Mon Sep 17 00:00:00 2001 From: Chris Sherwood Date: Mon, 26 Jan 2026 08:40:36 -0800 Subject: [PATCH] fix(SystemInfo): Fall back to fsSize when disk array is empty The Storage Devices section on System Information showed "No storage devices detected" because the disk info file (/storage/nomad-disk-info.json) returned an empty array. The fsSize data from systeminformation was available but not used as a fallback. Applies the same fallback pattern from the Easy Setup wizard (PR #90): - Try disk array first, filtering to entries with totalSize > 0 - Fall back to fsSize data when disk array is empty - Deduplicate fsSize entries by size (same disk mounted multiple places) - Filter to real block devices (/dev/), excluding virtual filesystems - Update Storage Devices count in System Status to match Co-Authored-By: Claude Opus 4.5 --- admin/inertia/pages/settings/system.tsx | 46 +++++++++++++++++++------ 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/admin/inertia/pages/settings/system.tsx b/admin/inertia/pages/settings/system.tsx index 8d89b44..375c612 100644 --- a/admin/inertia/pages/settings/system.tsx +++ b/admin/inertia/pages/settings/system.tsx @@ -32,6 +32,38 @@ export default function SettingsPage(props: { const uptimeMinutes = info?.uptime.uptime ? Math.floor(info.uptime.uptime / 60) : 0 + // Build storage display items - fall back to fsSize when disk array is empty + // (Same approach as Easy Setup wizard fix from PR #90) + const validDisks = info?.disk?.filter((d) => d.totalSize > 0) || [] + let storageItems: { label: string; value: number; total: string; used: string; subtext: string }[] = [] + if (validDisks.length > 0) { + storageItems = validDisks.map((disk) => ({ + label: disk.name || 'Unknown', + value: disk.percentUsed || 0, + total: disk.totalSize ? formatBytes(disk.totalSize) : 'N/A', + used: disk.totalUsed ? formatBytes(disk.totalUsed) : 'N/A', + subtext: `${formatBytes(disk.totalUsed || 0)} / ${formatBytes(disk.totalSize || 0)}`, + })) + } else if (info?.fsSize && info.fsSize.length > 0) { + // Deduplicate by size (same physical disk mounted in multiple places shows identical sizes) + const seen = new Set() + const uniqueFs = info.fsSize.filter((fs) => { + if (fs.size <= 0 || seen.has(fs.size)) return false + seen.add(fs.size) + return true + }) + // Prefer real block devices (/dev/), exclude virtual filesystems (efivarfs, tmpfs, etc.) + const realDevices = uniqueFs.filter((fs) => fs.fs.startsWith('/dev/')) + const displayFs = realDevices.length > 0 ? realDevices : uniqueFs + storageItems = displayFs.map((fs) => ({ + label: fs.fs || 'Unknown', + value: fs.use || 0, + total: formatBytes(fs.size), + used: formatBytes(fs.used), + subtext: `${formatBytes(fs.used)} / ${formatBytes(fs.size)}`, + })) + } + return ( @@ -181,17 +213,9 @@ export default function SettingsPage(props: {
- {info?.disk && info.disk.length > 0 ? ( + {storageItems.length > 0 ? ( ({ - label: disk.name || 'Unknown', - value: disk.percentUsed || 0, - total: disk.totalSize ? formatBytes(disk.totalSize) : 'N/A', - used: disk.totalUsed ? formatBytes(disk.totalUsed) : 'N/A', - subtext: `${formatBytes(disk.totalUsed || 0)} / ${formatBytes( - disk.totalSize || 0 - )}`, - }))} + items={storageItems} progressiveBarColor={true} statuses={[ { @@ -226,7 +250,7 @@ export default function SettingsPage(props: {
- +