Fix physical drive name and health status display
All checks were successful
Build and Release / build-and-release (push) Successful in 2m13s
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:
parent
53dbb43352
commit
9b4191b2c3
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard-agent"
|
name = "cm-dashboard-agent"
|
||||||
version = "0.1.128"
|
version = "0.1.129"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard"
|
name = "cm-dashboard"
|
||||||
version = "0.1.128"
|
version = "0.1.129"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@ -208,6 +208,13 @@ impl SystemWidget {
|
|||||||
pool.pool_health = Some(health.clone());
|
pool.pool_health = Some(health.clone());
|
||||||
pool.health_status = metric.status.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") {
|
} else if metric.name.contains("_temperature") {
|
||||||
if let Some(drive_name) = self.extract_drive_name(&metric.name) {
|
if let Some(drive_name) = self.extract_drive_name(&metric.name) {
|
||||||
// Find existing drive or create new one
|
// 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}
|
// Handle drive-specific metrics: disk_{pool}_{drive}_{metric}
|
||||||
let drive_suffixes = ["_temperature", "_wear_percent", "_health"];
|
let drive_suffixes = ["_temperature", "_wear_percent", "_health"];
|
||||||
for suffix in drive_suffixes {
|
for suffix in drive_suffixes {
|
||||||
@ -433,7 +452,10 @@ impl SystemWidget {
|
|||||||
|
|
||||||
for pool in &self.storage_pools {
|
for pool in &self.storage_pools {
|
||||||
// Pool header line with type and health
|
// 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)
|
format!("{}:", pool.mount_point)
|
||||||
} else {
|
} else {
|
||||||
format!("{} ({}):", pool.mount_point, pool.pool_type)
|
format!("{} ({}):", pool.mount_point, pool.pool_type)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard-shared"
|
name = "cm-dashboard-shared"
|
||||||
version = "0.1.128"
|
version = "0.1.129"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user