[pdm-devel] [PATCH datacenter-manager] fix #6782: ui: pve: tree: don't show start/shutdown buttons for templates

Dominik Csapak d.csapak at proxmox.com
Wed Sep 10 08:25:24 CEST 2025


templates cannot be started/stopped so don't show these actions

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 ui/src/pve/tree.rs | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/ui/src/pve/tree.rs b/ui/src/pve/tree.rs
index 168e322..2f307e8 100644
--- a/ui/src/pve/tree.rs
+++ b/ui/src/pve/tree.rs
@@ -610,7 +610,7 @@ fn columns(
                         (
                             r.id.as_str(),
                             local_id,
-                            Some((guest_info, r.status.as_str())),
+                            Some((guest_info, r.status.as_str(), r.template)),
                             Some(r.node.clone()),
                         )
                     }
@@ -620,7 +620,7 @@ fn columns(
                         (
                             r.id.as_str(),
                             local_id,
-                            Some((guest_info, r.status.as_str())),
+                            Some((guest_info, r.status.as_str(), r.template)),
                             Some(r.node.clone()),
                         )
                     }
@@ -641,9 +641,12 @@ fn columns(
 
                 Row::new()
                     .class(JustifyContent::FlexEnd)
-                    .with_optional_child(guest_info.map(|(_, status)| {
+                    .with_optional_child(guest_info.and_then(|(_, status, template)| {
+                        if template {
+                            return None;
+                        }
                         let disabled = status != "running";
-                        Tooltip::new(
+                        let icon = Tooltip::new(
                             ActionIcon::new("fa fa-fw fa-power-off")
                                 .disabled(disabled)
                                 .on_activate({
@@ -658,11 +661,15 @@ fn columns(
                                 })
                                 .class((!disabled).then_some(ColorScheme::Error)),
                         )
-                        .tip(tr!("Shutdown"))
+                        .tip(tr!("Shutdown"));
+                        Some(icon)
                     }))
-                    .with_optional_child(guest_info.map(|(_, status)| {
+                    .with_optional_child(guest_info.and_then(|(_, status, template)| {
+                        if template {
+                            return None;
+                        }
                         let disabled = status == "running";
-                        Tooltip::new(
+                        let icon = Tooltip::new(
                             ActionIcon::new("fa fa-fw fa-play")
                                 .disabled(disabled)
                                 .on_activate({
@@ -677,9 +684,10 @@ fn columns(
                                 })
                                 .class((!disabled).then_some(ColorScheme::Success)),
                         )
-                        .tip(tr!("Start"))
+                        .tip(tr!("Start"));
+                        Some(icon)
                     }))
-                    .with_optional_child(guest_info.map(|(guest_info, _)| {
+                    .with_optional_child(guest_info.map(|(guest_info, _, _)| {
                         Tooltip::new(ActionIcon::new("fa fa-fw fa-paper-plane-o").on_activate({
                             let link = link.clone();
                             move |_| link.change_view(Some(ViewState::MigrateWindow(guest_info)))
-- 
2.47.3





More information about the pdm-devel mailing list