[pve-devel] [PATCH v2 manager 5/5] add reboot button for containers

Oguz Bektas o.bektas at proxmox.com
Tue Nov 19 15:53:47 CET 2019


also use the opportunity to refactor the shutdown button code into the
menu.

Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---

no changes.

 www/manager6/lxc/Config.js | 35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/www/manager6/lxc/Config.js b/www/manager6/lxc/Config.js
index 0f81c1da..5c760f13 100644
--- a/www/manager6/lxc/Config.js
+++ b/www/manager6/lxc/Config.js
@@ -52,18 +52,6 @@ Ext.define('PVE.lxc.Config', {
 	    iconCls: 'fa fa-play'
 	});
 
-	var stopBtn = Ext.create('Ext.menu.Item',{
-	    text: gettext('Stop'),
-	    disabled: !caps.vms['VM.PowerMgmt'],
-	    confirmMsg: Proxmox.Utils.format_task_description('vzstop', vmid),
-	    tooltip: Ext.String.format(gettext('Stop {0} immediately'), 'CT'),
-	    dangerous: true,
-	    handler: function() {
-		vm_command("stop");
-	    },
-	    iconCls: 'fa fa-stop'
-	});
-
 	var shutdownBtn = Ext.create('PVE.button.Split', {
 	    text: gettext('Shutdown'),
 	    disabled: !caps.vms['VM.PowerMgmt'] || !running,
@@ -73,7 +61,27 @@ Ext.define('PVE.lxc.Config', {
 		vm_command('shutdown');
 	    },
 	    menu: {
-		items:[stopBtn]
+		items: [{
+		    text: gettext('Stop'),
+		    disabled: !caps.vms['VM.PowerMgmt'],
+		    confirmMsg: Proxmox.Utils.format_task_description('vzstop', vmid),
+		    tooltip: Ext.String.format(gettext('Stop {0} immediately'), 'CT'),
+		    dangerous: true,
+		    handler: function() {
+			vm_command("stop");
+		    },
+		    iconCls: 'fa fa-stop'
+
+		},{
+		    text: gettext('Reboot'),
+		    disabled: !caps.vms['VM.PowerMgmt'],
+		    confirmMsg: Proxmox.Utils.format_task_description('vzreboot', vmid),
+		    tooltip: Ext.String.format(gettext('Reboot {0}'), 'CT'),
+		    handler: function() {
+			vm_command("reboot");
+		    },
+		    iconCls: 'fa fa-refresh'
+		}]
 	    },
 	    iconCls: 'fa fa-power-off'
 	});
@@ -344,7 +352,6 @@ Ext.define('PVE.lxc.Config', {
 
 	    startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running' || template);
 	    shutdownBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
-	    stopBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'stopped');
 	    me.down('#removeBtn').setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped');
 	    consoleBtn.setDisabled(template);
 	});
-- 
2.20.1




More information about the pve-devel mailing list