all lists on 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

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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal