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 CF1DA1FF17E for ; Thu, 27 Nov 2025 11:44:49 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A75141FEBC; Thu, 27 Nov 2025 11:45:06 +0100 (CET) From: Lukas Wagner To: pdm-devel@lists.proxmox.com Date: Thu, 27 Nov 2025 11:44:42 +0100 Message-ID: <20251127104447.162951-14-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: 1764240257808 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 datacenter-manager 08/13] ui: remote updates: show main product version in overview table 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" Signed-off-by: Lukas Wagner --- ui/src/remotes/updates.rs | 79 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 5 deletions(-) diff --git a/ui/src/remotes/updates.rs b/ui/src/remotes/updates.rs index 895eaa13..e13e3831 100644 --- a/ui/src/remotes/updates.rs +++ b/ui/src/remotes/updates.rs @@ -1,4 +1,5 @@ use std::cmp::Ordering; +use std::collections::BTreeMap; use std::ops::Deref; use std::pin::Pin; use std::rc::Rc; @@ -53,6 +54,8 @@ impl From for VNode { struct RemoteEntry { remote: String, ty: RemoteType, + product_version: Option, + mixed_versions: bool, number_of_failed_nodes: u32, number_of_nodes: u32, number_of_updatable_nodes: u32, @@ -125,7 +128,7 @@ impl UpdateTreeComponent { Rc::new(vec![ DataTableColumn::new(tr!("Name")) .tree_column(store) - .flex(1) + .flex(2) .render(|entry: &UpdateTreeEntry| { let icon = match entry { UpdateTreeEntry::Remote(_) => Some("server"), @@ -142,8 +145,16 @@ impl UpdateTreeComponent { }) .sorter(default_sorter) .into(), + DataTableColumn::new(tr!("Version")) + .flex(1) + .render_cell(DataTableCellRenderer::new( + move |args: &mut DataTableCellRenderArgs| { + render_version_column(args.record(), args.is_expanded()) + }, + )) + .into(), DataTableColumn::new(tr!("Status")) - .flex(3) + .flex(6) .render_cell(DataTableCellRenderer::new( move |args: &mut DataTableCellRenderArgs| match args.record() { UpdateTreeEntry::Root => { @@ -184,6 +195,8 @@ fn build_store_from_response(update_summary: UpdateSummary) -> SlabTree SlabTree { if node_summary.number_of_updates > 0 { @@ -207,19 +226,35 @@ fn build_store_from_response(update_summary: UpdateSummary) -> SlabTree Row { .with_child(text) } +fn render_version_column(tree_entry: &UpdateTreeEntry, expanded: bool) -> Html { + let text = match tree_entry { + UpdateTreeEntry::Node(node_entry) => { + get_product_version(node_entry).unwrap_or_default().into() + } + UpdateTreeEntry::Remote(remote_entry) => { + if !expanded { + let version_string = remote_entry.product_version.clone().unwrap_or_default(); + // TRANSLATORS: The first parameter is a version string (e.g. '9.1.0') + tr!("{0} (mixed versions)", version_string) + } else { + "".to_string() + } + } + _ => "".to_string(), + }; + + text.into() +} + +fn get_product_version(node_entry: &NodeEntry) -> Option { + let package = match node_entry.ty { + RemoteType::Pve => "pve-manager", + RemoteType::Pbs => "proxmox-backup-server", + }; + + node_entry + .summary + .versions + .iter() + .find(|p| p.package == package) + .map(|p| p.version.to_string()) +} + enum RemoteSummaryIcon { UpToDate, Updatable, -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel