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 59CA01FF16B for ; Fri, 26 Sep 2025 13:45:56 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E7786E582; Fri, 26 Sep 2025 13:46:28 +0200 (CEST) From: Christian Ebner To: pdm-devel@lists.proxmox.com Date: Fri, 26 Sep 2025 13:45:35 +0200 Message-ID: <20250926114535.413361-1-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1758887139553 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.042 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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] ui: dashboard: allow add PBS remotes via dashboard 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" Extend the current add button to a dropdown menu so it is possible to add PVE as well as PBS remotes. Instead of using a boolean to show/hide the wizard, set the remote type as option, not showing the wizard if none is set, otherwise showing the wizard for the corresponding type. Signed-off-by: Christian Ebner --- ui/src/dashboard/mod.rs | 50 +++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/ui/src/dashboard/mod.rs b/ui/src/dashboard/mod.rs index 27c0944..f54c509 100644 --- a/ui/src/dashboard/mod.rs +++ b/ui/src/dashboard/mod.rs @@ -19,12 +19,14 @@ use pwt::{ widget::{ error_message, form::{DisplayField, FormContext, Number}, - Button, Column, Container, Fa, InputPanel, Panel, Row, + menu::{Menu, MenuButton, MenuItem}, + Column, Container, Fa, InputPanel, Panel, Row, }, AsyncPool, }; use pdm_api_types::{ + remotes::RemoteType, resource::{NodeStatusCount, ResourcesStatus}, TaskStatistics, }; @@ -116,7 +118,7 @@ pub enum LoadingResult { pub enum Msg { LoadingFinished(LoadingResult), RemoteListChanged(RemoteList), - CreateWizard(bool), + CreateWizard(Option), Reload, ForceReload, UpdateConfig(DashboardConfig), @@ -139,7 +141,7 @@ pub struct PdmDashboard { loading: bool, load_finished_time: Option, remote_list: RemoteList, - show_wizard: bool, + show_wizard: Option, show_config_window: bool, _context_listener: ContextHandle, async_pool: AsyncPool, @@ -415,7 +417,7 @@ impl Component for PdmDashboard { loading: true, load_finished_time: None, remote_list, - show_wizard: false, + show_wizard: None, show_config_window: false, _context_listener, async_pool, @@ -471,8 +473,8 @@ impl Component for PdmDashboard { self.remote_list = remote_list; changed } - Msg::CreateWizard(show) => { - self.show_wizard = show; + Msg::CreateWizard(remote_type) => { + self.show_wizard = remote_type; true } Msg::Reload => { @@ -541,9 +543,23 @@ impl Component for PdmDashboard { .width(300) .min_height(175) .with_tool( - Button::new(tr!("Add")) - .icon_class("fa fa-plus-circle") - .on_activate(ctx.link().callback(|_| Msg::CreateWizard(true))), + MenuButton::new(tr!("Add")).show_arrow(true).menu( + Menu::new() + .with_item( + MenuItem::new("Proxmox VE") + .icon_class("fa fa-building") + .on_select(ctx.link().callback(|_| { + Msg::CreateWizard(Some(RemoteType::Pve)) + })), + ) + .with_item( + MenuItem::new("Proxmox Backup Server") + .icon_class("fa fa-floppy-o") + .on_select(ctx.link().callback(|_| { + Msg::CreateWizard(Some(RemoteType::Pbs)) + })), + ), + ), ) .with_child(RemotePanel::new(self.status.clone())), ) @@ -665,18 +681,14 @@ impl Component for PdmDashboard { Panel::new() .class(FlexFit) .with_child(content) - // FIXME: make pbs also addable? .with_optional_child( - self.show_wizard.then_some( - AddWizard::new(pdm_api_types::remotes::RemoteType::Pve) - .on_close(ctx.link().callback(|_| Msg::CreateWizard(false))) + self.show_wizard.map(|remote_type| { + AddWizard::new(remote_type) + .on_close(ctx.link().callback(|_| Msg::CreateWizard(None))) .on_submit(move |ctx| { - crate::remotes::create_remote( - ctx, - pdm_api_types::remotes::RemoteType::Pve, - ) - }), - ), + crate::remotes::create_remote(ctx, remote_type) + }) + }), ) .with_optional_child( self.show_config_window.then_some( -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel