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

Dominik Csapak d.csapak at proxmox.com
Fri Dec 1 09:29:54 CET 2017


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
+	me.on('beforedestroy', function() {
+	    box.load('about:blank');
+	});
     }
 });
 
-- 
2.11.0





More information about the pve-devel mailing list