public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager] fix #6782: ui: pve: tree: don't show start/shutdown buttons for templates
Date: Wed, 10 Sep 2025 08:25:24 +0200	[thread overview]
Message-ID: <20250910062530.138192-1-d.csapak@proxmox.com> (raw)

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

Signed-off-by: Dominik Csapak <d.csapak@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



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


             reply	other threads:[~2025-09-10  6:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-10  6:25 Dominik Csapak [this message]
2025-09-10  7:47 ` [pdm-devel] applied: " Wolfgang Bumiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250910062530.138192-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal