public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve-manager] fix #4393: ui: storage backup view: make pbs-specific columns sortable
@ 2022-12-16 12:45 Stefan Hanreich
  2023-01-16 13:26 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hanreich @ 2022-12-16 12:45 UTC (permalink / raw)
  To: pve-devel

The sort order is analogous to how it behaves in the datastore content
overview in pbs.

This means sorting in ascending order behaves as follows:

Verify State
* failed
* none
* ok

Encryption
* no
* yes

For the encryption state there is theoretically a distinction between
signed and encrypted, but as far as I can tell we do not render this
distinction in PVE, which is why I chose to not make this distinction
for sorting as well.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
 www/manager6/Utils.js              |  7 +++++++
 www/manager6/storage/BackupView.js | 12 ++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 8c118fa2..3dd287e3 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1963,6 +1963,13 @@ Ext.define('PVE.Utils', {
     },
 
     tagCharRegex: /^[a-z0-9+_.-]+$/i,
+
+    verificationStateOrder: {
+	'failed': 0,
+	'none': 1,
+	'ok': 2,
+	'__default__': 3,
+    },
 },
 
     singleton: true,
diff --git a/www/manager6/storage/BackupView.js b/www/manager6/storage/BackupView.js
index 2328c0fc..ef3a0166 100644
--- a/www/manager6/storage/BackupView.js
+++ b/www/manager6/storage/BackupView.js
@@ -197,11 +197,23 @@ Ext.define('PVE.storage.BackupView', {
 		    header: gettext('Encrypted'),
 		    dataIndex: 'encrypted',
 		    renderer: PVE.Utils.render_backup_encryption,
+		    sorter: {
+			property: 'encrypted',
+			transform: (value) => value ? 1 : 0,
+		    },
 		},
 		verification: {
 		    header: gettext('Verify State'),
 		    dataIndex: 'verification',
 		    renderer: PVE.Utils.render_backup_verification,
+		    sorter: {
+			property: 'verification',
+			transform: (value) => {
+			    let state = value?.state ?? 'none';
+			    let order = PVE.Utils.verificationStateOrder;
+			    return order[state] ?? order.__default__;
+			},
+		    },
 		},
 	    };
 	}
-- 
2.30.2




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

end of thread, other threads:[~2023-01-16 13:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-16 12:45 [pve-devel] [PATCH pve-manager] fix #4393: ui: storage backup view: make pbs-specific columns sortable Stefan Hanreich
2023-01-16 13:26 ` [pve-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