[pve-devel] [PATCH manager 4/4] change Start/Stop/Migrate all to Bulk actions

Dominik Csapak d.csapak at proxmox.com
Thu Jan 5 12:25:03 CET 2017


this uses the new vmselector and the new vmid filter in the backend
to allow starting/stopping/migrating selected vms instead of all

by default all vms are selected to have the same default behaviour

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Makefile       |  3 ++-
 www/manager6/node/Config.js | 57 +++++++++++++++++----------------------------
 2 files changed, 24 insertions(+), 36 deletions(-)

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index ae0abe2..8350185 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -68,6 +68,7 @@ JSSRC= 				                 	\
 	form/FirewallPolicySelector.js			\
 	form/GlobalSearchField.js			\
 	form/QemuBiosSelector.js			\
+	form/VMSelector.js			\
 	dc/Tasks.js					\
 	dc/Log.js					\
 	panel/StatusPanel.js				\
@@ -128,7 +129,7 @@ JSSRC= 				                 	\
 	node/APT.js					\
 	node/Config.js					\
 	window/Migrate.js				\
-	window/MigrateAll.js				\
+	window/BulkAction.js				\
 	qemu/Monitor.js					\
 	qemu/Summary.js					\
 	qemu/OSTypeEdit.js				\
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index e30e106..f416167 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -32,59 +32,46 @@ Ext.define('PVE.node.Config', {
 	};
 
 	var actionBtn = Ext.create('Ext.Button', {
-	    text: gettext('More'),
+	    text: gettext('Bulk Actions'),
 	    iconCls: 'fa fa-fw fa-ellipsis-v',
 	    disabled: !caps.nodes['Sys.PowerMgmt'],
 	    menu: new Ext.menu.Menu({
 		items: [
 		    {
-			text: gettext('Start all VMs and Containers'),
+			text: gettext('Bulk Start'),
 			iconCls: 'fa fa-fw fa-play',
 			handler: function() {
-			    var msg = gettext('Start all VMs and Containers') + ' (' + gettext('Node') + " '" + nodename + "')";
-			    Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
-				if (btn !== 'yes') {
-				    return;
-				}
-				PVE.Utils.API2Request({
-				    params: { force: 1 },
-				    url: '/nodes/' + nodename + '/startall',
-				    method: 'POST',
-				    waitMsgTarget: me,
-				    failure: function(response, opts) {
-					Ext.Msg.alert('Error', response.htmlStatus);
-				    }
-				});
+			    var win = Ext.create('PVE.window.BulkAction', {
+				nodename: nodename,
+				title: gettext('Bulk Start'),
+				btnText: gettext('Start'),
+				action: 'startall'
 			    });
+			    win.show();
 			}
 		    },
 		    {
-			text: gettext('Stop all VMs and Containers'),
-			iconCls: 'fa fa-fw fa-stop fa-red',
+			text: gettext('Bulk Stop'),
+			iconCls: 'fa fa-fw fa-stop',
 			handler: function() {
-			    var msg = gettext('Stop all VMs and Containers') + ' (' + gettext('Node') + " '" + nodename + "')";
-			    Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
-				if (btn !== 'yes') {
-				    return;
-				}
-
-				PVE.Utils.API2Request({
-				    url: '/nodes/' + nodename + '/stopall',
-				    method: 'POST',
-				    waitMsgTarget: me,
-				    failure: function(response, opts) {
-					Ext.Msg.alert('Error', response.htmlStatus);
-				    }
-				});
+			    var win = Ext.create('PVE.window.BulkAction', {
+				nodename: nodename,
+				title: gettext('Bulk Stop'),
+				btnText: gettext('Stop'),
+				action: 'stopall'
 			    });
+			    win.show();
 			}
 		    },
 		    {
-			text: gettext('Migrate all VMs and Containers'),
+			text: gettext('Bulk Migrate'),
 			iconCls: 'fa fa-fw fa-send-o',
 			handler: function() {
-			    var win = Ext.create('PVE.window.MigrateAll', {
-				nodename: nodename
+			    var win = Ext.create('PVE.window.BulkAction', {
+				nodename: nodename,
+				title: gettext('Bulk Migrate'),
+				btnText: gettext('Migrate'),
+				action: 'migrateall'
 			    });
 			    win.show();
 			}
-- 
2.1.4





More information about the pve-devel mailing list