From e9558f290a5aff0730165f2e9a3330714f01b8c6 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Wed, 27 Oct 2021 14:58:43 +0200 Subject: [PATCH] ui: datastore content: improve sorting verification column sort failed < no verify < outdated < all ok Signed-off-by: Dominik Csapak --- 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) => ` ${txt}`; if (v === undefined || v === null) {