public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shannon Sterz <s.sterz@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager v2 6/6] ui: make the user tab reload when re-opened
Date: Mon, 22 Sep 2025 17:05:19 +0200	[thread overview]
Message-ID: <20250922150519.399573-14-s.sterz@proxmox.com> (raw)
In-Reply-To: <20250922150519.399573-1-s.sterz@proxmox.com>

otherwise the view would just be cached when switching between tabs.
this can lead to strange outcomes. for example, when a realm sync job
is run, switching back to the list of users still shows the old state.
by updating the key if the state of the tab changes to `visible` the
component is re-rendered and, thus, the load call in the component is
issued again.

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
 ui/src/configuration/mod.rs | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/ui/src/configuration/mod.rs b/ui/src/configuration/mod.rs
index 6ddc5f2..0a92796 100644
--- a/ui/src/configuration/mod.rs
+++ b/ui/src/configuration/mod.rs
@@ -43,6 +43,7 @@ pub fn system_configuration() -> Html {
 #[function_component(AccessControl)]
 pub fn access_control() -> Html {
     let acl_edit = AclEdit::new(tr!("Path"), PermissionPathSelector::new()).default_role("Auditor");
+    let user_management_revision = use_mut_ref(|| 0usize);
 
     let panel = TabPanel::new()
         .state_id(StorageLocation::session("AccessControlState"))
@@ -55,11 +56,20 @@ pub fn access_control() -> Html {
                 .key("user-management")
                 .icon_class("fa fa-user")
                 .label(tr!("User Management")),
-            |_| {
+            move |s| {
+                if s.visible {
+                    let mut guard = user_management_revision.borrow_mut();
+                    *guard = (*guard).wrapping_add(1);
+                }
                 Container::new()
                     .class("pwt-content-spacer")
                     .class(pwt::css::FlexFit)
                     .with_child(UserPanel::new())
+                    // forces a reload when the tab becomes visible again
+                    .key(format!(
+                        "user-management-{}",
+                        *user_management_revision.borrow()
+                    ))
                     .into()
             },
         )
-- 
2.47.3



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


  parent reply	other threads:[~2025-09-22 15:05 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-22 15:05 [pdm-devel] [PATCH datacenter-manager/proxmox/yew-comp v2 00/13] Add LDAP and AD realm support to Proxmox Datacenter Manager Shannon Sterz
2025-09-22 15:05 ` [pdm-devel] [PATCH proxmox v2 1/1] ldap: add types and sync features Shannon Sterz
2025-09-22 18:28   ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-22 15:05 ` [pdm-devel] [PATCH yew-comp v2 1/6] auth_view: add default column and allow setting ldap realms as default Shannon Sterz
2025-09-22 19:00   ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-22 15:05 ` [pdm-devel] [PATCH yew-comp v2 2/6] utils: add pdm realm to `get_auth_domain_info` Shannon Sterz
2025-09-22 19:00   ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-22 15:05 ` [pdm-devel] [PATCH yew-comp v2 3/6] auth_view/auth_edit_ldap: add support for active directory realms Shannon Sterz
2025-09-22 19:00   ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-22 15:05 ` [pdm-devel] [PATCH yew-comp v2 4/6] auth_edit_ldap: add helpers to properly edit ad & ldap realms Shannon Sterz
2025-09-22 19:00   ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-22 15:05 ` [pdm-devel] [PATCH yew-comp v2 5/6] auth_view: implement syncing ldap and ad realms Shannon Sterz
2025-09-22 19:00   ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-22 15:05 ` [pdm-devel] [PATCH yew-comp v2 6/6] auth_edit_ldap: improve form layout and placeholders Shannon Sterz
2025-09-22 19:00   ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-22 15:05 ` [pdm-devel] [PATCH datacenter-manager v2 1/6] config: add domain config plugins for ldap and ad realms Shannon Sterz
2025-09-22 19:03   ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-22 15:05 ` [pdm-devel] [PATCH datacenter-manager v2 2/6] server: add ldap and active directory authenticators Shannon Sterz
2025-09-22 19:03   ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-22 15:05 ` [pdm-devel] [PATCH datacenter-manager v2 3/6] server: api: add api endpoints for configuring ldap & ad realms Shannon Sterz
2025-09-22 19:03   ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-22 15:05 ` [pdm-devel] [PATCH datacenter-manager v2 4/6] api/auth: add endpoint to start ldap sync jobs Shannon Sterz
2025-09-22 19:03   ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-22 15:05 ` [pdm-devel] [PATCH datacenter-manager v2 5/6] ui: add a panel to allow handling realms Shannon Sterz
2025-09-22 19:03   ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-22 15:05 ` Shannon Sterz [this message]
2025-09-22 19:03   ` [pdm-devel] applied: [PATCH datacenter-manager v2 6/6] ui: make the user tab reload when re-opened Thomas Lamprecht

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=20250922150519.399573-14-s.sterz@proxmox.com \
    --to=s.sterz@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 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