* [PATCH proxmox-yew-comp 0/2] fix: user_panel: show confirmation dialog and disable remove button
@ 2026-06-12 15:44 Shan Shaji
2026-06-12 15:44 ` [PATCH proxmox-yew-comp 1/2] fix: user_panel: show confirmation dialog before removing users Shan Shaji
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Shan Shaji @ 2026-06-12 15:44 UTC (permalink / raw)
To: yew-devel
Earlier, while removing the user from the user management section there
were no confirmation dialog. Also, the "Remove" button was enabled even
when the user is root. This series fixes both issues by adding a confirmation
dialog and an additional check for validating if the user is root.
Shan Shaji (2):
fix: user_panel: show confirmation dialog before removing users
fix: user_panel: disable "remove" button if the user is "root"
src/user_panel.rs | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH proxmox-yew-comp 1/2] fix: user_panel: show confirmation dialog before removing users 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 2026-06-12 15:44 ` [PATCH proxmox-yew-comp 2/2] fix: user_panel: disable "remove" button if the user is "root" Shan Shaji 2026-06-17 13:47 ` applied: [PATCH proxmox-yew-comp 0/2] fix: user_panel: show confirmation dialog and disable remove button Dominik Csapak 2 siblings, 0 replies; 4+ messages in thread From: Shan Shaji @ 2026-06-12 15:44 UTC (permalink / raw) To: yew-devel 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 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH proxmox-yew-comp 2/2] fix: user_panel: disable "remove" button if the user is "root" 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 ` [PATCH proxmox-yew-comp 1/2] fix: user_panel: show confirmation dialog before removing users Shan Shaji @ 2026-06-12 15:44 ` Shan Shaji 2026-06-17 13:47 ` applied: [PATCH proxmox-yew-comp 0/2] fix: user_panel: show confirmation dialog and disable remove button Dominik Csapak 2 siblings, 0 replies; 4+ messages in thread From: Shan Shaji @ 2026-06-12 15:44 UTC (permalink / raw) To: yew-devel Earlier, the "Remove" button was enabled for the root user. To fix this, add an addition check to disable the button if the user is root. Signed-off-by: Shan Shaji <s.shaji@proxmox.com> --- src/user_panel.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/user_panel.rs b/src/user_panel.rs index 6903b87..ae1b3a0 100644 --- a/src/user_panel.rs +++ b/src/user_panel.rs @@ -201,6 +201,9 @@ impl LoadableComponent for ProxmoxUserPanel { .map(|p| p != user.user.userid.realm().as_str()) }) .unwrap_or(no_selection); + let is_root_user = selected_user + .as_ref() + .is_some_and(|user| user.user.userid.as_str() == "root@pam"); let toolbar = Toolbar::new() .class("pwt-w-100") @@ -219,7 +222,7 @@ impl LoadableComponent for ProxmoxUserPanel { .with_child( ConfirmButton::new(tr!("Remove")) .dangerous(true) - .disabled(no_selection) + .disabled(no_selection || is_root_user) .confirm_message(match selected_user { Some(user) => tr!( "Are you sure you want to remove entry '{}'?", -- 2.47.3 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* applied: [PATCH proxmox-yew-comp 0/2] fix: user_panel: show confirmation dialog and disable remove button 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 ` [PATCH proxmox-yew-comp 1/2] fix: user_panel: show confirmation dialog before removing users Shan Shaji 2026-06-12 15:44 ` [PATCH proxmox-yew-comp 2/2] fix: user_panel: disable "remove" button if the user is "root" Shan Shaji @ 2026-06-17 13:47 ` Dominik Csapak 2 siblings, 0 replies; 4+ messages in thread From: Dominik Csapak @ 2026-06-17 13:47 UTC (permalink / raw) To: yew-devel, Shan Shaji On Fri, 12 Jun 2026 17:44:44 +0200, Shan Shaji wrote: > Earlier, while removing the user from the user management section there > were no confirmation dialog. Also, the "Remove" button was enabled even > when the user is root. This series fixes both issues by adding a confirmation > dialog and an additional check for validating if the user is root. > > Shan Shaji (2): > fix: user_panel: show confirmation dialog before removing users > fix: user_panel: disable "remove" button if the user is "root" > > [...] Applied, thanks! [1/2] fix: user_panel: show confirmation dialog before removing users commit: 52ec927f4527e68679488c9eb35100049c1ab3f4 [2/2] fix: user_panel: disable "remove" button if the user is "root" commit: 4a1e484132e21ddca48fc68f35144ba16410c14b ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-06-17 13:48 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 ` [PATCH proxmox-yew-comp 1/2] fix: user_panel: show confirmation dialog before removing users Shan Shaji 2026-06-12 15:44 ` [PATCH proxmox-yew-comp 2/2] fix: user_panel: disable "remove" button if the user is "root" Shan Shaji 2026-06-17 13:47 ` applied: [PATCH proxmox-yew-comp 0/2] fix: user_panel: show confirmation dialog and disable remove button Dominik Csapak
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox