[pve-devel] [PATCH manager 2/2] show only relevant vms in bulk action window

Dominik Csapak d.csapak at proxmox.com
Mon Jan 9 14:52:57 CET 2017


this adds a default filter for bulk start and stop, so that only the
relevant vms are visible (stopped and started respectively)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/form/VMSelector.js   | 22 ++++++++++++++++++++++
 www/manager6/window/BulkAction.js |  3 ++-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/www/manager6/form/VMSelector.js b/www/manager6/form/VMSelector.js
index 2ee892d..5fdee9c 100644
--- a/www/manager6/form/VMSelector.js
+++ b/www/manager6/form/VMSelector.js
@@ -169,6 +169,28 @@ Ext.define('PVE.form.VMSelector', {
 	    });
 	}
 
+	// only show the relevant guests by default
+	if (me.action) {
+	    switch (me.action) {
+		case 'startall':
+		    me.store.filters.add({
+			id: 'x-gridfilter-status',
+			operator: 'in',
+			property: 'status',
+			value: ['stopped']
+		    });
+		    break;
+		case 'stopall':
+		    me.store.filters.add({
+			id: 'x-gridfilter-status',
+			operator: 'in',
+			property: 'status',
+			value: ['running']
+		    });
+		    break;
+	    }
+	}
+
 	var store = me.getStore();
 	var sm = me.getSelectionModel();
 
diff --git a/www/manager6/window/BulkAction.js b/www/manager6/window/BulkAction.js
index bd65f5c..2cfcd06 100644
--- a/www/manager6/window/BulkAction.js
+++ b/www/manager6/window/BulkAction.js
@@ -98,7 +98,8 @@ Ext.define('PVE.window.BulkAction', {
 	    height: 300,
 	    selectAll: true,
 	    allowBlank: false,
-	    nodename: me.nodename
+	    nodename: me.nodename,
+	    action: me.action
 	});
 
 	me.formPanel = Ext.create('Ext.form.Panel', {
-- 
2.1.4





More information about the pve-devel mailing list