From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pdm-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 3A5F61FF164 for <inbox@lore.proxmox.com>; Fri, 6 Jun 2025 09:24:08 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 358F135545; Fri, 6 Jun 2025 09:24:27 +0200 (CEST) From: Dominik Csapak <d.csapak@proxmox.com> To: pdm-devel@lists.proxmox.com Date: Fri, 6 Jun 2025 09:23:53 +0200 Message-Id: <20250606072353.638426-2-d.csapak@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250606072353.638426-1-d.csapak@proxmox.com> References: <20250606072353.638426-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.129 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 POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_2 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_4 0.1 random spam to be learned in bayes 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. [webauthn.rs, config.rs, mod.rs, tree.rs] Subject: [pdm-devel] [PATCH datacenter-manager 2/2] ui: use on_activate for buttons X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion <pdm-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pdm-devel>, <mailto:pdm-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pdm-devel/> List-Post: <mailto:pdm-devel@lists.proxmox.com> List-Help: <mailto:pdm-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel>, <mailto:pdm-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox Datacenter Manager development discussion <pdm-devel@lists.proxmox.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" <pdm-devel-bounces@lists.proxmox.com> While it's technically the same currently, 'on_activate' is the correct interface from our widget-toolkit. 'onclick' behaves the same due to browser behavior for buttons, but when seeing 'onclick' one could be lead to use that also for e.g. ActionIcons, where 'onclick' and 'on_activate' is not the same. So for consistency, use on_activate for buttons everywhere. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> --- ui/src/configuration/webauthn.rs | 2 +- ui/src/dashboard/mod.rs | 2 +- ui/src/pve/mod.rs | 2 +- ui/src/pve/tree.rs | 2 +- ui/src/remotes/config.rs | 4 +++- ui/src/remotes/node_url_list.rs | 2 +- ui/src/remotes/wizard_page_connect.rs | 2 +- ui/src/remotes/wizard_page_info.rs | 2 +- ui/src/top_nav_bar.rs | 4 ++-- 9 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ui/src/configuration/webauthn.rs b/ui/src/configuration/webauthn.rs index e589c7d..82425f1 100644 --- a/ui/src/configuration/webauthn.rs +++ b/ui/src/configuration/webauthn.rs @@ -124,7 +124,7 @@ impl Component for PdmWebauthnConfigEditor { Button::new(tr!("Auto-fill")) .class(ColorScheme::Primary) .icon_class("fa fa-fw fa-pencil-square-o") - .onclick(ctx.link().callback(move |event: MouseEvent| { + .on_activate(ctx.link().callback(move |event: MouseEvent| { event.stop_propagation(); Msg::AutoFill })), diff --git a/ui/src/dashboard/mod.rs b/ui/src/dashboard/mod.rs index 23ff6b7..044bc1a 100644 --- a/ui/src/dashboard/mod.rs +++ b/ui/src/dashboard/mod.rs @@ -255,7 +255,7 @@ impl Component for PdmDashboard { .with_tool( Button::new(tr!("Add")) .icon_class("fa fa-plus-circle") - .onclick(ctx.link().callback(|_| Msg::CreateWizard(true))), + .on_activate(ctx.link().callback(|_| Msg::CreateWizard(true))), ) .with_child(RemotePanel::new( (!self.loading).then_some(self.status.clone()), diff --git a/ui/src/pve/mod.rs b/ui/src/pve/mod.rs index c5a83cf..a3cf573 100644 --- a/ui/src/pve/mod.rs +++ b/ui/src/pve/mod.rs @@ -186,7 +186,7 @@ impl LoadableComponent for PveRemoteComp { .with_tool( Button::new(tr!("Open Web UI")) .icon_class("fa fa-external-link") - .onclick({ + .on_activate({ let link = ctx.link().clone(); let remote = ctx.props().remote.clone(); move |_| { diff --git a/ui/src/pve/tree.rs b/ui/src/pve/tree.rs index 474c9f2..c4d1322 100644 --- a/ui/src/pve/tree.rs +++ b/ui/src/pve/tree.rs @@ -448,7 +448,7 @@ impl LoadableComponent for PveTreeComp { .on_input(link.callback(Msg::Filter)), ) .with_flex_spacer() - .with_child(Button::refresh(ctx.props().loading).onclick({ + .with_child(Button::refresh(ctx.props().loading).on_activate({ let on_reload_click = ctx.props().on_reload_click.clone(); move |_| { on_reload_click.emit(()); diff --git a/ui/src/remotes/config.rs b/ui/src/remotes/config.rs index d9d16ae..db5646b 100644 --- a/ui/src/remotes/config.rs +++ b/ui/src/remotes/config.rs @@ -175,7 +175,9 @@ impl LoadableComponent for PbsRemoteConfigPanel { .with_child({ Button::new(tr!("Add Proxmox VE")) .icon_class("fa fa-building") - .onclick(link.change_view_callback(|_| Some(ViewState::Add(RemoteType::Pve)))) + .on_activate( + link.change_view_callback(|_| Some(ViewState::Add(RemoteType::Pve))), + ) // FIXME: add PBS support //MenuButton::new(tr!("Add")).show_arrow(true).menu( // Menu::new() diff --git a/ui/src/remotes/node_url_list.rs b/ui/src/remotes/node_url_list.rs index 54dbfb9..a3de0dc 100644 --- a/ui/src/remotes/node_url_list.rs +++ b/ui/src/remotes/node_url_list.rs @@ -197,7 +197,7 @@ impl ManagedField for PdmNodeUrlField { Button::new(tr!("Add")) .class(css::ColorScheme::Primary) .icon_class("fa fa-plus-circle") - .onclick({ + .on_activate({ let nodes = self.store.clone(); move |_| { let mut nodes = nodes.write(); diff --git a/ui/src/remotes/wizard_page_connect.rs b/ui/src/remotes/wizard_page_connect.rs index 28f14bf..1fb865f 100644 --- a/ui/src/remotes/wizard_page_connect.rs +++ b/ui/src/remotes/wizard_page_connect.rs @@ -223,7 +223,7 @@ impl Component for PdmWizardPageConnect { .with_child( Button::new("Connect") .disabled(!self.form_valid) - .onclick(ctx.link().callback(|_| Msg::Connect)), + .on_activate(ctx.link().callback(|_| Msg::Connect)), ), ), ); diff --git a/ui/src/remotes/wizard_page_info.rs b/ui/src/remotes/wizard_page_info.rs index b0a5ba2..b272be6 100644 --- a/ui/src/remotes/wizard_page_info.rs +++ b/ui/src/remotes/wizard_page_info.rs @@ -344,7 +344,7 @@ impl Component for PdmWizardPageInfo { .with_child( Button::new("Scan") .disabled(self.credentials.is_none()) - .onclick(ctx.link().callback(|_| Msg::Connect)), + .on_activate(ctx.link().callback(|_| Msg::Connect)), ), ); Mask::new(content) diff --git a/ui/src/top_nav_bar.rs b/ui/src/top_nav_bar.rs index 07b3b23..78aace5 100644 --- a/ui/src/top_nav_bar.rs +++ b/ui/src/top_nav_bar.rs @@ -197,12 +197,12 @@ impl Component for PdmTopNavBar { .buttons(vec![ Button::new(tr!("Show Local Tasks")) .class(ColorScheme::Primary) - .onclick(move |_| { + .on_activate(move |_| { set_location_href("#/administration/tasks"); }), Button::new(tr!("Show Remote Tasks")) .class(ColorScheme::Primary) - .onclick(move |_| { + .on_activate(move |_| { set_location_href("#/remotes/tasks"); }), ]) -- 2.39.5 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel