public inbox for yew-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shannon Sterz <s.sterz@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [yew-devel] [PATCH yew-comp] fix #6885: auth_view: select appropriate base url for removing realms
Date: Thu,  2 Oct 2025 16:35:32 +0200	[thread overview]
Message-ID: <20251002143532.286752-1-s.sterz@proxmox.com> (raw)

previously trying to remove a realm failed because the base_url to
query realms is not the same for removing a realm. the later depends
on the type of the realm, so query the type to get the appropriate
url.

Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=6885
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
 src/auth_view.rs | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/auth_view.rs b/src/auth_view.rs
index f957e65..aac08e0 100644
--- a/src/auth_view.rs
+++ b/src/auth_view.rs
@@ -203,13 +203,22 @@ impl LoadableComponent for ProxmoxAuthView {
         match msg {
             Msg::Redraw => true,
             Msg::Remove => {
-                let info = match self.get_selected_record() {
-                    Some(info) => info,
-                    None => return true,
+                let Some(info) = self.get_selected_record() else {
+                    return true;
+                };
+
+                let base_url = match info.ty.as_str() {
+                    "openid" => &props.openid_base_url,
+                    "ldap" => &props.ldap_base_url,
+                    "ad" => &props.ad_base_url,
+                    _ => return true,
+                };
+
+                let Some(base_url) = base_url.clone() else {
+                    return true;
                 };
 
                 let link = ctx.link();
-                let base_url = props.base_url.clone();
                 link.clone().spawn(async move {
                     if let Err(err) = delete_item(base_url, info.realm.into()).await {
                         link.show_error(tr!("Unable to delete item"), err, true);
-- 
2.47.3



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


             reply	other threads:[~2025-10-02 14:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-02 14:35 Shannon Sterz [this message]
2025-10-03  5:39 ` [yew-devel] applied: " Dietmar Maurer

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