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 6C3191FF17E for ; Thu, 27 Nov 2025 11:45:09 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 309594E; Thu, 27 Nov 2025 11:45:29 +0100 (CET) From: Lukas Wagner To: pdm-devel@lists.proxmox.com Date: Thu, 27 Nov 2025 11:44:34 +0100 Message-ID: <20251127104447.162951-6-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251127104447.162951-1-l.wagner@proxmox.com> References: <20251127104447.162951-1-l.wagner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1764240256752 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.032 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 proxmox-yew-comp 1/1] apt repositories: add 'status_only' property 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" If enabled, this will only show the upper status message table (e.g. 'You get updates for ...'). While it would be better to split out the status message table into its own little component, this is a much bigger task than just adding the new property and a couple of if-guards in the render function. Given the time constaints this was the better choice. Extracting the component can always be done at a later point in time. Signed-off-by: Lukas Wagner --- src/apt_repositories.rs | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/src/apt_repositories.rs b/src/apt_repositories.rs index fc5c1a9..5cd0ffa 100644 --- a/src/apt_repositories.rs +++ b/src/apt_repositories.rs @@ -47,6 +47,11 @@ pub struct AptRepositories { #[builder(IntoPropValue, into_prop_value)] #[prop_or_default] pub product: Option, + + /// Show status message table only. + #[builder(IntoPropValue, into_prop_value)] + #[prop_or_default] + pub status_only: bool, } impl Default for AptRepositories { @@ -545,7 +550,25 @@ impl LoadableComponent for ProxmoxAptRepositories { } } + fn changed( + &mut self, + ctx: &LoadableComponentContext, + old_props: &Self::Properties, + ) -> bool { + let props = ctx.props(); + + if props.base_url != old_props.base_url || props.product != old_props.product { + ctx.link().send_reload(); + true + } else { + false + } + } + fn toolbar(&self, ctx: &LoadableComponentContext) -> Option { + if ctx.props().status_only { + return None; + } let selected_record = self.selected_record(); let toolbar = Toolbar::new() @@ -581,7 +604,17 @@ impl LoadableComponent for ProxmoxAptRepositories { Some(toolbar.into()) } - fn main_view(&self, _ctx: &LoadableComponentContext) -> Html { + fn main_view(&self, ctx: &LoadableComponentContext) -> Html { + let status = DataTable::new(self.status_columns.clone(), self.status_store.clone()) + .class("pwt-flex-fit") + .show_header(false) + .striped(false) + .borderless(true); + + if ctx.props().status_only { + return status.into(); + } + let table = DataTable::new(self.columns.clone(), self.tree_store.clone()) .selection(self.selection.clone()) .class("pwt-flex-fit pwt-border-top") @@ -589,12 +622,6 @@ impl LoadableComponent for ProxmoxAptRepositories { let mut panel = Column::new().class("pwt-flex-fit"); - let status = DataTable::new(self.status_columns.clone(), self.status_store.clone()) - .class("pwt-flex-fit") - .show_header(false) - .striped(false) - .borderless(true); - panel.add_child(Row::new().padding(4).with_child(status)); panel.with_child(table).into() -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel