[pdm-devel] [PATCH datacenter-manager 4/7] ui: dashboard: extend node panel creation by remote type

Christian Ebner c.ebner at proxmox.com
Mon Oct 13 10:56:20 CEST 2025


Make the node panel instantiation logic reusable for the PBS remotes
by passing the remote type as additional parameter, switching the
rendered node status information based on that.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 ui/src/dashboard/mod.rs | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/ui/src/dashboard/mod.rs b/ui/src/dashboard/mod.rs
index f54c509..ff63f6a 100644
--- a/ui/src/dashboard/mod.rs
+++ b/ui/src/dashboard/mod.rs
@@ -158,16 +158,26 @@ impl PdmDashboard {
             .into()
     }
 
-    fn create_node_panel(&self, ctx: &yew::Context<Self>, icon: &str, title: String) -> Panel {
+    fn create_node_panel(
+        &self,
+        ctx: &yew::Context<Self>,
+        icon: &str,
+        title: String,
+        remote_type: RemoteType,
+    ) -> Panel {
         let mut search_terms = vec![SearchTerm::new("node").category(Some("type"))];
         let (status_icon, text): (Fa, String) = match &self.status {
             Some(status) => {
-                match status.pve_nodes {
+                let node_status = match remote_type {
+                    RemoteType::Pve => &status.pve_nodes,
+                    RemoteType::Pbs => &status.pbs_nodes,
+                };
+                match node_status {
                     NodeStatusCount {
                         online,
                         offline,
                         unknown,
-                    } if offline > 0 => {
+                    } if *offline > 0 => {
                         search_terms.push(SearchTerm::new("offline").category(Some("status")));
                         (
                             Status::Error.into(),
@@ -178,7 +188,7 @@ impl PdmDashboard {
                             ),
                         )
                     }
-                    NodeStatusCount { unknown, .. } if unknown > 0 => {
+                    NodeStatusCount { unknown, .. } if *unknown > 0 => {
                         search_terms.push(SearchTerm::new("unknown").category(Some("status")));
                         (
                             Status::Warning.into(),
@@ -567,6 +577,7 @@ impl Component for PdmDashboard {
                         ctx,
                         "building",
                         tr!("Virtual Environment Nodes"),
+                        RemoteType::Pve,
                     ))
                     .with_child(self.create_guest_panel(GuestType::Qemu))
                     .with_child(self.create_guest_panel(GuestType::Lxc))
-- 
2.47.3





More information about the pdm-devel mailing list