Commit 5b613406 authored by Dan Hunsaker's avatar Dan Hunsaker Committed by Dietmar Maurer

Add suspend/resume options to web UI CmdMenus

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: 's avatarDan Hunsaker <danhunsaker@gmail.com>
parent bf6c43a3
......@@ -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') ],
......
......@@ -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;
......
......@@ -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',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment