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 551681FF184 for ; Thu, 4 Dec 2025 15:24:58 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 771D818BF; Thu, 4 Dec 2025 15:25:25 +0100 (CET) From: Dominik Csapak To: pdm-devel@lists.proxmox.com Date: Thu, 4 Dec 2025 15:20:27 +0100 Message-ID: <20251204142451.2992215-4-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251204142451.2992215-1-d.csapak@proxmox.com> References: <20251204142451.2992215-1-d.csapak@proxmox.com> MIME-Version: 1.0 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pdm-devel] [PATCH datacenter-manager 3/5] ui: configuration: subscription: improve behavior on 'check' 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" Since the subscription check/load can take a bit, disable the 'check' button during a check operation and let the refresh button indicate a load. Signed-off-by: Dominik Csapak --- ui/src/configuration/subscription_panel.rs | 42 +++++++++++----------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/ui/src/configuration/subscription_panel.rs b/ui/src/configuration/subscription_panel.rs index 8f3a4b9d..b2d50957 100644 --- a/ui/src/configuration/subscription_panel.rs +++ b/ui/src/configuration/subscription_panel.rs @@ -26,6 +26,7 @@ impl SubscriptionPanel { } pub enum Msg { + Checking, LoadFinished(Value), } @@ -33,6 +34,7 @@ pub struct ProxmoxSubscriptionPanel { rows: Rc>, data: Option>, loaded: bool, + checking: bool, } impl LoadableComponent for ProxmoxSubscriptionPanel { @@ -45,14 +47,29 @@ impl LoadableComponent for ProxmoxSubscriptionPanel { rows: Rc::new(rows()), data: None, loaded: false, + checking: false, } } - fn update(&mut self, _ctx: &LoadableComponentContext, msg: Self::Message) -> bool { + fn update(&mut self, ctx: &LoadableComponentContext, msg: Self::Message) -> bool { match msg { Msg::LoadFinished(value) => { self.data = Some(Rc::new(value)); self.loaded = true; + self.checking = false; + } + Msg::Checking => { + self.checking = true; + let link = ctx.link(); + link.spawn({ + let link = link.clone(); + async move { + match http_post(SUBSCRIPTION_URL, None).await { + Ok(()) => link.send_reload(), + Err(err) => link.show_error(tr!("Error"), err.to_string(), true), + } + } + }); } } true @@ -71,36 +88,21 @@ impl LoadableComponent for ProxmoxSubscriptionPanel { } fn toolbar(&self, ctx: &LoadableComponentContext) -> Option { + let link = ctx.link(); let toolbar = Toolbar::new() .class("pwt-overflow-hidden") .border_bottom(true) .with_child( Button::new(tr!("Check")) + .disabled(self.checking) .icon_class("fa fa-check-square-o") - .on_activate({ - let link = ctx.link(); - - move |_| { - link.spawn({ - let link = link.clone(); - async move { - match http_post(SUBSCRIPTION_URL, None).await { - Ok(()) => link.send_reload(), - Err(err) => { - link.show_error(tr!("Error"), err.to_string(), true) - } - } - } - }) - } - }), + .on_activate(link.callback(|_| Msg::Checking)), ) .with_spacer() .with_flex_spacer() .with_child({ let loading = ctx.loading(); - let link = ctx.link(); - Button::refresh(loading).on_activate(move |_| link.send_reload()) + Button::refresh(loading || self.checking).on_activate(move |_| link.send_reload()) }); Some(toolbar.into()) -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel