From: "Michael Köppl" <m.koeppl@proxmox.com>
To: "Proxmox Datacenter Manager development discussion"
<pdm-devel@lists.proxmox.com>
Cc: "pdm-devel" <pdm-devel-bounces@lists.proxmox.com>
Subject: Re: [pdm-devel] [PATCH datacenter-manager 4/4] ui: dashboard: subscriptions details: add a 'force refresh' button
Date: Thu, 27 Nov 2025 17:13:09 +0100 [thread overview]
Message-ID: <DEJLYY9YQTTO.ROVZ6G5JFE1K@proxmox.com> (raw)
In-Reply-To: <20251127140451.3131469-5-d.csapak@proxmox.com>
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<T, E> LoadResult<T, E> {
> 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<T, E> Default for LoadResult<T, E> {
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply other threads:[~2025-11-27 16:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-27 14:03 [pdm-devel] [PATCH datacenter-manager 0/4] improve subscription display in Dominik Csapak
2025-11-27 14:03 ` [pdm-devel] [PATCH datacenter-manager 1/4] ui: dashboard: subscriptions: refactor subscriptions show logic Dominik Csapak
2025-11-27 14:03 ` [pdm-devel] [PATCH datacenter-manager 2/4] ui: dashboard: subscriptions list: update store when data changes Dominik Csapak
2025-11-27 14:03 ` [pdm-devel] [PATCH datacenter-manager 3/4] ui: dashboard: subscriptions list: improve display of subscription state Dominik Csapak
2025-11-27 14:03 ` [pdm-devel] [PATCH datacenter-manager 4/4] ui: dashboard: subscriptions details: add a 'force refresh' button Dominik Csapak
2025-11-27 16:13 ` Michael Köppl [this message]
2025-11-27 21:10 ` Thomas Lamprecht
2025-11-27 16:13 ` [pdm-devel] [PATCH datacenter-manager 0/4] improve subscription display in Michael Köppl
2025-11-27 21:12 ` [pdm-devel] applied: " Thomas Lamprecht
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=DEJLYY9YQTTO.ROVZ6G5JFE1K@proxmox.com \
--to=m.koeppl@proxmox.com \
--cc=pdm-devel-bounces@lists.proxmox.com \
--cc=pdm-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