mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-03-28 03:29:25 +01:00
fix(EasySetup): select valid primary disk for storage projection bar
The storage projection bar was blindly using disk[0], which on systems with multiple drives (like the Minisforum AI X1 Pro) could be an empty or uninitialized drive (e.g., sda showing N/A / N/A). Now the disk selection: 1. Filters out disks with totalSize === 0 (invalid/empty drives) 2. Prefers disk containing root (/) or /storage mount point 3. Falls back to largest valid disk if no root mount found This fixes the NaN% and 0 Bytes display on multi-drive systems. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
4ef954c9b5
commit
42a18c8dc6
|
|
@ -316,7 +316,27 @@ export default function EasySetupWizard(props: { system: { services: ServiceSlim
|
|||
|
||||
// Get primary disk/filesystem info for storage projection
|
||||
// Try disk array first (Linux/production), fall back to fsSize (Windows/dev)
|
||||
const primaryDisk = systemInfo?.disk?.[0]
|
||||
// Filter out invalid disks (totalSize === 0) and prefer disk with root mount or largest valid disk
|
||||
const getPrimaryDisk = () => {
|
||||
if (!systemInfo?.disk || systemInfo.disk.length === 0) return null
|
||||
|
||||
// Filter to only valid disks with actual storage
|
||||
const validDisks = systemInfo.disk.filter((d) => d.totalSize > 0)
|
||||
if (validDisks.length === 0) return null
|
||||
|
||||
// Prefer disk containing root mount (/) or /storage mount
|
||||
const diskWithRoot = validDisks.find((d) =>
|
||||
d.filesystems?.some((fs) => fs.mount === '/' || fs.mount === '/storage')
|
||||
)
|
||||
if (diskWithRoot) return diskWithRoot
|
||||
|
||||
// Fall back to largest valid disk
|
||||
return validDisks.reduce((largest, current) =>
|
||||
current.totalSize > largest.totalSize ? current : largest
|
||||
)
|
||||
}
|
||||
|
||||
const primaryDisk = getPrimaryDisk()
|
||||
const primaryFs = systemInfo?.fsSize?.[0]
|
||||
const storageInfo = primaryDisk
|
||||
? { totalSize: primaryDisk.totalSize, totalUsed: primaryDisk.totalUsed }
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user