public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager v2 1/2] ui: storage: backup: refactor extraColumns assignment
@ 2023-04-25  7:21 Dominik Csapak
  2023-04-25  7:21 ` [pve-devel] [PATCH manager v2 2/2] fix #4678: ui: don't sort storage backup content by vmid by default Dominik Csapak
  2023-06-06 17:23 ` [pve-devel] applied-series: [PATCH manager v2 1/2] ui: storage: backup: refactor extraColumns assignment Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Dominik Csapak @ 2023-04-25  7:21 UTC (permalink / raw)
  To: pve-devel

makes it easier to add columns, and uses less indentation

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
new in v2
 www/manager6/storage/BackupView.js | 40 +++++++++++++++---------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/www/manager6/storage/BackupView.js b/www/manager6/storage/BackupView.js
index fbdf573d3..e0921f4f5 100644
--- a/www/manager6/storage/BackupView.js
+++ b/www/manager6/storage/BackupView.js
@@ -195,28 +195,28 @@ Ext.define('PVE.storage.BackupView', {
 	    pruneButton,
 	);
 
+	me.extraColumns = {};
+
 	if (isPBS) {
-	    me.extraColumns = {
-		encrypted: {
-		    header: gettext('Encrypted'),
-		    dataIndex: 'encrypted',
-		    renderer: PVE.Utils.render_backup_encryption,
-		    sorter: {
-			property: 'encrypted',
-			transform: encrypted => encrypted ? 1 : 0,
-		    },
+	    me.extraColumns.encrypted = {
+		header: gettext('Encrypted'),
+		dataIndex: 'encrypted',
+		renderer: PVE.Utils.render_backup_encryption,
+		sorter: {
+		    property: 'encrypted',
+		    transform: encrypted => encrypted ? 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__;
-			},
+	    };
+	    me.extraColumns.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] 3+ messages in thread

* [pve-devel] [PATCH manager v2 2/2] fix #4678: ui: don't sort storage backup content by vmid by default
  2023-04-25  7:21 [pve-devel] [PATCH manager v2 1/2] ui: storage: backup: refactor extraColumns assignment Dominik Csapak
@ 2023-04-25  7:21 ` Dominik Csapak
  2023-06-06 17:23 ` [pve-devel] applied-series: [PATCH manager v2 1/2] ui: storage: backup: refactor extraColumns assignment Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Dominik Csapak @ 2023-04-25  7:21 UTC (permalink / raw)
  To: pve-devel

instead, add the vmid as extra column, so that the user can still sort
by vmid if they wish to

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes from v1:
* fallback to vmid 0 if there was none from the api, that way entries
  without a vmid will be sorted before the rest, otherwise they would
  not be sorted at all

 www/manager6/storage/BackupView.js | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/www/manager6/storage/BackupView.js b/www/manager6/storage/BackupView.js
index e0921f4f5..bdaf85c8d 100644
--- a/www/manager6/storage/BackupView.js
+++ b/www/manager6/storage/BackupView.js
@@ -222,14 +222,17 @@ Ext.define('PVE.storage.BackupView', {
 	    };
 	}
 
+	me.extraColumns.vmid = {
+	    header: gettext('VMID'),
+	    dataIndex: 'vmid',
+	    hidden: true,
+	    sorter: (a, b) => (a.data.vmid ?? 0) - (b.data.vmid ?? 0),
+	};
+
 	me.callParent();
 
 	me.store.getSorters().clear();
 	me.store.setSorters([
-	    {
-		property: 'vmid',
-		direction: 'ASC',
-	    },
 	    {
 		property: 'vdate',
 		direction: 'DESC',
-- 
2.30.2





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

* [pve-devel] applied-series: [PATCH manager v2 1/2] ui: storage: backup: refactor extraColumns assignment
  2023-04-25  7:21 [pve-devel] [PATCH manager v2 1/2] ui: storage: backup: refactor extraColumns assignment Dominik Csapak
  2023-04-25  7:21 ` [pve-devel] [PATCH manager v2 2/2] fix #4678: ui: don't sort storage backup content by vmid by default Dominik Csapak
@ 2023-06-06 17:23 ` Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2023-06-06 17:23 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

Am 25/04/2023 um 09:21 schrieb Dominik Csapak:
> makes it easier to add columns, and uses less indentation
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> new in v2
>  www/manager6/storage/BackupView.js | 40 +++++++++++++++---------------
>  1 file changed, 20 insertions(+), 20 deletions(-)
> 
>

applied both patches, thanks!




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

end of thread, other threads:[~2023-06-06 17:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-25  7:21 [pve-devel] [PATCH manager v2 1/2] ui: storage: backup: refactor extraColumns assignment Dominik Csapak
2023-04-25  7:21 ` [pve-devel] [PATCH manager v2 2/2] fix #4678: ui: don't sort storage backup content by vmid by default Dominik Csapak
2023-06-06 17:23 ` [pve-devel] applied-series: [PATCH manager v2 1/2] ui: storage: backup: refactor extraColumns assignment 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