pve-manager/www/manager6/VNCConsole.js
Dominik Csapak db97236947 add xtermjs flag to VNCConsole iframe
so that we can open an xtermjs iframe instead of novnc

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-12-12 08:34:07 +01:00

59 lines
1.1 KiB
JavaScript

Ext.define('PVE.noVncConsole', {
extend: 'Ext.panel.Panel',
alias: 'widget.pveNoVncConsole',
nodename: undefined,
vmid: undefined,
consoleType: undefined, // lxc or kvm
layout: 'fit',
xtermjs: false,
border: false,
initComponent : function() {
var me = this;
if (!me.nodename) {
throw "no node name specified";
}
if (!me.consoleType) {
throw "no console type specified";
}
if (!me.vmid && me.consoleType !== 'shell') {
throw "no VM ID specified";
}
// always use same iframe, to avoid running several noVnc clients
// at same time (to avoid performance problems)
var box = Ext.create('Ext.ux.IFrame', { itemid : "vncconsole" });
var type = me.xtermjs ? 'xtermjs' : 'novnc';
Ext.apply(me, {
items: box,
listeners: {
activate: function() {
var url = '/?console=' + me.consoleType + '&' + type + '=1&node=' + me.nodename + '&resize=scale';
if (me.vmid) {
url += '&vmid='+ me.vmid;
}
box.load(url);
}
}
});
me.callParent();
me.on('afterrender', function() {
me.focus();
});
}
});