]> git.proxmox.com Git - pve-manager.git/commitdiff
Add suspend/resume options to web UI CmdMenus
authorDan Hunsaker <danhunsaker@gmail.com>
Wed, 8 Oct 2014 23:02:07 +0000 (17:02 -0600)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 9 Oct 2014 07:25:55 +0000 (09:25 +0200)
The PVE2 API supports suspend/resume of VMs (and now CTs), but the web UI
doesn't make these options available.  This patch adds Suspend and Resume
items to the CmdMenus of OpenVZ and QEMU guests.  I considered adding the
options to the toolbar, but since it is already pretty full, I opted
against doing so for the moment.  Perhaps the various startup options can
be combined into a dropdown menu similar to how the console options are
set up, and the various shutdown opitons combined into another.  That
would provide the necesarry space to add the Suspend and Resume options
there.

This patch also provides descriptions for Suspend and Resume tasks in the
task logs, bringing full suspend/resume support to the web GUI.

Signed-off-by: Dan Hunsaker <danhunsaker@gmail.com>
www/manager/Utils.js
www/manager/openvz/CmdMenu.js
www/manager/qemu/CmdMenu.js

index f95c180ac48f27216ad1ccde30328f3347c5eb31..93bd90bda8d8a4fcb83cd05cee0bbad69df6ac36 100644 (file)
@@ -510,6 +510,8 @@ Ext.define('PVE.Utils', { statics: {
        vzmount: ['CT', gettext('Mount') ],
        vzumount: ['CT', gettext('Unmount') ],
        vzshutdown: ['CT', gettext('Shutdown') ],
+       vzsuspend: [ 'CT', gettext('Suspend') ],
+       vzresume: [ 'CT', gettext('Resume') ],
        hamigrate: [ 'HA', gettext('Migrate') ],
        hastart: [ 'HA', gettext('Start') ],
        hastop: [ 'HA', gettext('Stop') ],
index 85589eda659511ff1f0115f898c354adc5b1d5f3..0c6f5bb7c91c4290145326c04a8be14ba63db589 100644 (file)
@@ -11,7 +11,7 @@ Ext.define('PVE.openvz.CmdMenu', {
 
        var vmid = me.pveSelNode.data.vmid;
        if (!vmid) {
-           throw "no VM ID specified";
+           throw "no CT ID specified";
        }
 
        var vmname = me.pveSelNode.data.name;
@@ -49,11 +49,32 @@ Ext.define('PVE.openvz.CmdMenu', {
                    win.show();
                }
            },
+           {
+               text: gettext('Suspend'),
+               icon: '/pve2/images/forward.png',
+               handler: function() {
+                   var msg = Ext.String.format(gettext("Do you really want to suspend CT {0}?"), vmid);
+                   Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
+                       if (btn !== 'yes') {
+                           return;
+                       }
+                       
+                       vm_command('suspend');
+                   });
+               }
+           },
+           {
+               text: gettext('Resume'),
+               icon: '/pve2/images/forward.png',
+               handler: function() {
+                   vm_command('resume');
+               }
+           },
            {
                text: gettext('Shutdown'),
                icon: '/pve2/images/stop.png',
                handler: function() {
-                   var msg = Ext.String.format(gettext("Do you really want to shutdown VM {0}?"), vmid);
+                   var msg = Ext.String.format(gettext("Do you really want to shutdown CT {0}?"), vmid);
                    Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
                        if (btn !== 'yes') {
                            return;
@@ -67,7 +88,7 @@ Ext.define('PVE.openvz.CmdMenu', {
                text: gettext('Stop'),
                icon: '/pve2/images/gtk-stop.png',
                handler: function() {
-                   var msg = Ext.String.format(gettext("Do you really want to stop VM {0}?"), vmid);
+                   var msg = Ext.String.format(gettext("Do you really want to stop CT {0}?"), vmid);
                    Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
                        if (btn !== 'yes') {
                            return;
index 853f57bc840c95eb35345f8538890ee87e3a0152..a9a8ce4ee38d676a2bc4484646fa2f284c2716af 100644 (file)
@@ -49,6 +49,26 @@ Ext.define('PVE.qemu.CmdMenu', {
                    win.show();
                }
            },
+           {
+               text: gettext('Suspend'),
+               icon: '/pve2/images/forward.png',
+               handler: function() {
+                   var msg = Ext.String.format(gettext("Do you really want to suspend VM {0}?"), vmid);
+                   Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
+                       if (btn !== 'yes') {
+                           return;
+                       }
+                       vm_command('suspend');
+                   });
+               }
+           },
+           {
+               text: gettext('Resume'),
+               icon: '/pve2/images/forward.png',
+               handler: function() {
+                   vm_command('resume');
+               }
+           },
            {
                text: gettext('Shutdown'),
                icon: '/pve2/images/stop.png',