[pve-devel] [PATCH manager 5/5] add xtermjs to consolebutton

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


Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/button/ConsoleButton.js | 27 ++++++++++++++++++++-------
 www/manager6/lxc/Config.js           | 30 +++++++++++++++++++++---------
 www/manager6/node/Config.js          |  9 +++++++++
 3 files changed, 50 insertions(+), 16 deletions(-)

diff --git a/www/manager6/button/ConsoleButton.js b/www/manager6/button/ConsoleButton.js
index 98ebea0e..d8a69980 100644
--- a/www/manager6/button/ConsoleButton.js
+++ b/www/manager6/button/ConsoleButton.js
@@ -16,7 +16,7 @@ Ext.define('PVE.button.ConsoleButton', {
 	var me = this;
 
 	me.enableSpice = enable;
-	me.spiceMenu.setDisabled(!enable);
+	me.down('#spicemenu').setDisabled(!enable);
     },
 
     initComponent: function() {
@@ -26,7 +26,20 @@ Ext.define('PVE.button.ConsoleButton', {
 	    throw "no node name specified";
 	}
 
-	me.spiceMenu = Ext.create('Ext.menu.Item', {
+	var items = [];
+
+	items.push({
+	    xtype:'menuitem',
+	    text: 'noVNC',
+	    iconCls: 'pve-itype-icon-novnc',
+	    handler: function() {
+		PVE.Utils.openConsoleWindow('html5', me.consoleType, me.vmid, me.nodename, me.consoleName);
+	    }
+	});
+
+	items.push({
+	    xterm: 'menuitem',
+	    itemId: 'spicemenu',
 	    text: 'SPICE',
 	    iconCls: 'pve-itype-icon-virt-viewer',
 	    handler: function() {
@@ -34,11 +47,11 @@ Ext.define('PVE.button.ConsoleButton', {
 	    }
 	});
 
-	var noVncMenu = Ext.create('Ext.menu.Item', {
-	    text: 'noVNC',
-	    iconCls: 'pve-itype-icon-novnc',
+	items.push({
+	    text: 'xterm.js',
+	    iconCls: 'fa fa-terminal',
 	    handler: function() {
-		PVE.Utils.openConsoleWindow('html5', me.consoleType, me.vmid, me.nodename, me.consoleName);
+		PVE.Utils.openConsoleWindow('xtermjs', me.consoleType, me.vmid, me.nodename, me.consoleName);
 	    }
 	});
 
@@ -52,7 +65,7 @@ Ext.define('PVE.button.ConsoleButton', {
 						   me.nodename, me.consoleName);
 	    },
 	    menu: new Ext.menu.Menu({
-		items: [ noVncMenu, me.spiceMenu ]
+		items: items
 	    })
 	});
 
diff --git a/www/manager6/lxc/Config.js b/www/manager6/lxc/Config.js
index 0ffc4841..bcff47ba 100644
--- a/www/manager6/lxc/Config.js
+++ b/www/manager6/lxc/Config.js
@@ -148,15 +148,27 @@ Ext.define('PVE.lxc.Config', {
 	});
 
 	if (caps.vms['VM.Console']) {
-	    me.items.push({
-		title: gettext('Console'),
-		itemId: 'console',
-		iconCls: 'fa fa-terminal',
-		xtype: 'pveNoVncConsole',
-		vmid: vmid,
-		consoleType: 'lxc',
-		nodename: nodename
-	    });
+	    me.items.push(
+		{
+		    title: gettext('Console'),
+		    itemId: 'console',
+		    iconCls: 'fa fa-terminal',
+		    xtype: 'pveNoVncConsole',
+		    vmid: vmid,
+		    consoleType: 'lxc',
+		    nodename: nodename
+		},
+		{
+		    title: gettext('Console (JS)'),
+		    itemId: 'consolejs',
+		    iconCls: 'fa fa-terminal',
+		    xtype: 'pveNoVncConsole',
+		    vmid: vmid,
+		    consoleType: 'lxc',
+		    xtermjs: true,
+		    nodename: nodename
+		}
+	    );
 	}
 
 	me.items.push(
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index 49f1186f..4d6b51ef 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -139,6 +139,15 @@ Ext.define('PVE.node.Config', {
 		    xtype: 'pveNoVncConsole',
 		    consoleType: 'shell',
 		    nodename: nodename
+		},
+		{
+		    title: gettext('Shell (JS)'),
+		    iconCls: 'fa fa-terminal',
+		    itemId: 'jsconsole',
+		    xtype: 'pveNoVncConsole',
+		    consoleType: 'shell',
+		    xtermjs: true,
+		    nodename: nodename
 		}
 	    );
 	}
-- 
2.11.0





More information about the pve-devel mailing list