public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] ui: datastore content: improve sorting verification column
@ 2021-10-27 12:58 Dominik Csapak
  2021-10-27 14:35 ` [pbs-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2021-10-27 12:58 UTC (permalink / raw)
  To: pbs-devel

sort failed < no verify < outdated < all ok

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/datastore/Content.js | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/www/datastore/Content.js b/www/datastore/Content.js
index 87a9079d..5f98653a 100644
--- a/www/datastore/Content.js
+++ b/www/datastore/Content.js
@@ -826,6 +826,23 @@ Ext.define('PBS.DataStoreContent', {
 	    sortable: true,
 	    dataIndex: 'verification',
 	    width: 120,
+	    sorter: (arec, brec) => {
+		let a = arec.data.verification || { ok: 0, outdated: 0, failed: 0 };
+		let b = brec.data.verification || { ok: 0, outdated: 0, failed: 0 };
+		if (a.failed === b.failed) {
+		    if (a.none === b.none) {
+			if (a.outdated === b.outdated) {
+			    return b.ok - a.ok;
+			} else {
+			    return b.outdated - a.outdated;
+			}
+		    } else {
+			return b.none - a.none;
+		    }
+		} else {
+		    return b.failed - a.failed;
+		}
+	    },
 	    renderer: (v, meta, record) => {
 		let i = (cls, txt) => `<i class="fa fa-fw fa-${cls}"></i> ${txt}`;
 		if (v === undefined || v === null) {
-- 
2.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pbs-devel] applied: [PATCH proxmox-backup] ui: datastore content: improve sorting verification column
  2021-10-27 12:58 [pbs-devel] [PATCH proxmox-backup] ui: datastore content: improve sorting verification column Dominik Csapak
@ 2021-10-27 14:35 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2021-10-27 14:35 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

On 27/10/2021 14:58, Dominik Csapak wrote:
> sort failed < no verify < outdated < all ok
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  www/datastore/Content.js | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
>

was a bit weird for me to sort but can be useful to group those with old/none and
the alternative would be to disable the sorting of this column completely, which
doesn't really help anybody (those which do not want to sort can already do ^^),
so: applied, thanks!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-27 14:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-27 12:58 [pbs-devel] [PATCH proxmox-backup] ui: datastore content: improve sorting verification column Dominik Csapak
2021-10-27 14:35 ` [pbs-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal