From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 988FB1FF186 for ; Fri, 16 Jan 2026 09:31:34 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 34C6513036; Fri, 16 Jan 2026 09:31:39 +0100 (CET) Message-ID: Date: Fri, 16 Jan 2026 09:30:57 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta To: Proxmox Datacenter Manager development discussion , Shannon Sterz References: <20260112122420.228501-1-s.sterz@proxmox.com> <20260112122420.228501-2-s.sterz@proxmox.com> Content-Language: en-US From: Dominik Csapak In-Reply-To: <20260112122420.228501-2-s.sterz@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1768552215824 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.030 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pdm-devel] [PATCH yew-comp 1/1] user panel: add a parameter to set the current product's realm X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" LGTM Reviewed-by: Dominik Csapak On 1/12/26 1:24 PM, Shannon Sterz wrote: > so that password and confirm password fields can be ommitted > appropriatelly when adding users and the "change password" button is > disabled appropriatelly. > > Signed-off-by: Shannon Sterz > --- > src/user_panel.rs | 33 ++++++++++++++++++++++++++------- > 1 file changed, 26 insertions(+), 7 deletions(-) > > diff --git a/src/user_panel.rs b/src/user_panel.rs > index c6d0b56..547fdfe 100644 > --- a/src/user_panel.rs > +++ b/src/user_panel.rs > @@ -4,7 +4,9 @@ use std::rc::Rc; > > use anyhow::Error; > use proxmox_client::ApiResponseData; > +use pwt_macros::builder; > use serde_json::Value; > +use yew::html::IntoPropValue; > > use proxmox_access_control::types::UserWithTokens; > use proxmox_auth_api::types::Username; > @@ -89,7 +91,13 @@ async fn update_user(form_ctx: FormContext) -> Result<(), Error> { > } > > #[derive(PartialEq, Properties)] > -pub struct UserPanel {} > +#[builder] > +pub struct UserPanel { > + /// The realm of the current product. For example: "pdm" > + #[builder(IntoPropValue, into_prop_value)] > + #[prop_or_default] > + product_realm: Option, > +} > > impl Default for UserPanel { > fn default() -> Self { > @@ -99,7 +107,7 @@ impl Default for UserPanel { > > impl UserPanel { > pub fn new() -> Self { > - Self {} > + yew::props!(Self {}) > } > } > > @@ -119,6 +127,7 @@ pub struct ProxmoxUserPanel { > state: LoadableComponentState, > store: Store, > selection: Selection, > + product_realm: Option, > } > > pwt::impl_deref_mut_property!(ProxmoxUserPanel, state, LoadableComponentState); > @@ -154,6 +163,7 @@ impl LoadableComponent for ProxmoxUserPanel { > state: LoadableComponentState::new(), > store, > selection, > + product_realm: ctx.props().product_realm.clone(), > } > } > > @@ -180,7 +190,11 @@ impl LoadableComponent for ProxmoxUserPanel { > let no_selection = self.selection.is_empty(); > let disable_change_password = self > .get_selected_user() > - .map(|user| user.user.userid.realm().as_str() == "pam") > + .and_then(|user| { > + self.product_realm > + .as_ref() > + .map(|p| p != user.user.userid.realm().as_str()) > + }) > .unwrap_or(no_selection); > > let toolbar = Toolbar::new() > @@ -279,8 +293,9 @@ impl ProxmoxUserPanel { > } > > fn create_add_dialog(&self, ctx: &LoadableComponentContext) -> Html { > + let product_realm = self.product_realm.clone(); > EditWindow::new(tr!("Add") + ": " + &tr!("User")) > - .renderer(add_user_input_panel) > + .renderer(move |form_ctx| add_user_input_panel(form_ctx, &product_realm)) > .on_submit(create_user) > .on_done(ctx.link().change_view_callback(|_| None)) > .on_change(check_confirm_password) > @@ -484,8 +499,12 @@ fn password_change_input_panel(_form_ctx: &FormContext) -> Html { > .into() > } > > -fn add_user_input_panel(form_ctx: &FormContext) -> Html { > - let is_pam = form_ctx.read().get_field_text("realm") == "pam"; > +fn add_user_input_panel(form_ctx: &FormContext, product_realm: &Option) -> Html { > + let realm = form_ctx.read().get_field_text("realm"); > + let is_product_realm = product_realm > + .as_deref() > + .map(|p| p == realm) > + .unwrap_or_default(); > > let mut panel = InputPanel::new() > .padding(4) > @@ -506,7 +525,7 @@ fn add_user_input_panel(form_ctx: &FormContext) -> Html { > .submit(false), > ); > > - if !is_pam { > + if is_product_realm { > panel = panel > .with_field( > tr!("Password"), _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel