[pve-devel] [PATCH manager 1/7] ui: VMSelector: columns customizable

Dominik Csapak d.csapak at proxmox.com
Mon Mar 6 15:23:29 CET 2023


we will reuse this component but don't want to show all columns

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/form/VMSelector.js | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/www/manager6/form/VMSelector.js b/www/manager6/form/VMSelector.js
index 78cd90134..d80a21ec0 100644
--- a/www/manager6/form/VMSelector.js
+++ b/www/manager6/form/VMSelector.js
@@ -22,7 +22,8 @@ Ext.define('PVE.form.VMSelector', {
 	    value: /lxc|qemu/,
 	}],
     },
-    columns: [
+
+    columnsDeclaration: [
 	{
 	    header: 'ID',
 	    dataIndex: 'vmid',
@@ -94,6 +95,9 @@ Ext.define('PVE.form.VMSelector', {
 	},
     ],
 
+    // should be a list of 'dataIndex' values, if 'undefined' all declared columns will be included
+    columnSelection: undefined,
+
     selModel: {
 	selType: 'checkboxmodel',
 	mode: 'SIMPLE',
@@ -155,6 +159,12 @@ Ext.define('PVE.form.VMSelector', {
     initComponent: function() {
 	let me = this;
 
+	let columns = me.columnsDeclaration.filter((column) =>
+	    me.columnSelection ? me.columnSelection.indexOf(column.dataIndex) !== -1 : true,
+	).map((x) => x);
+
+	me.columns = columns;
+
 	me.callParent();
 
 	if (me.nodename) {
-- 
2.30.2






More information about the pve-devel mailing list