From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager v4 09/10] ui: pve: node selector: sort memory columns by usage not by memory size
Date: Wed, 23 Sep 2026 15:17:09 +0200 [thread overview]
Message-ID: <20260923131857.2953139-10-d.csapak@proxmox.com> (raw)
In-Reply-To: <20260923131857.2953139-1-d.csapak@proxmox.com>
We only show the usage, so it makes sense to sort by that instead of the
raw memory size value.
Use total_cmp for floats, which sorts (+/-)NaN/Infinity separate from
finite values.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
ui/src/widget/pve_node_selector.rs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/ui/src/widget/pve_node_selector.rs b/ui/src/widget/pve_node_selector.rs
index d471780e..5882f532 100644
--- a/ui/src/widget/pve_node_selector.rs
+++ b/ui/src/widget/pve_node_selector.rs
@@ -261,7 +261,11 @@ fn columns(show_memory: bool) -> Rc<Vec<DataTableHeader<PveNodeResource>>> {
}
html! {format!("{:.2}%", 100.0 * entry.mem as f64 / entry.maxmem as f64)}
})
- .sorter(|a: &PveNodeResource, b: &PveNodeResource| a.mem.cmp(&b.mem))
+ .sorter(|a: &PveNodeResource, b: &PveNodeResource| {
+ let a = (a.mem as f64) / (a.maxmem as f64);
+ let b = (b.mem as f64) / (b.maxmem as f64);
+ a.total_cmp(&b)
+ })
.into(),
);
}
--
2.47.3
next prev parent reply other threads:[~2026-09-23 13:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 13:17 [PATCH datacenter-manager v4 00/10] refactor and partially fix #7371 Dominik Csapak
2026-09-23 13:17 ` [PATCH datacenter-manager v4 01/10] lib: api types: add new ResourceView type and move accessors there Dominik Csapak
2026-09-23 13:17 ` [PATCH datacenter-manager v4 02/10] lib: api types: resource: add 'node' helper to ResourceView Dominik Csapak
2026-09-23 13:17 ` [PATCH datacenter-manager v4 03/10] lib: api types: add guest specific getter " Dominik Csapak
2026-09-23 13:17 ` [PATCH datacenter-manager v4 04/10] ui: pve: factor out the pve-manager version extraction Dominik Csapak
2026-09-23 13:17 ` [PATCH datacenter-manager v4 05/10] ui: renderer: use ResourceView for rendering Dominik Csapak
2026-09-23 13:17 ` [PATCH datacenter-manager v4 06/10] ui: pve: tree: reuse `PveResource` for `PveTreeNode` Dominik Csapak
2026-09-23 13:17 ` [PATCH datacenter-manager v4 07/10] ui: pve: show ha maintenance mode for nodes Dominik Csapak
2026-09-23 13:17 ` [PATCH datacenter-manager v4 08/10] ui: pve: node selector: show maintenance badge with node name Dominik Csapak
2026-09-23 13:17 ` Dominik Csapak [this message]
2026-09-23 13:17 ` [PATCH datacenter-manager v4 10/10] ui: pve: node: show ha maintenance badge Dominik Csapak
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=20260923131857.2953139-10-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