From 9b4191b2c39ddd0f54ecc9694da012bd53acca04 Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Sun, 23 Nov 2025 19:25:45 +0100 Subject: [PATCH] Fix physical drive name and health status display - Display actual drive name (e.g., nvme0n1) instead of mount point for physical drives - Fix health status parsing for physical drives to show proper status icons - Update pool name extraction to handle disk_{drive}_health metrics correctly - Improve storage widget rendering for physical drive identification --- agent/Cargo.toml | 2 +- dashboard/Cargo.toml | 2 +- dashboard/src/ui/widgets/system.rs | 24 +++++++++++++++++++++++- shared/Cargo.toml | 2 +- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/agent/Cargo.toml b/agent/Cargo.toml index 678f7f3..f200f18 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-agent" -version = "0.1.128" +version = "0.1.129" edition = "2021" [dependencies] diff --git a/dashboard/Cargo.toml b/dashboard/Cargo.toml index ea43495..3f570c1 100644 --- a/dashboard/Cargo.toml +++ b/dashboard/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard" -version = "0.1.128" +version = "0.1.129" edition = "2021" [dependencies] diff --git a/dashboard/src/ui/widgets/system.rs b/dashboard/src/ui/widgets/system.rs index 08a37f0..6c74912 100644 --- a/dashboard/src/ui/widgets/system.rs +++ b/dashboard/src/ui/widgets/system.rs @@ -208,6 +208,13 @@ impl SystemWidget { pool.pool_health = Some(health.clone()); pool.health_status = metric.status.clone(); } + } else if metric.name.contains("_health") && !metric.name.contains("_pool_health") { + // Handle physical drive health metrics (disk_{drive}_health) + if let MetricValue::String(health) = &metric.value { + // For physical drives, use the drive health as pool health + pool.pool_health = Some(health.clone()); + pool.health_status = metric.status.clone(); + } } else if metric.name.contains("_temperature") { if let Some(drive_name) = self.extract_drive_name(&metric.name) { // Find existing drive or create new one @@ -365,6 +372,18 @@ impl SystemWidget { } } + // Handle physical drive health metrics: disk_{drive}_health + if metric_name.ends_with("_health") && !metric_name.contains("_pool_health") { + // Count underscores to distinguish physical drive health (disk_{drive}_health) + // from pool drive health (disk_{pool}_{drive}_health) + let underscore_count = metric_name.matches('_').count(); + if underscore_count == 2 { // disk_{drive}_health + if let Some(suffix_pos) = metric_name.rfind("_health") { + return Some(metric_name[5..suffix_pos].to_string()); // Skip "disk_" + } + } + } + // Handle drive-specific metrics: disk_{pool}_{drive}_{metric} let drive_suffixes = ["_temperature", "_wear_percent", "_health"]; for suffix in drive_suffixes { @@ -433,7 +452,10 @@ impl SystemWidget { for pool in &self.storage_pools { // Pool header line with type and health - let pool_label = if pool.pool_type == "single" { + let pool_label = if pool.pool_type.starts_with("drive (") { + // For physical drives, show the drive name instead of mount point + format!("{} ({}):", pool.name, pool.pool_type) + } else if pool.pool_type == "single" { format!("{}:", pool.mount_point) } else { format!("{} ({}):", pool.mount_point, pool.pool_type) diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 03926f1..2523fe6 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-shared" -version = "0.1.128" +version = "0.1.129" edition = "2021" [dependencies]