]> git.proxmox.com Git - proxmox-backup.git/commitdiff
ui: datastore content: improve sorting verification column
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 27 Oct 2021 12:58:43 +0000 (14:58 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 27 Oct 2021 14:29:59 +0000 (16:29 +0200)
sort failed < no verify < outdated < all ok

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
www/datastore/Content.js

index 87a9079dfa81bb518c11dd6629690e0c06803a2f..5f98653ab5da415b2b7cd60d5a043bb5a1c6fd75 100644 (file)
@@ -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) {