* [PATCH yew-mobile-gui 0/3] fix #7330: dashboard: display CPU utilization correctly
@ 2026-02-18 11:03 Dominik Rusovac
2026-02-18 11:03 ` [PATCH yew-mobile-gui 1/3] run cargo fmt Dominik Rusovac
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Dominik Rusovac @ 2026-02-18 11:03 UTC (permalink / raw)
To: pve-devel
Fix CPU utilization presentation in dashboard
Dominik Rusovac (3):
run cargo fmt
fix #7330: dashboard: display CPU utilization correctly
dashboard: polish CPU utilization presentation
src/pages/page_dashboard.rs | 12 ++++--------
src/pages/page_node_status/dashboard_panel.rs | 4 ++--
src/pages/page_node_status/services_panel.rs | 2 +-
src/pages/page_not_found.rs | 2 +-
src/widgets/guest_backup_panel.rs | 6 +++---
src/widgets/storage_content_panel.rs | 2 +-
src/widgets/task_list_button.rs | 2 +-
src/widgets/tasks_panel.rs | 2 +-
8 files changed, 14 insertions(+), 18 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH yew-mobile-gui 1/3] run cargo fmt 2026-02-18 11:03 [PATCH yew-mobile-gui 0/3] fix #7330: dashboard: display CPU utilization correctly Dominik Rusovac @ 2026-02-18 11:03 ` Dominik Rusovac 2026-02-18 11:03 ` [PATCH yew-mobile-gui 2/3] fix #7330: dashboard: display CPU utilization correctly Dominik Rusovac ` (2 subsequent siblings) 3 siblings, 0 replies; 9+ messages in thread From: Dominik Rusovac @ 2026-02-18 11:03 UTC (permalink / raw) To: pve-devel Signed-off-by: Dominik Rusovac <d.rusovac@proxmox.com> --- src/pages/page_node_status/dashboard_panel.rs | 4 ++-- src/pages/page_node_status/services_panel.rs | 2 +- src/pages/page_not_found.rs | 2 +- src/widgets/guest_backup_panel.rs | 6 +++--- src/widgets/storage_content_panel.rs | 2 +- src/widgets/task_list_button.rs | 2 +- src/widgets/tasks_panel.rs | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/pages/page_node_status/dashboard_panel.rs b/src/pages/page_node_status/dashboard_panel.rs index c487d4e..1a723fe 100644 --- a/src/pages/page_node_status/dashboard_panel.rs +++ b/src/pages/page_node_status/dashboard_panel.rs @@ -10,14 +10,14 @@ use yew::prelude::*; use yew::virtual_dom::{VComp, VNode}; use yew_router::scope_ext::RouterScopeExt; +use pwt::AsyncAbortGuard; use pwt::prelude::*; use pwt::widget::{Button, Column, Fa, List, ListTile, MiniScroll, MiniScrollMode, Row}; -use pwt::AsyncAbortGuard; use proxmox_yew_comp::layout::card::standard_card; use proxmox_yew_comp::layout::list_tile::{icon_list_tile, list_tile_usage}; use proxmox_yew_comp::layout::render_loaded_data; -use proxmox_yew_comp::{http_get, http_post, percent_encoding::percent_encode_component, XTermJs}; +use proxmox_yew_comp::{XTermJs, http_get, http_post, percent_encoding::percent_encode_component}; use pve_api_types::NodeStatus; diff --git a/src/pages/page_node_status/services_panel.rs b/src/pages/page_node_status/services_panel.rs index a4a0e00..6e3e2e0 100644 --- a/src/pages/page_node_status/services_panel.rs +++ b/src/pages/page_node_status/services_panel.rs @@ -5,8 +5,8 @@ use gloo_timers::callback::Timeout; use yew::virtual_dom::{VComp, VNode}; -use pwt::widget::{Column, Container, List}; use pwt::AsyncAbortGuard; +use pwt::widget::{Column, Container, List}; use pwt::{prelude::*, widget::ListTile}; use proxmox_yew_comp::layout::list_tile::title_subtitle_column; diff --git a/src/pages/page_not_found.rs b/src/pages/page_not_found.rs index ecf9534..352f509 100644 --- a/src/pages/page_not_found.rs +++ b/src/pages/page_not_found.rs @@ -1,5 +1,5 @@ use pwt::prelude::*; -use pwt::widget::{error_message, Column}; +use pwt::widget::{Column, error_message}; use crate::widgets::TopNavBar; diff --git a/src/widgets/guest_backup_panel.rs b/src/widgets/guest_backup_panel.rs index 7fa46cb..fac281b 100644 --- a/src/widgets/guest_backup_panel.rs +++ b/src/widgets/guest_backup_panel.rs @@ -1,16 +1,16 @@ use std::rc::Rc; use anyhow::Error; -use proxmox_yew_comp::{http_post, LogView}; +use proxmox_yew_comp::{LogView, http_post}; use pwt::touch::{Fab, FabSize, SideDialog}; use pwt::widget::form::{Combobox, Field, Form, FormContext, SubmitButton}; use serde_json::json; use yew::prelude::*; use yew::virtual_dom::{VComp, VNode}; +use pwt::AsyncAbortGuard; use pwt::prelude::*; use pwt::widget::{Column, MiniScroll, Row}; -use pwt::AsyncAbortGuard; use proxmox_yew_comp::layout::mobile_form::label_field; use proxmox_yew_comp::layout::render_loaded_data; @@ -18,7 +18,7 @@ use proxmox_yew_comp::{http_get, percent_encoding::percent_encode_component}; use pve_api_types::{StorageContent, StorageInfo}; -use crate::widgets::{storage_card, StorageContentPanel}; +use crate::widgets::{StorageContentPanel, storage_card}; #[derive(Clone, PartialEq, Properties)] pub struct GuestBackupPanel { diff --git a/src/widgets/storage_content_panel.rs b/src/widgets/storage_content_panel.rs index 7793563..dd0513a 100644 --- a/src/widgets/storage_content_panel.rs +++ b/src/widgets/storage_content_panel.rs @@ -9,10 +9,10 @@ use yew::html::IntoPropValue; use yew::prelude::*; use yew::virtual_dom::{VComp, VNode}; +use pwt::AsyncAbortGuard; use pwt::prelude::*; use pwt::touch::MaterialAppScopeExt; use pwt::widget::{Column, Container, Dialog, Fa, List, ListTile, Row, Trigger}; -use pwt::AsyncAbortGuard; use proxmox_yew_comp::layout::list_tile::icon_list_tile; use proxmox_yew_comp::layout::render_loaded_data; diff --git a/src/widgets/task_list_button.rs b/src/widgets/task_list_button.rs index 66b6e17..7321b1d 100644 --- a/src/widgets/task_list_button.rs +++ b/src/widgets/task_list_button.rs @@ -8,7 +8,7 @@ use yew::html::{IntoEventCallback, IntoPropValue}; use yew::virtual_dom::{VComp, VNode}; use pwt::widget::{Button, Column, Container}; -use pwt::{prelude::*, AsyncAbortGuard}; +use pwt::{AsyncAbortGuard, prelude::*}; use proxmox_yew_comp::http_get; use proxmox_yew_comp::percent_encoding::percent_encode_component; diff --git a/src/widgets/tasks_panel.rs b/src/widgets/tasks_panel.rs index 466cad1..36f8c29 100644 --- a/src/widgets/tasks_panel.rs +++ b/src/widgets/tasks_panel.rs @@ -5,9 +5,9 @@ use yew::html::IntoEventCallback; use yew::prelude::*; use yew::virtual_dom::{VComp, VNode}; +use pwt::AsyncAbortGuard; use pwt::prelude::*; use pwt::widget::{Column, Container, Fa, List, ListTile}; -use pwt::AsyncAbortGuard; use pwt_macros::builder; -- 2.47.3 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH yew-mobile-gui 2/3] fix #7330: dashboard: display CPU utilization correctly 2026-02-18 11:03 [PATCH yew-mobile-gui 0/3] fix #7330: dashboard: display CPU utilization correctly Dominik Rusovac 2026-02-18 11:03 ` [PATCH yew-mobile-gui 1/3] run cargo fmt Dominik Rusovac @ 2026-02-18 11:03 ` Dominik Rusovac 2026-02-18 11:33 ` Dominik Csapak 2026-02-18 11:03 ` [PATCH yew-mobile-gui 3/3] dashboard: polish CPU utilization presentation Dominik Rusovac 2026-02-19 12:11 ` superseded [PATCH yew-mobile-gui 0/3] fix #7330: dashboard: display CPU utilization correctly Dominik Rusovac 3 siblings, 1 reply; 9+ messages in thread From: Dominik Rusovac @ 2026-02-18 11:03 UTC (permalink / raw) To: pve-devel The CPU utilization was displayed incorrectly, because the cached CPU utilization was mistaken to be the number of utilized CPUs. Instead the cached CPU utilization is the proportion of utilized CPUs. This handles the presentation of CPU utilization accordingly. Signed-off-by: Dominik Rusovac <d.rusovac@proxmox.com> --- src/pages/page_dashboard.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/pages/page_dashboard.rs b/src/pages/page_dashboard.rs index f637c63..93e0f83 100644 --- a/src/pages/page_dashboard.rs +++ b/src/pages/page_dashboard.rs @@ -109,11 +109,7 @@ impl PvePageDashboard { } } - let cpu_percentage = if maxcpu == 0 { - 0.0 - } else { - (cpu as f32) / (maxcpu as f32) - }; + let cpu_percentage = cpu * 100.0; let mem_percentage = if maxmem <= 0.0 { 0.0 @@ -125,9 +121,9 @@ impl PvePageDashboard { tiles.push( icon_list_tile(Fa::new("cpu"), tr!("CPU"), (), ()).with_child(list_tile_usage( - format!("{:.2}", cpu), + format!("{cpu_percentage:.2}%"), maxcpu.to_string(), - cpu_percentage, + cpu as f32, )), ); -- 2.47.3 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH yew-mobile-gui 2/3] fix #7330: dashboard: display CPU utilization correctly 2026-02-18 11:03 ` [PATCH yew-mobile-gui 2/3] fix #7330: dashboard: display CPU utilization correctly Dominik Rusovac @ 2026-02-18 11:33 ` Dominik Csapak 2026-02-18 13:17 ` Dominik Rusovac 0 siblings, 1 reply; 9+ messages in thread From: Dominik Csapak @ 2026-02-18 11:33 UTC (permalink / raw) To: Dominik Rusovac, pve-devel On 2/18/26 12:04 PM, Dominik Rusovac wrote: > The CPU utilization was displayed incorrectly, because the cached CPU > utilization was mistaken to be the number of utilized CPUs. Instead the > cached CPU utilization is the proportion of utilized CPUs. This handles > the presentation of CPU utilization accordingly. > > Signed-off-by: Dominik Rusovac <d.rusovac@proxmox.com> > --- > src/pages/page_dashboard.rs | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/src/pages/page_dashboard.rs b/src/pages/page_dashboard.rs > index f637c63..93e0f83 100644 > --- a/src/pages/page_dashboard.rs > +++ b/src/pages/page_dashboard.rs > @@ -109,11 +109,7 @@ impl PvePageDashboard { > } > } > > - let cpu_percentage = if maxcpu == 0 { > - 0.0 > - } else { > - (cpu as f32) / (maxcpu as f32) > - }; > + let cpu_percentage = cpu * 100.0; this looks wrong. 'cpu' is the sum of the whole cpu percentages per node, so in a 4 node cluster this is a value between 0 and 4, so in your case it would try to show 400% if all cpus of that cluster were fully loaded ;) i think a better way to calculate/show that would be to sum up the 'per core' utilization by summing up like this: 'cpu += (node.cpu * node.maxcpu)' and then trying to divide by the sum of all 'maxcpus' again like it was done previously after that multiplying by 100 and showing it as a percentage Note that the current code also don't really makes sense, since it would only be correct if each node would only have one core > > let mem_percentage = if maxmem <= 0.0 { > 0.0 > @@ -125,9 +121,9 @@ impl PvePageDashboard { > > tiles.push( > icon_list_tile(Fa::new("cpu"), tr!("CPU"), (), ()).with_child(list_tile_usage( > - format!("{:.2}", cpu), > + format!("{cpu_percentage:.2}%"), > maxcpu.to_string(), > - cpu_percentage, > + cpu as f32, > )), > ); > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH yew-mobile-gui 2/3] fix #7330: dashboard: display CPU utilization correctly 2026-02-18 11:33 ` Dominik Csapak @ 2026-02-18 13:17 ` Dominik Rusovac 0 siblings, 0 replies; 9+ messages in thread From: Dominik Rusovac @ 2026-02-18 13:17 UTC (permalink / raw) To: Dominik Csapak, pve-devel Indeed, it's wrong, thx! I was only considering the special case of one node only. You're proposal should work fine. I'll send a v2. ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH yew-mobile-gui 3/3] dashboard: polish CPU utilization presentation 2026-02-18 11:03 [PATCH yew-mobile-gui 0/3] fix #7330: dashboard: display CPU utilization correctly Dominik Rusovac 2026-02-18 11:03 ` [PATCH yew-mobile-gui 1/3] run cargo fmt Dominik Rusovac 2026-02-18 11:03 ` [PATCH yew-mobile-gui 2/3] fix #7330: dashboard: display CPU utilization correctly Dominik Rusovac @ 2026-02-18 11:03 ` Dominik Rusovac 2026-02-18 11:21 ` Maximiliano Sandoval 2026-02-19 12:11 ` superseded [PATCH yew-mobile-gui 0/3] fix #7330: dashboard: display CPU utilization correctly Dominik Rusovac 3 siblings, 1 reply; 9+ messages in thread From: Dominik Rusovac @ 2026-02-18 11:03 UTC (permalink / raw) To: pve-devel To align with the CPU utilization presentation in the web ui, this adds "CPU(s)" as the unit of the total number of CPUs displayed above to the right of the CPU utilization bar. Signed-off-by: Dominik Rusovac <d.rusovac@proxmox.com> --- src/pages/page_dashboard.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/page_dashboard.rs b/src/pages/page_dashboard.rs index 93e0f83..9bd6141 100644 --- a/src/pages/page_dashboard.rs +++ b/src/pages/page_dashboard.rs @@ -122,7 +122,7 @@ impl PvePageDashboard { tiles.push( icon_list_tile(Fa::new("cpu"), tr!("CPU"), (), ()).with_child(list_tile_usage( format!("{cpu_percentage:.2}%"), - maxcpu.to_string(), + format!("{maxcpu} CPU(s)"), cpu as f32, )), ); -- 2.47.3 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH yew-mobile-gui 3/3] dashboard: polish CPU utilization presentation 2026-02-18 11:03 ` [PATCH yew-mobile-gui 3/3] dashboard: polish CPU utilization presentation Dominik Rusovac @ 2026-02-18 11:21 ` Maximiliano Sandoval 2026-02-18 13:06 ` Dominik Rusovac 0 siblings, 1 reply; 9+ messages in thread From: Maximiliano Sandoval @ 2026-02-18 11:21 UTC (permalink / raw) To: Dominik Rusovac; +Cc: pve-devel Dominik Rusovac <d.rusovac@proxmox.com> writes: > To align with the CPU utilization presentation in the web ui, this adds > "CPU(s)" as the unit of the total number of CPUs displayed above to the > right of the CPU utilization bar. > > Signed-off-by: Dominik Rusovac <d.rusovac@proxmox.com> > --- > src/pages/page_dashboard.rs | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/pages/page_dashboard.rs b/src/pages/page_dashboard.rs > index 93e0f83..9bd6141 100644 > --- a/src/pages/page_dashboard.rs > +++ b/src/pages/page_dashboard.rs > @@ -122,7 +122,7 @@ impl PvePageDashboard { > tiles.push( > icon_list_tile(Fa::new("cpu"), tr!("CPU"), (), ()).with_child(list_tile_usage( > format!("{cpu_percentage:.2}%"), > - maxcpu.to_string(), > + format!("{maxcpu} CPU(s)"), This should be translatable, see e.g. https://lore.proxmox.com/all/20260128085614.91769-2-m.sandoval@proxmox.com/. > cpu as f32, > )), > ); -- Maximiliano ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH yew-mobile-gui 3/3] dashboard: polish CPU utilization presentation 2026-02-18 11:21 ` Maximiliano Sandoval @ 2026-02-18 13:06 ` Dominik Rusovac 0 siblings, 0 replies; 9+ messages in thread From: Dominik Rusovac @ 2026-02-18 13:06 UTC (permalink / raw) To: Maximiliano Sandoval; +Cc: pve-devel I will take this into account. Thx for the heads up! ^ permalink raw reply [flat|nested] 9+ messages in thread
* superseded [PATCH yew-mobile-gui 0/3] fix #7330: dashboard: display CPU utilization correctly 2026-02-18 11:03 [PATCH yew-mobile-gui 0/3] fix #7330: dashboard: display CPU utilization correctly Dominik Rusovac ` (2 preceding siblings ...) 2026-02-18 11:03 ` [PATCH yew-mobile-gui 3/3] dashboard: polish CPU utilization presentation Dominik Rusovac @ 2026-02-19 12:11 ` Dominik Rusovac 3 siblings, 0 replies; 9+ messages in thread From: Dominik Rusovac @ 2026-02-19 12:11 UTC (permalink / raw) To: Dominik Rusovac, pve-devel superseded by: https://lore.proxmox.com/all/20260219120535.209549-1-d.rusovac@proxmox.com/ ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-02-19 12:10 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-02-18 11:03 [PATCH yew-mobile-gui 0/3] fix #7330: dashboard: display CPU utilization correctly Dominik Rusovac 2026-02-18 11:03 ` [PATCH yew-mobile-gui 1/3] run cargo fmt Dominik Rusovac 2026-02-18 11:03 ` [PATCH yew-mobile-gui 2/3] fix #7330: dashboard: display CPU utilization correctly Dominik Rusovac 2026-02-18 11:33 ` Dominik Csapak 2026-02-18 13:17 ` Dominik Rusovac 2026-02-18 11:03 ` [PATCH yew-mobile-gui 3/3] dashboard: polish CPU utilization presentation Dominik Rusovac 2026-02-18 11:21 ` Maximiliano Sandoval 2026-02-18 13:06 ` Dominik Rusovac 2026-02-19 12:11 ` superseded [PATCH yew-mobile-gui 0/3] fix #7330: dashboard: display CPU utilization correctly Dominik Rusovac
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox