]> git.proxmox.com Git - pve-manager.git/commitdiff
open vm console on doubleclick in tree
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 21 Jul 2016 09:45:12 +0000 (11:45 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 21 Jul 2016 11:10:49 +0000 (13:10 +0200)
with this patch you can open the console of a guest
with a simple doubleclick in the tree

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
www/manager6/Utils.js
www/manager6/tree/ResourceTree.js

index 0182413391795899d8e6929631a9d47277d2e8e4..514b095e22caf3946560faf15c0b786dbfd1a07a 100644 (file)
@@ -1195,6 +1195,27 @@ Ext.define('PVE.Utils', { statics: {
        });
     },
 
+    openTreeConsole: function(tree, record, item, index, e) {
+       e.stopEvent();
+       var nodename = record.data.node;
+       var vmid = record.data.vmid;
+       var vmname = record.data.name;
+       if (record.data.type === 'qemu' && !record.data.template) {
+           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);
+               }
+           });
+       } else if (record.data.type === 'lxc' && !record.data.template) {
+           PVE.Utils.openDefaultConsoleWindow(true, 'lxc', vmid, nodename, vmname);
+       }
+    },
+
     createCmdMenu: function(v, record, item, index, event) {
        event.stopEvent();
        if (!(v instanceof Ext.tree.View)) {
index ee3dd44df68c8c58757535d088e13364ca490cce..ac487c6c30adf7ba6d75fd6dfe78000fb9a550a5 100644 (file)
@@ -387,7 +387,8 @@ Ext.define('PVE.tree.ResourceTree', {
                    var allow = me.allowSelection;
                    me.allowSelection = true;
                    return allow;
-               }
+               },
+               itemdblclick: PVE.Utils.openTreeConsole
            },
            setViewFilter: function(view) {
                me.viewFilter = view;