From 8de3d2ba7924c21cdd02d7c0cebb77a027e8e695 Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Tue, 14 Oct 2025 10:36:38 +0200 Subject: [PATCH] Clean up services widget column headers and units Standardize all services widget columns to show units in headers and remove units from metric values for cleaner display. Changes: - Update column headers: "RAM (GB)", "CPU (%)", "Disk (GB)" - Remove units from metric values: - RAM: "5.2/32.0" (no GB) - CPU: "2.5" (no %) - Disk: "1.5/500.0" (no GB) - Simplify disk formatting to always show GB format All columns now consistently display units in headers with clean, uncluttered metric values. --- dashboard/src/ui/services.rs | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/dashboard/src/ui/services.rs b/dashboard/src/ui/services.rs index dfd90a1..2808caa 100644 --- a/dashboard/src/ui/services.rs +++ b/dashboard/src/ui/services.rs @@ -50,7 +50,7 @@ fn render_metrics( let mut data = WidgetData::new( title, Some(WidgetStatus::new(widget_status)), - vec!["Service".to_string(), "RAM (GB)".to_string(), "CPU".to_string(), "Disk".to_string()] + vec!["Service".to_string(), "RAM (GB)".to_string(), "CPU (%)".to_string(), "Disk (GB)".to_string()] ); @@ -152,25 +152,14 @@ fn format_memory_value(used: f32, quota: f32) -> String { fn format_cpu_value(cpu_percent: f32) -> String { if cpu_percent >= 0.1 { - format!("{:.1}%", cpu_percent) + format!("{:.1}", cpu_percent) } else { - "0.0%".to_string() + "0.0".to_string() } } fn format_disk_value(used: f32, quota: f32) -> String { - if quota > 0.05 { - // Show usage/quota format when quota is set - format!("{:.1}/{:.1} GB", used, quota) - } else if used >= 1.0 { - format!("{:.1} GB", used) - } else if used >= 0.001 { - // 1 MB or more - format!("{:.0} MB", used * 1000.0) - } else if used > 0.0 { - "<1 MB".to_string() - } else { - "—".to_string() // Em dash for no disk usage - } + // Always show in GB format with usage/quota, no units (units in column header) + format!("{:.1}/{:.1}", used, quota) }