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 F40E51FF17E for ; Thu, 27 Nov 2025 17:13:31 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9A0998843; Thu, 27 Nov 2025 17:13:52 +0100 (CET) Date: Thu, 27 Nov 2025 17:13:09 +0100 Message-Id: Cc: "pdm-devel" From: =?utf-8?q?Michael_K=C3=B6ppl?= To: "Proxmox Datacenter Manager development discussion" Mime-Version: 1.0 X-Mailer: aerc 0.21.0 References: <20251127140451.3131469-1-d.csapak@proxmox.com> <20251127140451.3131469-5-d.csapak@proxmox.com> In-Reply-To: <20251127140451.3131469-5-d.csapak@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1764259951529 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.036 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 datacenter-manager 4/4] ui: dashboard: subscriptions details: add a 'force refresh' button 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" 1 nit inline On Thu Nov 27, 2025 at 3:03 PM CET, Dominik Csapak wrote: > pub fn create_subscription_panel( > diff --git a/ui/src/dashboard/view.rs b/ui/src/dashboard/view.rs > index 2adcee53..2791277b 100644 > --- a/ui/src/dashboard/view.rs > +++ b/ui/src/dashboard/view.rs > @@ -95,6 +95,7 @@ pub enum Msg { > ShowSubscriptionsDialog(bool), > LayoutUpdate(ViewLayout), > UpdateResult(Result<(), Error>), > + ForceSubscriptionUpdate, > } > > struct ViewComp { > @@ -425,6 +426,22 @@ impl Component for ViewComp { > Msg::UpdateResult(res) => { > self.update_result.update(res); > } > + Msg::ForceSubscriptionUpdate => { > + let link = ctx.link().clone(); > + let view = ctx.props().view.clone(); > + self.render_args.subscriptions.write().clear(); nit: Clearing here means that if fetching the subscriptions takes longer for some reason, the user will look at an empty box until the data could be fetched. Could it make sense to move clearing this to after the request is done by perhaps tracking the loading state in some way? > + self.async_pool.spawn(async move { > + let mut params = json!({ > + "verbose": true, > + "max-age": 0, > + }); > + if let Some(view) = view { > + params["view"] = view.to_string().into(); > + } > + let res = http_get("/resources/subscription", Some(params)).await; here > + link.send_message(Msg::LoadingResult(LoadingResult::SubscriptionInfo(res))); > + }); > + } > } > true > } > @@ -547,14 +564,14 @@ impl Component for ViewComp { > .on_submit(move |ctx| crate::remotes::create_remote(ctx, remote_type)) > })); > > - view.add_optional_child(if self.subscriptions_dialog { > - create_subscriptions_dialog( > - self.render_args.subscriptions.clone(), > - ctx.link().callback(|_| Msg::ShowSubscriptionsDialog(false)), > - ) > - } else { > - None > - }); > + view.add_optional_child( > + self.subscriptions_dialog > + .then_some(create_subscriptions_dialog( > + self.render_args.subscriptions.clone(), > + ctx.link().callback(|_| Msg::ShowSubscriptionsDialog(false)), > + ctx.link().callback(|_| Msg::ForceSubscriptionUpdate), > + )), > + ); > > let view_context = ViewContext { > name: props.view.clone(), > diff --git a/ui/src/load_result.rs b/ui/src/load_result.rs > index 4f3e6d5a..55436fd1 100644 > --- a/ui/src/load_result.rs > +++ b/ui/src/load_result.rs > @@ -33,6 +33,12 @@ impl LoadResult { > pub fn has_data(&self) -> bool { > self.data.is_some() || self.error.is_some() > } > + > + /// Clears both data and the error from the result. > + pub fn clear(&mut self) { > + self.data = None; > + self.error = None; > + } > } > > impl Default for LoadResult { _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel