public inbox for yew-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shan Shaji <s.shaji@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [PATCH proxmox-yew-comp 1/2] fix: user_panel: show confirmation dialog before removing users
Date: Fri, 12 Jun 2026 17:44:45 +0200	[thread overview]
Message-ID: <20260612154446.364072-2-s.shaji@proxmox.com> (raw)
In-Reply-To: <20260612154446.364072-1-s.shaji@proxmox.com>

Earlier, when pressing 'Remove' inside the user management panel the
user was removed without any confirmation. Fixed this by adding the
confirmation dialog.

Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
 src/user_panel.rs | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/src/user_panel.rs b/src/user_panel.rs
index 75a442f..6903b87 100644
--- a/src/user_panel.rs
+++ b/src/user_panel.rs
@@ -25,9 +25,9 @@ use crate::form::delete_empty_values;
 use crate::percent_encoding::percent_encode_component;
 use crate::utils::{epoch_to_input_value, render_epoch_short};
 use crate::{
-    EditWindow, LoadableComponent, LoadableComponentContext, LoadableComponentMaster,
-    LoadableComponentScopeExt, LoadableComponentState, PermissionPanel, RealmSelector,
-    SchemaValidation,
+    ConfirmButton, EditWindow, LoadableComponent, LoadableComponentContext,
+    LoadableComponentMaster, LoadableComponentScopeExt, LoadableComponentState, PermissionPanel,
+    RealmSelector, SchemaValidation,
 };
 
 async fn load_user_list() -> Result<Vec<UserWithTokens>, Error> {
@@ -192,8 +192,9 @@ impl LoadableComponent for ProxmoxUserPanel {
         let link = ctx.link();
 
         let no_selection = self.selection.is_empty();
-        let disable_change_password = self
-            .get_selected_user()
+        let selected_user = self.get_selected_user().and_then(|user| Some(user));
+        let disable_change_password = selected_user
+            .as_ref()
             .and_then(|user| {
                 self.product_realm
                     .as_ref()
@@ -216,9 +217,17 @@ impl LoadableComponent for ProxmoxUserPanel {
                     .onclick(link.change_view_callback(|_| Some(ViewState::Edit))),
             )
             .with_child(
-                Button::new(tr!("Remove"))
+                ConfirmButton::new(tr!("Remove"))
+                    .dangerous(true)
                     .disabled(no_selection)
-                    .onclick(link.callback(|_| Msg::RemoveItem)),
+                    .confirm_message(match selected_user {
+                        Some(user) => tr!(
+                            "Are you sure you want to remove entry '{}'?",
+                            user.user.userid.as_str()
+                        ),
+                        None => tr!("Are you sure you want to remove this entry?"),
+                    })
+                    .on_activate(link.callback(|_| Msg::RemoveItem)),
             )
             .with_spacer()
             .with_child(
-- 
2.47.3





  reply	other threads:[~2026-06-12 15:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12 15:44 [PATCH proxmox-yew-comp 0/2] fix: user_panel: show confirmation dialog and disable remove button Shan Shaji
2026-06-12 15:44 ` Shan Shaji [this message]
2026-06-12 15:44 ` [PATCH proxmox-yew-comp 2/2] fix: user_panel: disable "remove" button if the user is "root" Shan Shaji

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=20260612154446.364072-2-s.shaji@proxmox.com \
    --to=s.shaji@proxmox.com \
    --cc=yew-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal