open vm console on doubleclick in tree

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>
This commit is contained in:
Dominik Csapak 2016-07-21 11:45:12 +02:00 committed by Dietmar Maurer
parent 6cc8cfb361
commit e31294433f
2 changed files with 23 additions and 1 deletions

View 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)) {

View 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;