From: "Shan Shaji" <s.shaji@proxmox.com>
To: "Shannon Sterz" <s.sterz@proxmox.com>, <pdm-devel@lists.proxmox.com>
Subject: Re: [PATCH yew-comp 2/3] auth_view: enable editing of default realms
Date: Wed, 24 Jun 2026 16:27:38 +0200 [thread overview]
Message-ID: <DJHCM0NRT5PL.3H3B3FAETPNHE@proxmox.com> (raw)
In-Reply-To: <20260618102126.177217-3-s.sterz@proxmox.com>
On Thu Jun 18, 2026 at 12:21 PM CEST, Shannon Sterz wrote:
> so users can set custom comments and mark them as default realm if
> required.
>
> Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
> ---
> src/auth_view.rs | 52 ++++++++++++++++++++++++++++++++++++++++++++++--
> src/utils/mod.rs | 4 ++--
> 2 files changed, 52 insertions(+), 4 deletions(-)
>
> diff --git a/src/auth_view.rs b/src/auth_view.rs
> index 9a06979..8be682a 100644
> --- a/src/auth_view.rs
> +++ b/src/auth_view.rs
> @@ -5,7 +5,7 @@ use std::rc::Rc;
> use anyhow::Error;
>
> use proxmox_client::ApiResponseData;
> -use pwt::widget::form::{Checkbox, FormContext, TristateBoolean};
> +use pwt::widget::form::{Checkbox, DisplayField, Field, FormContext, TristateBoolean};
> use serde_json::Value;
> use yew::html::IntoPropValue;
> use yew::virtual_dom::{VComp, VNode};
> @@ -19,6 +19,7 @@ use pwt::widget::{Button, Container, Fa, InputPanel, Toolbar};
>
> use pwt_macros::builder;
>
> +use crate::form::delete_empty_values;
> use crate::{
> AuthEditLDAP, AuthEditOpenID, EditWindow, LoadableComponent, LoadableComponentContext,
> LoadableComponentMaster, LoadableComponentScope, LoadableComponentScopeExt,
> @@ -37,6 +38,12 @@ pub struct AuthView {
> /// The base url for
> pub base_url: AttrValue,
>
> + /// The base URL to edit the default realms (pam, pve, pdm, pbs etc.). Specify `None` if
> + /// editing the default realms is not supported.
> + #[prop_or(Some("/config/access/".into()))]
small nit: Do we need the forward slash here at the end, since a forward
slash is added later while creating the request url?
> + #[builder(IntoPropValue, into_prop_value)]
> + pub edit_default_realms_base_url: Option<AttrValue>,
> +
> /// Allow to add/edit OpenID entries
> #[builder(IntoPropValue, into_prop_value)]
> #[prop_or_default]
> @@ -73,6 +80,7 @@ pub enum ViewState {
> EditOpenID(AttrValue),
> EditLDAP(AttrValue),
> EditAd(AttrValue),
> + EditDefaultRealm(AttrValue),
> Sync(BasicRealmInfo),
> }
>
> @@ -164,6 +172,33 @@ async fn load_realm(url: impl Into<String>) -> Result<ApiResponseData<Value>, Er
> Ok(response)
> }
>
> +fn edit_default_realm(realm: AttrValue, url: AttrValue) -> EditWindow {
> + let url = format!("{url}/{realm}");
I meant here.
> + EditWindow::new(tr!("Edit: {realm}", realm))
> + .loader(url.clone())
> + .renderer({
> + move |_form_ctx: &FormContext| {
> + InputPanel::new()
> + .padding(4)
> + .with_field(
> + tr!("Realm"),
> + DisplayField::new().name("realm").submit(false),
> + )
> + .with_right_field(tr!("Default Realm"), Checkbox::new().name("default"))
> + .with_large_field(tr!("Comment"), Field::new().name("comment"))
> + .into()
> + }
> + })
> + .on_submit(move |form_ctx: FormContext| {
> + let url = url.clone();
> + async move {
> + let data = form_ctx.get_submit_data();
> + let data = delete_empty_values(&data, &["comment"], true);
> + crate::http_put(&url, Some(data)).await
> + }
> + })
> +}
> +
> impl ProxmoxAuthView {
> fn get_selected_record(&self) -> Option<BasicRealmInfo> {
> let selected_key = self.selection.selected_key();
> @@ -254,6 +289,11 @@ impl LoadableComponent for ProxmoxAuthView {
> "ad" if props.ad_base_url.is_some() => {
> Some(ViewState::EditAd(info.realm.into()))
> }
> + "pam" | "pbs" | "pdm" | "pve"
> + if props.edit_default_realms_base_url.is_some() =>
> + {
> + Some(ViewState::EditDefaultRealm(info.realm.into()))
> + }
> _ => return true,
> };
>
> @@ -285,7 +325,7 @@ impl LoadableComponent for ProxmoxAuthView {
> if let Some(auth_info) = crate::utils::get_auth_domain_info(&realm_info.ty) {
> sync_disabled = !auth_info.sync;
> remove_disabled = !auth_info.add;
> - edit_disabled = !auth_info.add;
> + edit_disabled = !auth_info.edit;
> }
> }
>
[...]
next prev parent reply other threads:[~2026-06-24 14:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-18 10:21 [PATCH datacenter-manager/yew-comp 0/3] Allow Editing of Default Realms in PDM Shannon Sterz
2026-06-18 10:21 ` [PATCH datacenter-manager 1/3] server: api: access: add endpoints for configuring pdm and pam realms Shannon Sterz
2026-06-24 12:45 ` Shan Shaji
2026-06-18 10:21 ` [PATCH yew-comp 2/3] auth_view: enable editing of default realms Shannon Sterz
2026-06-24 14:27 ` Shan Shaji [this message]
2026-06-18 10:21 ` [PATCH yew-comp 3/3] auth_view: clarify the documentation of pre-existing properties Shannon Sterz
2026-06-24 13:10 ` [PATCH datacenter-manager/yew-comp 0/3] Allow Editing of Default Realms in PDM Shan Shaji
2026-06-25 12:54 ` Superseded: " Shannon Sterz
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=DJHCM0NRT5PL.3H3B3FAETPNHE@proxmox.com \
--to=s.shaji@proxmox.com \
--cc=pdm-devel@lists.proxmox.com \
--cc=s.sterz@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