From 477724b4f40b4774c42db52283d7c041d3c2b3bd Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Tue, 2 Dec 2025 11:36:27 +0100 Subject: [PATCH] Unify sub-service display formatting for Info status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change docker images to use name field for all data instead of metrics, matching the pattern used by torrent stats and VPN routes. Increase display width for Status::Info sub-services from 18 to 50 characters to accommodate longer informational text without truncation. - Docker images now show: "image-name size: 994.0 MB" in name field - Torrent stats show: "17 active, ↓ 2.5 MB/s, ↑ 1.2 MB/s" in name field - Remove fixed-width padding for Info status sub-services - Update version to v0.1.245 --- Cargo.lock | 6 +++--- agent/Cargo.toml | 2 +- agent/src/collectors/systemd.rs | 11 +++-------- dashboard/Cargo.toml | 2 +- dashboard/src/ui/widgets/services.rs | 11 +++++++---- shared/Cargo.toml | 2 +- 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 02fd954..1b5c4f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "cm-dashboard" -version = "0.1.243" +version = "0.1.244" dependencies = [ "anyhow", "chrono", @@ -301,7 +301,7 @@ dependencies = [ [[package]] name = "cm-dashboard-agent" -version = "0.1.243" +version = "0.1.244" dependencies = [ "anyhow", "async-trait", @@ -325,7 +325,7 @@ dependencies = [ [[package]] name = "cm-dashboard-shared" -version = "0.1.243" +version = "0.1.244" dependencies = [ "chrono", "serde", diff --git a/agent/Cargo.toml b/agent/Cargo.toml index 6a33697..f111c9b 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-agent" -version = "0.1.244" +version = "0.1.245" edition = "2021" [dependencies] diff --git a/agent/src/collectors/systemd.rs b/agent/src/collectors/systemd.rs index 8621f4f..c72aa97 100644 --- a/agent/src/collectors/systemd.rs +++ b/agent/src/collectors/systemd.rs @@ -142,16 +142,11 @@ impl SystemdCollector { // Add Docker images let docker_images = self.get_docker_images(); - for (image_name, image_status, image_size_mb) in docker_images { - let mut metrics = Vec::new(); - metrics.push(SubServiceMetric { - label: "size".to_string(), - value: image_size_mb, - unit: Some("MB".to_string()), - }); + for (image_name, _image_status, image_size_mb) in docker_images { + let metrics = Vec::new(); sub_services.push(SubServiceData { - name: image_name.to_string(), + name: format!("{} size: {:.1} MB", image_name, image_size_mb), service_status: Status::Info, // Informational only, no status icon metrics, service_type: "image".to_string(), diff --git a/dashboard/Cargo.toml b/dashboard/Cargo.toml index 028e24a..c84991b 100644 --- a/dashboard/Cargo.toml +++ b/dashboard/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard" -version = "0.1.244" +version = "0.1.245" edition = "2021" [dependencies] diff --git a/dashboard/src/ui/widgets/services.rs b/dashboard/src/ui/widgets/services.rs index f0f5524..4c04d79 100644 --- a/dashboard/src/ui/widgets/services.rs +++ b/dashboard/src/ui/widgets/services.rs @@ -230,9 +230,12 @@ impl ServicesWidget { info: &ServiceInfo, is_last: bool, ) -> Vec> { + // Informational sub-services (Status::Info) can use more width since they don't show columns + let max_width = if info.widget_status == Status::Info { 50 } else { 18 }; + // Truncate long sub-service names to fit layout (accounting for indentation) - let short_name = if name.len() > 18 { - format!("{}...", &name[..15]) + let short_name = if name.len() > max_width { + format!("{}...", &name[..(max_width.saturating_sub(3))]) } else { name.to_string() }; @@ -281,9 +284,9 @@ impl ServicesWidget { format!(" {} ", tree_symbol), Typography::tree(), ), - // Service name (no icon) + // Service name (no icon) - no fixed width padding for Info status ratatui::text::Span::styled( - format!("{:<18} ", short_name), + short_name, Style::default() .fg(Theme::secondary_text()) .bg(Theme::background()), diff --git a/shared/Cargo.toml b/shared/Cargo.toml index c0d8dc3..c3919ac 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-shared" -version = "0.1.244" +version = "0.1.245" edition = "2021" [dependencies]