with this patch you can open the console of a guest
with a simple doubleclick in the tree

Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
---
i find this very convenient, because on several
occasions, i instinctively double-clicked on the tree
items and expected the console to open

please comment if you find this useful, annoying, useless, etc.

 www/manager6/Utils.js             | 21 +++++++++++++++++++++
 www/manager6/tree/ResourceTree.js |  3 ++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 0182413..514b095 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -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)) {
diff --git a/www/manager6/tree/ResourceTree.js 
b/www/manager6/tree/ResourceTree.js
index ee3dd44..ac487c6 100644
--- a/www/manager6/tree/ResourceTree.js
+++ b/www/manager6/tree/ResourceTree.js
@@ -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;
-- 
2.1.4


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to