From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 65AB11FF191 for ; Tue, 21 Oct 2025 16:07:39 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E91DD6BD; Tue, 21 Oct 2025 16:08:04 +0200 (CEST) From: Dominik Csapak To: pdm-devel@lists.proxmox.com Date: Tue, 21 Oct 2025 16:03:20 +0200 Message-ID: <20251021140801.3611022-5-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251021140801.3611022-1-d.csapak@proxmox.com> References: <20251021140801.3611022-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.028 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [mod.rs] Subject: [pdm-devel] [PATCH datacenter-manager 04/15] ui: dashboard: remote panel: make wizard menu optional X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" if the pve/pbs wizard callbacks are None, don't show the menu Signed-off-by: Dominik Csapak --- 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, - on_pve_wizard: impl IntoEventCallback, - on_pbs_wizard: impl IntoEventCallback, + on_pve_wizard: Option>, + on_pbs_wizard: Option>, ) -> 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