From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager 2/2] ui: use on_activate for buttons
Date: Fri, 6 Jun 2025 09:23:53 +0200 [thread overview]
Message-ID: <20250606072353.638426-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20250606072353.638426-1-d.csapak@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
prev parent reply other threads:[~2025-06-06 7:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-06 7:23 [pdm-devel] [PATCH datacenter-manager 1/2] ui: remote endpoint selector: remove leftover debug log Dominik Csapak
2025-06-06 7:23 ` Dominik Csapak [this message]
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=20250606072353.638426-2-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