[yew-devel] [PATCH yew-comp 3/4] login panel/realm selector: make realm path configurable

Dominik Csapak d.csapak at proxmox.com
Tue Jul 1 10:38:58 CEST 2025


sometimes, the path to the publicly available realm list has a different
api path, for example in PMG. To make it usable there, make the path
configurable but default to the old one

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/login_panel.rs    | 6 ++++++
 src/realm_selector.rs | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/login_panel.rs b/src/login_panel.rs
index fabe271..3c16ed4 100644
--- a/src/login_panel.rs
+++ b/src/login_panel.rs
@@ -40,6 +40,11 @@ pub struct LoginPanel {
     #[prop_or(false)]
     #[builder]
     pub mobile: bool,
+
+    /// The path to the domain api call, default is defined in the [RealmSelector]
+    #[prop_or_default]
+    #[builder]
+    pub domain_path: Option<AttrValue>,
 }
 
 impl Default for LoginPanel {
@@ -194,6 +199,7 @@ impl ProxmoxLoginPanel {
                 RealmSelector::new()
                     .name("realm")
                     .label_id(realm_label_id)
+                    .path(props.domain_path.clone())
                     .default(default_realm),
             )
             .with_child(
diff --git a/src/realm_selector.rs b/src/realm_selector.rs
index 6522c59..fa144c4 100644
--- a/src/realm_selector.rs
+++ b/src/realm_selector.rs
@@ -42,6 +42,11 @@ pub struct RealmSelector {
     #[builder(IntoPropValue, into_prop_value)]
     #[prop_or_default]
     pub default: Option<AttrValue>,
+
+    /// The path for getting the realm list
+    #[builder]
+    #[prop_or(Some("/access/domains".into()))]
+    pub path: Option<AttrValue>,
 }
 
 impl Default for RealmSelector {
@@ -104,7 +109,7 @@ impl Component for ProxmoxRealmSelector {
             .with_input_props(&props.input_props)
             .required(true)
             .default(props.default.as_deref().unwrap_or("pam").to_string())
-            .loader("/access/domains")
+            .loader(props.path.clone())
             .validate(self.validate.clone())
             .into()
     }
-- 
2.39.5





More information about the yew-devel mailing list