Add Custom Key for SOL on webui
To support VT100+ extensions for SOL on webui, add custom key
into xtermjs to handle key Backspace, DEL, HOME, END, INSERT,
PAGE UP, PAGE DOWN, F1 - F12.
Tested By:
After added item "customKeyEnable": true, "keyType" : "VT100+" into
iconfig.json.
Under EFI SHELL: Backspace, DEL, HOME, END, INSERT, PAGE UP, PAGE DOWN,
F1 - F12 keys can work as local keyboard in Web SOL.
Under linux with $TERM=vt100+: Backspace, DEL, HOME, END, INSERT,
PAGE UP, PAGE DOWN, F1 - F12 keys can work as local keyboard in Web SOL.
If not add "customKeyEnable" or "keyType", into config.json, Backspace,
DEL, HOME, END, INSERT, PAGE UP, PAGE DOWN, F1 - F12 keys can work
correctly in linux OS with $TERM=vt220 in SOL.
Other keys such as a-z can always work in SOL no matter "customKeyEnable"
or "keyType" is inserted into config.json.
Change-Id: Ifb196ec37080781033c0d6a3b0688baa7d0080b5
Signed-off-by: Cheng C Yang <cheng.c.yang@linux.intel.com>
diff --git a/app/common/directives/serial-console.js b/app/common/directives/serial-console.js
index 71340df..8227e18 100644
--- a/app/common/directives/serial-console.js
+++ b/app/common/directives/serial-console.js
@@ -2,7 +2,17 @@
import style from 'xterm/dist/xterm.css';
import * as attach from 'xterm/lib/addons/attach/attach';
import * as fit from 'xterm/lib/addons/fit/fit';
+var configJSON = require('../../../config.json');
+if (configJSON.keyType == 'VT100+') {
+ var vt100PlusKey = require('./vt100plus');
+}
+var customKeyHandlers = function(ev) {
+ if (configJSON.keyType == 'VT100+') {
+ return vt100PlusKey.customVT100PlusKey(ev, this);
+ }
+ return true;
+};
window.angular && (function(angular) {
'use strict';
@@ -27,6 +37,9 @@
var term = new Terminal();
term.open(document.getElementById('terminal'));
term.fit();
+ if (configJSON.customKeyEnable == true) {
+ term.attachCustomKeyEventHandler(customKeyHandlers);
+ }
var SOL_THEME = {
background: '#19273c',
cursor: 'rgba(83, 146, 255, .5)',