public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] ui: datastore content: improve sorting verification column
Date: Wed, 27 Oct 2021 14:58:43 +0200	[thread overview]
Message-ID: <20211027125843.1082129-1-d.csapak@proxmox.com> (raw)

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





             reply	other threads:[~2021-10-27 12:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-27 12:58 Dominik Csapak [this message]
2021-10-27 14:35 ` [pbs-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=20211027125843.1082129-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal