From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 3EE731FF1C7 for ; Thu, 19 Dec 2024 12:01:48 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8A6B7215A; Thu, 19 Dec 2024 12:01:48 +0100 (CET) From: Shannon Sterz To: pdm-devel@lists.proxmox.com Date: Thu, 19 Dec 2024 12:00:57 +0100 Message-Id: <20241219110059.166895-1-s.sterz@proxmox.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.037 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 Subject: [pdm-devel] [PATCH datacenter-manager] ui: remotes: use ConfirmButton component instead of ConfirmDialog 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" Signed-off-by: Shannon Sterz --- ui/src/remotes/mod.rs | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/ui/src/remotes/mod.rs b/ui/src/remotes/mod.rs index c9a4e43..9b9de06 100644 --- a/ui/src/remotes/mod.rs +++ b/ui/src/remotes/mod.rs @@ -27,8 +27,6 @@ use anyhow::Error; use edit_remote::EditRemote; //use pwt::widget::form::{Field, FormContext, InputType}; -use pwt::widget::ConfirmDialog; - use pdm_api_types::remotes::Remote; //use proxmox_schema::{property_string::PropertyString, ApiType}; use proxmox_yew_comp::percent_encoding::percent_encode_component; @@ -54,7 +52,9 @@ use pwt::widget::{ //use pwt::widget::InputPanel; //use proxmox_yew_comp::EditWindow; -use proxmox_yew_comp::{LoadableComponent, LoadableComponentContext, LoadableComponentMaster}; +use proxmox_yew_comp::{ + ConfirmButton, LoadableComponent, LoadableComponentContext, LoadableComponentMaster, +}; use pdm_api_types::remotes::{NodeUrl, RemoteType}; @@ -120,7 +120,6 @@ impl RemoteConfigPanel { pub enum ViewState { Add(RemoteType), Edit, - ConfirmRemove, } pub enum Msg { @@ -220,10 +219,12 @@ impl LoadableComponent for PbsRemoteConfigPanel { .disabled(disabled) .onclick(link.change_view_callback(|_| Some(ViewState::Edit))), ) - .with_child(Button::new(tr!("Remove")).disabled(disabled).onclick({ - let link = link.clone(); - move |_| link.change_view(Some(ViewState::ConfirmRemove)) - })) + .with_child( + ConfirmButton::new(tr!("Remove")) + .confirm_message(tr!("Are you sure you want to remove this remote?")) + .disabled(disabled) + .on_activate(link.callback(|_| Msg::RemoveItem)), + ) .with_flex_spacer() .with_child({ let loading = ctx.loading(); @@ -257,15 +258,6 @@ impl LoadableComponent for PbsRemoteConfigPanel { .selection .selected_key() .map(|key| self.create_edit_dialog(ctx, key)), - ViewState::ConfirmRemove => self.selection.selected_key().map(|key| { - ConfirmDialog::new() - .title(tr!("Confirm: Remove Remote")) - .confirm_text(tr!("Remove")) - .confirm_message(tr!("Are you sure you want to remove the remote '{0}' ?", key)) - .on_confirm(ctx.link().callback(|_| Msg::RemoveItem)) - .on_done(ctx.link().change_view_callback(|_| None)) - .into() - }), } } } -- 2.39.5 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel