Fix physical drive name and health status display
All checks were successful
Build and Release / build-and-release (push) Successful in 2m13s

- 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
This commit is contained in:
Christoffer Martinsson 2025-11-23 19:25:45 +01:00
parent 53dbb43352
commit 9b4191b2c3
4 changed files with 26 additions and 4 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "cm-dashboard-agent"
version = "0.1.128"
version = "0.1.129"
edition = "2021"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "cm-dashboard"
version = "0.1.128"
version = "0.1.129"
edition = "2021"
[dependencies]

View File

@ -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)

View File

@ -1,6 +1,6 @@
[package]
name = "cm-dashboard-shared"
version = "0.1.128"
version = "0.1.129"
edition = "2021"
[dependencies]