all lists on 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 04/15] ui: dashboard: remote panel: make wizard menu optional
Date: Tue, 21 Oct 2025 16:03:20 +0200	[thread overview]
Message-ID: <20251021140801.3611022-5-d.csapak@proxmox.com> (raw)
In-Reply-To: <20251021140801.3611022-1-d.csapak@proxmox.com>

if the pve/pbs wizard callbacks are None, don't show the menu

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 ui/src/dashboard/mod.rs          | 12 ++++++---
 ui/src/dashboard/remote_panel.rs | 43 ++++++++++++++++++--------------
 2 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/ui/src/dashboard/mod.rs b/ui/src/dashboard/mod.rs
index 2fe4d7fa..0441440a 100644
--- a/ui/src/dashboard/mod.rs
+++ b/ui/src/dashboard/mod.rs
@@ -423,10 +423,14 @@ impl Component for PdmDashboard {
                     .with_child(
                         create_remote_panel(
                             self.status.clone(),
-                            ctx.link()
-                                .callback(|_| Msg::CreateWizard(Some(RemoteType::Pve))),
-                            ctx.link()
-                                .callback(|_| Msg::CreateWizard(Some(RemoteType::Pbs))),
+                            Some(
+                                ctx.link()
+                                    .callback(|_| Msg::CreateWizard(Some(RemoteType::Pve))),
+                            ),
+                            Some(
+                                ctx.link()
+                                    .callback(|_| Msg::CreateWizard(Some(RemoteType::Pbs))),
+                            ),
                         )
                         .flex(1.0)
                         .width(300)
diff --git a/ui/src/dashboard/remote_panel.rs b/ui/src/dashboard/remote_panel.rs
index 27eebac2..747f9b8d 100644
--- a/ui/src/dashboard/remote_panel.rs
+++ b/ui/src/dashboard/remote_panel.rs
@@ -117,26 +117,31 @@ fn create_search_term(failure: bool) -> Search {
 
 pub fn create_remote_panel(
     status: Option<ResourcesStatus>,
-    on_pve_wizard: impl IntoEventCallback<MenuEvent>,
-    on_pbs_wizard: impl IntoEventCallback<MenuEvent>,
+    on_pve_wizard: Option<impl IntoEventCallback<MenuEvent>>,
+    on_pbs_wizard: Option<impl IntoEventCallback<MenuEvent>>,
 ) -> Panel {
-    Panel::new()
+    let mut panel = Panel::new()
         .title(create_title_with_icon("server", tr!("Remotes")))
         .border(true)
-        .with_tool(
-            MenuButton::new(tr!("Add")).show_arrow(true).menu(
-                Menu::new()
-                    .with_item(
-                        MenuItem::new("Proxmox VE")
-                            .icon_class("fa fa-building")
-                            .on_select(on_pve_wizard),
-                    )
-                    .with_item(
-                        MenuItem::new("Proxmox Backup Server")
-                            .icon_class("fa fa-floppy-o")
-                            .on_select(on_pbs_wizard),
-                    ),
-            ),
-        )
-        .with_child(RemotePanel::new(status))
+        .with_child(RemotePanel::new(status));
+
+    if on_pve_wizard.is_some() || on_pbs_wizard.is_some() {
+        let mut menu = Menu::new();
+        if let Some(on_pve_wizard) = on_pve_wizard {
+            menu.add_item(
+                MenuItem::new("Proxmox VE")
+                    .icon_class("fa fa-building")
+                    .on_select(on_pve_wizard),
+            );
+        }
+        if let Some(on_pbs_wizard) = on_pbs_wizard {
+            menu.add_item(
+                MenuItem::new("Proxmox Backup Server")
+                    .icon_class("fa fa-floppy-o")
+                    .on_select(on_pbs_wizard),
+            );
+        }
+        panel.add_tool(MenuButton::new(tr!("Add")).show_arrow(true).menu(menu));
+    }
+    panel
 }
-- 
2.47.3



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


  parent reply	other threads:[~2025-10-21 14:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-21 14:03 [pdm-devel] [PATCH datacenter-manager 00/15] prepare ui fore customizable views Dominik Csapak
2025-10-21 14:03 ` [pdm-devel] [PATCH datacenter-manager 01/15] ui: dashboard: refactor guest panel creation to its own module Dominik Csapak
2025-10-21 14:03 ` [pdm-devel] [PATCH datacenter-manager 02/15] ui: dashboard: refactor creating the node panel into " Dominik Csapak
2025-10-21 14:03 ` [pdm-devel] [PATCH datacenter-manager 03/15] ui: dashboard: refactor remote panel creation " Dominik Csapak
2025-10-21 14:03 ` Dominik Csapak [this message]
2025-10-21 14:03 ` [pdm-devel] [PATCH datacenter-manager 05/15] ui: dashboard: refactor sdn " Dominik Csapak
2025-10-21 14:03 ` [pdm-devel] [PATCH datacenter-manager 06/15] ui: dashboard: refactor task summary panel creation to " Dominik Csapak
2025-10-21 14:03 ` [pdm-devel] [PATCH datacenter-manager 07/15] ui: dashboard: refactor subscription " Dominik Csapak
2025-10-21 14:03 ` [pdm-devel] [PATCH datacenter-manager 08/15] ui: dashboard: refactor top entities " Dominik Csapak
2025-10-21 14:03 ` [pdm-devel] [PATCH datacenter-manager 09/15] ui: dashboard: refactor DashboardConfig editing/constants to their module Dominik Csapak
2025-10-21 14:03 ` [pdm-devel] [PATCH datacenter-manager 10/15] ui: dashboard: factor out task parameter calculation Dominik Csapak
2025-10-21 14:03 ` [pdm-devel] [PATCH datacenter-manager 11/15] ui: dashboard: remove unused remote list Dominik Csapak
2025-10-21 14:03 ` [pdm-devel] [PATCH datacenter-manager 12/15] ui: dashboard: status row: make loading less jarring Dominik Csapak
2025-10-21 14:03 ` [pdm-devel] [PATCH datacenter-manager 13/15] ui: introduce `LoadResult` helper type Dominik Csapak
2025-10-21 14:03 ` [pdm-devel] [PATCH datacenter-manager 14/15] ui: dashboard: implement 'View' Dominik Csapak
2025-10-21 14:03 ` [pdm-devel] [PATCH datacenter-manager 15/15] ui: dashboard: use 'View' instead of the Dashboard Dominik Csapak
2025-10-23  8:33 ` [pdm-devel] superseded: [PATCH datacenter-manager 00/15] prepare ui fore customizable views Dominik Csapak

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=20251021140801.3611022-5-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal