public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pdm-devel] [PATCH datacenter-manager] fix #6782: ui: pve: tree: don't show start/shutdown buttons for templates
@ 2025-09-10  6:25 Dominik Csapak
  2025-09-10  7:47 ` [pdm-devel] applied: " Wolfgang Bumiller
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2025-09-10  6:25 UTC (permalink / raw)
  To: pdm-devel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pdm-devel] applied: [PATCH datacenter-manager] fix #6782: ui: pve: tree: don't show start/shutdown buttons for templates
  2025-09-10  6:25 [pdm-devel] [PATCH datacenter-manager] fix #6782: ui: pve: tree: don't show start/shutdown buttons for templates Dominik Csapak
@ 2025-09-10  7:47 ` Wolfgang Bumiller
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Bumiller @ 2025-09-10  7:47 UTC (permalink / raw)
  To: Dominik Csapak; +Cc: pdm-devel

applied, thanks

On Wed, Sep 10, 2025 at 08:25:24AM +0200, Dominik Csapak wrote:
> 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-10  7:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-10  6:25 [pdm-devel] [PATCH datacenter-manager] fix #6782: ui: pve: tree: don't show start/shutdown buttons for templates Dominik Csapak
2025-09-10  7:47 ` [pdm-devel] applied: " Wolfgang Bumiller

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