[pve-devel] [RFC manager] open vm console on doubleclick in tree

Dominik Csapak d.csapak at proxmox.com
Thu Jul 21 11:45:12 CEST 2016


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 at 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





More information about the pve-devel mailing list