[pve-devel] [PATCH manager 4/5] add xtermjs flag to VNCConsole iframe

Dominik Csapak d.csapak at proxmox.com
Mon Dec 4 10:43:41 CET 2017


On 12/04/2017 09:48 AM, Thomas Lamprecht wrote:
> On 12/01/2017 09:29 AM, Dominik Csapak wrote:
>> so that we can open an xtermjs iframe instead of novnc
>>
>> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
>> ---
>>   www/manager6/VNCConsole.js | 11 ++++++++++-
>>   1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/www/manager6/VNCConsole.js b/www/manager6/VNCConsole.js
>> index 4b1b39ef..1e976e1d 100644
>> --- a/www/manager6/VNCConsole.js
>> +++ b/www/manager6/VNCConsole.js
>> @@ -10,6 +10,8 @@ Ext.define('PVE.noVncConsole', {
>>   
>>       layout: 'fit',
>>   
>> +    xtermjs: false,
>> +
>>       border: false,
>>   
>>       initComponent : function() {
>> @@ -31,11 +33,13 @@ Ext.define('PVE.noVncConsole', {
>>   	// 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 + '&novnc=1&node=' + me.nodename + '&resize=scale';
>> +		    var url = '/?console=' + me.consoleType + '&' + type + '=1&node=' + me.nodename + '&resize=scale';
>>   		    if (me.vmid) {
>>   			url += '&vmid='+ me.vmid;
>>   		    }
>> @@ -49,6 +53,11 @@ Ext.define('PVE.noVncConsole', {
>>   	me.on('afterrender', function() {
>>   	    me.focus();
>>   	});
>> +
>> +	// this triggers the window.unload event of the frame
> 
> And why is that good or needed for the xtermjs type addition above?
> I saw in the xtermjs source code that it has a handler (stopTerminal)
> for this event registered, so I'd rather use something like:
> 
> // trigger window.unload event, so console (e.g., xtermjs) can gracefully stop
> 
> Or, if disliked, I'd add at least some note in the commit message.
> 

this actually did not work as intended and is a leftover,
i will remove this from my v2

> Besides that:
> Reviewed-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> 
>> +	me.on('beforedestroy', function() {
>> +	    box.load('about:blank');
>> +	});
>>       }
>>   });
>>   
>>
> 





More information about the pve-devel mailing list