[pve-devel] [PATCH manager 3/5] gui: add Hibernate/Pause to CmdMenu/Shutdown Menu

Dominik Csapak d.csapak at proxmox.com
Fri Mar 29 10:44:35 CET 2019


and have it in order of impact on the guest
(pause, hibernate, poweroff, stop)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/qemu/CmdMenu.js | 15 +++++++++++++++
 www/manager6/qemu/Config.js  | 16 ++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/www/manager6/qemu/CmdMenu.js b/www/manager6/qemu/CmdMenu.js
index df7b593d..3d1c3985 100644
--- a/www/manager6/qemu/CmdMenu.js
+++ b/www/manager6/qemu/CmdMenu.js
@@ -79,6 +79,21 @@ Ext.define('PVE.qemu.CmdMenu', {
 		}
 	    },
 	    {
+		text: gettext('Hibernate'),
+		iconCls: 'fa fa-fw fa-stop',
+		hidden: stopped || suspended,
+		disabled: stopped || suspended,
+		handler: function() {
+		    var msg = Proxmox.Utils.format_task_description('qmsuspend', vmid);
+		    Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
+			if (btn !== 'yes') {
+			    return;
+			}
+			vm_command('suspend', { todisk: 1 });
+		    });
+		}
+	    },
+	    {
 		text: gettext('Resume'),
 		iconCls: 'fa fa-fw fa-play',
 		hidden: !suspended,
diff --git a/www/manager6/qemu/Config.js b/www/manager6/qemu/Config.js
index 0474fdb4..4070f544 100644
--- a/www/manager6/qemu/Config.js
+++ b/www/manager6/qemu/Config.js
@@ -143,6 +143,22 @@ Ext.define('PVE.qemu.Config', {
 	    },
 	    menu: {
 		items: [{
+		    text: gettext('Pause'),
+		    disabled: !caps.vms['VM.PowerMgmt'],
+		    confirmMsg: Proxmox.Utils.format_task_description('qmpause', vmid),
+		    handler: function() {
+			vm_command("suspend");
+		    },
+		    iconCls: 'fa fa-pause'
+		},{
+		    text: gettext('Hibernate'),
+		    disabled: !caps.vms['VM.PowerMgmt'],
+		    confirmMsg: Proxmox.Utils.format_task_description('qmsuspend', vmid),
+		    handler: function() {
+			vm_command("suspend", { todisk: 1 });
+		    },
+		    iconCls: 'fa fa-stop'
+		},{
 		    text: gettext('Stop'),
 		    disabled: !caps.vms['VM.PowerMgmt'],
 		    dangerous: true,
-- 
2.11.0




More information about the pve-devel mailing list