From fab6404cca58328fe8a81a1790885796cf398499 Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Sun, 23 Nov 2025 13:04:01 +0100 Subject: [PATCH] Fix filesystem children creation logic - Allow filesystem entries to be created with any metric, not just mount_point - Ensure filesystem children appear under physical drive pools - Improve mount point fallback logic for better compatibility --- Cargo.lock | 6 +++--- agent/Cargo.toml | 2 +- dashboard/Cargo.toml | 2 +- dashboard/src/ui/widgets/system.rs | 22 +++++++++++++--------- shared/Cargo.toml | 2 +- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 79cd2ba..cf67230 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "cm-dashboard" -version = "0.1.103" +version = "0.1.104" dependencies = [ "anyhow", "chrono", @@ -301,7 +301,7 @@ dependencies = [ [[package]] name = "cm-dashboard-agent" -version = "0.1.103" +version = "0.1.104" dependencies = [ "anyhow", "async-trait", @@ -324,7 +324,7 @@ dependencies = [ [[package]] name = "cm-dashboard-shared" -version = "0.1.103" +version = "0.1.104" dependencies = [ "chrono", "serde", diff --git a/agent/Cargo.toml b/agent/Cargo.toml index 2da9dc9..9492f46 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-agent" -version = "0.1.104" +version = "0.1.105" edition = "2021" [dependencies] diff --git a/dashboard/Cargo.toml b/dashboard/Cargo.toml index 7bd153a..5643e8e 100644 --- a/dashboard/Cargo.toml +++ b/dashboard/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard" -version = "0.1.104" +version = "0.1.105" edition = "2021" [dependencies] diff --git a/dashboard/src/ui/widgets/system.rs b/dashboard/src/ui/widgets/system.rs index 25aff45..1f32b2f 100644 --- a/dashboard/src/ui/widgets/system.rs +++ b/dashboard/src/ui/widgets/system.rs @@ -256,16 +256,20 @@ impl SystemWidget { }); if !fs_exists { - // Only create filesystem entry if we have the mount_point metric - // This ensures we get the correct mount point path - if metric_type != "mount_point" { - continue; // Skip non-mount_point metrics if filesystem doesn't exist yet - } - - let mount_point = if let MetricValue::String(mount) = &metric.value { - mount.clone() + // Create filesystem entry with correct mount point + let mount_point = if metric_type == "mount_point" { + if let MetricValue::String(mount) = &metric.value { + mount.clone() + } else { + // Fallback: handle special cases + if fs_name == "root" { + "/".to_string() + } else { + format!("/{}", fs_name.replace('_', "/")) + } + } } else { - // Fallback: handle special cases + // Fallback for non-mount_point metrics: generate mount point from fs_name if fs_name == "root" { "/".to_string() } else { diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 7045c9b..b54a037 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-shared" -version = "0.1.104" +version = "0.1.105" edition = "2021" [dependencies]