Update services widget memory display and formatting
Improve services widget to show consistent usage/total format for both RAM and Disk columns, using system totals when no service quotas exist. Changes: - Change column header from "Memory (GB)" to "RAM (GB)" - Remove "GB" units from memory values (units now in header) - Add system memory total detection from /proc/meminfo - Use system memory total as default quota for services without limits - Services now show "5.2/32.0" format for both RAM and disk Both RAM and Disk columns now consistently display usage/quota format where quota is either service-specific limit or system total capacity.
This commit is contained in:
@@ -50,7 +50,7 @@ fn render_metrics(
|
||||
let mut data = WidgetData::new(
|
||||
title,
|
||||
Some(WidgetStatus::new(widget_status)),
|
||||
vec!["Service".to_string(), "Memory (GB)".to_string(), "CPU".to_string(), "Disk".to_string()]
|
||||
vec!["Service".to_string(), "RAM (GB)".to_string(), "CPU".to_string(), "Disk".to_string()]
|
||||
);
|
||||
|
||||
|
||||
@@ -142,11 +142,11 @@ fn format_memory_value(used: f32, quota: f32) -> String {
|
||||
let quota_gb = quota / 1000.0;
|
||||
|
||||
if quota > 0.05 {
|
||||
format!("{:.1}/{:.1} GB", used_gb, quota_gb)
|
||||
format!("{:.1}/{:.1}", used_gb, quota_gb)
|
||||
} else if used > 0.05 {
|
||||
format!("{:.1} GB", used_gb)
|
||||
format!("{:.1}", used_gb)
|
||||
} else {
|
||||
"0.0 GB".to_string()
|
||||
"0.0".to_string()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user