]> git.proxmox.com Git - pve-manager.git/blobdiff - www/manager/qemu/CmdMenu.js
disable animation of charts on load
[pve-manager.git] / www / manager / qemu / CmdMenu.js
index 61f14a3c85a8c5ee6385923291fe62044acf5619..0742d55e985f937b7779caf950dac8d838384332 100644 (file)
@@ -49,11 +49,31 @@ 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 {0}?"), gettext('VM') + ' ' + 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 {0}?"), gettext('VM') + ' ' + vmid);
                    Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
                        if (btn !== 'yes') {
                            return;
@@ -67,21 +87,61 @@ Ext.define('PVE.qemu.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 {0}?"), gettext('VM') + ' ' + vmid);
                    Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
                        if (btn !== 'yes') {
                            return;
                        }
 
-                       vm_command("stop", { timeout: 30 });
+                       vm_command("stop");
                    });            
                }
            },
+           {
+               text: gettext('Clone'),
+               icon: '/pve2/images/forward.png',
+               handler: function() {
+                   var win = Ext.create('PVE.window.Clone', {
+                       nodename: nodename,
+                       vmid: vmid
+                   });
+                   win.show();
+               }
+           },
+           {
+               text: gettext('Convert to template'),
+               icon: '/pve2/images/forward.png',
+               handler: function() {
+                   var msg = Ext.String.format(gettext("Do you really want to convert {0} into a template?"), gettext('VM') + ' ' + vmid);
+                   Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
+                       if (btn !== 'yes') {
+                           return;
+                       }
+
+                       PVE.Utils.API2Request({
+                            url: '/nodes/' + nodename + '/qemu/' + vmid + '/template',
+                            method: 'POST',
+                            failure: function(response, opts) {
+                               Ext.Msg.alert('Error', response.htmlStatus);
+                            }
+                       });
+                   });
+               }
+           },
            {
                text: gettext('Console'),
                icon: '/pve2/images/display.png',
                handler: function() {
-                   PVE.Utils.openConoleWindow('kvm', vmid, nodename, vmname);
+                   PVE.Utils.API2Request({
+                       url: '/nodes/' + nodename + '/qemu/' + vmid + '/status/current',
+                       failure: function(response, opts) {
+                           Ext.Msg.alert('Error', response.htmlStatus);
+                       },
+                       success: function(response, opts) {
+                           var allowSpice = response.result.data.spice;
+                           PVE.Utils.openDefaultConsoleWindow(allowSpice, 'kvm', vmid, nodename, vmname);
+                       }
+                   });
                }
            }
        ];