[pve-devel] [PATCH manager v2 1/2] ui: storage: backup: refactor extraColumns assignment

Dominik Csapak d.csapak at proxmox.com
Tue Apr 25 09:21:27 CEST 2023


makes it easier to add columns, and uses less indentation

Signed-off-by: Dominik Csapak <d.csapak at 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






More information about the pve-devel mailing list