From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id EC2FB1FF179 for ; Wed, 26 Nov 2025 16:19:25 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id CC0DF106F3; Wed, 26 Nov 2025 16:19:37 +0100 (CET) From: Dominik Csapak To: pdm-devel@lists.proxmox.com Date: Wed, 26 Nov 2025 16:18:14 +0100 Message-ID: <20251126151833.3637080-22-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251126151833.3637080-1-d.csapak@proxmox.com> References: <20251126151833.3637080-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 v5 21/26] ui: resource tree: move error message into first column 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" this makes the 'node' column much more predictable, so we can set a fixed width that should be enough for most nodenames instead of using up much space (double than the 'id' one). To properly display the error, we can use the 'colspan' attribute when we use `render_cell` in the first column. Signed-off-by: Dominik Csapak --- ui/src/widget/resource_tree.rs | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/ui/src/widget/resource_tree.rs b/ui/src/widget/resource_tree.rs index 8ad2ba7e..795e9f49 100644 --- a/ui/src/widget/resource_tree.rs +++ b/ui/src/widget/resource_tree.rs @@ -13,8 +13,8 @@ use pwt::{ state::{Selection, TreeStore}, widget::{ data_table::{ - DataTable, DataTableColumn, DataTableHeader, DataTableKeyboardEvent, - DataTableMouseEvent, + DataTable, DataTableCellRenderArgs, DataTableColumn, DataTableHeader, + DataTableKeyboardEvent, DataTableMouseEvent, }, ActionIcon, Column, Container, Fa, Panel, Progress, Row, Tooltip, }, @@ -312,8 +312,10 @@ fn columns( DataTableColumn::new(tr!("ID")) .tree_column(store) .flex(1) - .render(|item: &PdmTreeEntry| { - let (icon, text, tooltip) = match item { + .render_cell(|args: &mut DataTableCellRenderArgs| { + let item = args.record(); + let mut colspan = false; + let (icon, text, tooltip) = match &item { PdmTreeEntry::Root => ( Container::new().with_child(Fa::new("server").fixed_width()), String::from("root"), @@ -331,24 +333,32 @@ fn columns( .with_optional_child(err.is_some().then_some( Fa::from(Status::Error).fixed_width().class("status-icon"), )), - remote.clone(), + match err { + Some(err) => { + colspan = true; + format!("{remote} - {err}").into() + } + None => remote.into(), + }, err.as_ref().map(|err| err.to_string()), ), }; + if colspan { + args.set_attribute("colspan", "2"); + } Tooltip::new(Row::new().gap(4).with_child(icon).with_child(text)) .tip(tooltip) .into() }) .into(), - DataTableColumn::new(tr!("Node/Error")) - .flex(2) + DataTableColumn::new("Node") + .width("150px") .render(|item: &PdmTreeEntry| { match item { PdmTreeEntry::Root => "", PdmTreeEntry::Resource(_, resource) => { get_resource_node(resource).unwrap_or("") } - PdmTreeEntry::Remote(_, Some(err)) => err, PdmTreeEntry::Remote(_, _) => "", } .into() -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel