From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager v2] ui: pve tree: ellipsize overly long resource name to avoid overflow
Date: Thu, 30 Jan 2025 12:07:40 +0100 [thread overview]
Message-ID: <20250130110740.669191-1-d.csapak@proxmox.com> (raw)
due to how the html/css layout is constructed, we have to manually take
care of the (text)overflow here to have properly ellipsized text when the
column gets too small.
To do this for all resources types, rework the markup generation here a
bit, so that it's more consistent (e.g. same gap, align-items,etc).
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes from v1:
* reworked the whole column since this is relevant for all types of
resources not only lxc. Thanks for @Thomas to notice that!
(I did and tested with containers and forgot to do it for the rest,
oops...)
ui/src/pve/tree.rs | 55 +++++++++++++++++++++++-----------------------
1 file changed, 28 insertions(+), 27 deletions(-)
diff --git a/ui/src/pve/tree.rs b/ui/src/pve/tree.rs
index 50a5ae4..e74b187 100644
--- a/ui/src/pve/tree.rs
+++ b/ui/src/pve/tree.rs
@@ -532,35 +532,36 @@ fn columns(
.flex(1)
.tree_column(store)
.render(move |entry: &PveTreeNode| {
- let el = match entry {
- PveTreeNode::Root if loading => Row::new()
- .class(AlignItems::Center)
- .gap(4)
- .with_child(Container::from_tag("i").class("pwt-loading-icon"))
- .with_child(tr!("Querying Remote...")),
- PveTreeNode::Root => Row::new()
- .class(AlignItems::Baseline)
- .gap(2)
- .with_child(Fa::new("server"))
- .with_child(tr!("Remote")),
- PveTreeNode::Node(r) => Row::new()
- .class(AlignItems::Baseline)
- .gap(4)
- .with_child(utils::render_node_status_icon(r))
- .with_child(&r.node),
- PveTreeNode::Qemu(r) => Row::new()
- .class(AlignItems::Baseline)
- .gap(2)
- .with_child(utils::render_qemu_status_icon(r))
- .with_child(render_qemu_name(r, true)),
- PveTreeNode::Lxc(r) => Row::new()
- .class(AlignItems::Baseline)
- .gap(2)
- .with_child(utils::render_lxc_status_icon(r))
- .with_child(render_lxc_name(r, true)),
+ let (icon, text) = match entry {
+ PveTreeNode::Root if loading => (
+ Container::from_tag("i").class("pwt-loading-icon"),
+ tr!("Querying Remote..."),
+ ),
+ PveTreeNode::Root => (
+ Container::new().with_child(Fa::new("server")),
+ tr!("Remote"),
+ ),
+ PveTreeNode::Node(r) => (utils::render_node_status_icon(r), r.node.to_string()),
+ PveTreeNode::Qemu(r) => {
+ (utils::render_qemu_status_icon(r), render_qemu_name(r, true))
+ }
+ PveTreeNode::Lxc(r) => {
+ (utils::render_lxc_status_icon(r), render_lxc_name(r, true))
+ }
};
- Container::new().with_child(el).into()
+ Row::new()
+ .min_width(0)
+ .class(AlignItems::Center)
+ .gap(2)
+ .with_child(icon)
+ .with_child(
+ Container::new()
+ .with_child(text)
+ .style("text-overflow", "ellipsis")
+ .style("overflow", "hidden"),
+ )
+ .into()
})
.into(),
DataTableColumn::new(tr!("Tags"))
--
2.39.5
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next reply other threads:[~2025-01-30 11:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-30 11:07 Dominik Csapak [this message]
2025-01-30 15:36 ` [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=20250130110740.669191-1-d.csapak@proxmox.com \
--to=d.csapak@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