diff --git a/ui/commands/commands.js b/ui/commands/commands.js index 482905f..700c82f 100644 --- a/ui/commands/commands.js +++ b/ui/commands/commands.js @@ -29,11 +29,13 @@ export class Result { * @param {string} name Result type * @param {Info} info Result info * @param {object} control Result controller + * @param {string} ui User interfact this command will use */ - constructor(name, info, control) { + constructor(name, info, control, ui) { this.name = name; this.info = info; this.control = control; + this.ui = ui; } } @@ -501,6 +503,16 @@ class Wizard { return this.built.started(); } + /** + * Return the name of the control info of current wizard + * + * @returns {object} + * + */ + control() { + return this.built.control(); + } + /** * Close current wizard * diff --git a/ui/commands/controls.js b/ui/commands/controls.js index 39fc2f0..8dd05f6 100644 --- a/ui/commands/controls.js +++ b/ui/commands/controls.js @@ -44,18 +44,17 @@ export class Controls { * Get a control * * @param {string} type Type of the control - * @param {...any} data Data needed to build the control * * @returns {object} Control object * * @throws {Exception} When given control type is undefined * */ - get(type, ...data) { + get(type) { if (typeof this.controls[type] !== "object") { throw new Exception('Control "' + type + '" was undefined'); } - return this.controls[type].build(...data); + return this.controls[type]; } } diff --git a/ui/commands/ssh.js b/ui/commands/ssh.js index 8878604..6b37873 100644 --- a/ui/commands/ssh.js +++ b/ui/commands/ssh.js @@ -487,7 +487,7 @@ class Wizard { credential: "" }; this.step = subs; - this.controls = controls; + this.controls = controls.get("SSH"); this.history = history; this.step.resolve(this.stepInitialPrompt()); @@ -497,6 +497,10 @@ class Wizard { return this.hasStarted; } + control() { + return this.controls; + } + close() { this.step.resolve( this.stepErrorDone( @@ -603,7 +607,7 @@ class Wizard { new command.Result( configInput.user + "@" + configInput.host, self.info, - self.controls.get("SSH", { + self.controls.build({ charset: configInput.charset, send(data) { return commandHandler.sendData(data); @@ -615,7 +619,8 @@ class Wizard { return commandHandler.sendResize(rows, cols); }, events: commandHandler.events - }) + }), + self.controls.ui() ) ) ); diff --git a/ui/commands/telnet.js b/ui/commands/telnet.js index 37f6e4e..18cab4e 100644 --- a/ui/commands/telnet.js +++ b/ui/commands/telnet.js @@ -249,7 +249,7 @@ class Wizard { this.config = config; this.session = session; this.step = subs; - this.controls = controls; + this.controls = controls.get("Telnet"); this.history = history; this.step.resolve(this.stepInitialPrompt()); @@ -259,6 +259,10 @@ class Wizard { return this.hasStarted; } + control() { + return this.controls; + } + close() { this.step.resolve( this.stepErrorDone( @@ -337,7 +341,7 @@ class Wizard { new command.Result( configInput.host, self.info, - self.controls.get("Telnet", { + self.controls.build({ charset: parsedConfig.charset, send(data) { return commandHandler.sendData(data); @@ -346,7 +350,8 @@ class Wizard { return commandHandler.sendClose(); }, events: commandHandler.events - }) + }), + self.controls.ui() ) ) ); diff --git a/ui/control/ssh.js b/ui/control/ssh.js index 0c18eb7..e800924 100644 --- a/ui/control/ssh.js +++ b/ui/control/ssh.js @@ -100,10 +100,6 @@ class Control { this.resizer(dim.rows, dim.cols); } - ui() { - return "Console"; - } - enabled() { this.enable = true; } @@ -168,6 +164,10 @@ export class SSH { return "SSH"; } + ui() { + return "Console"; + } + build(data) { return new Control(data, this.color); } diff --git a/ui/control/telnet.js b/ui/control/telnet.js index 5fb2386..c3fd85b 100644 --- a/ui/control/telnet.js +++ b/ui/control/telnet.js @@ -428,10 +428,6 @@ class Control { this.parser.requestWindowResize(); } - ui() { - return "Console"; - } - enabled() { this.enable = true; } @@ -527,6 +523,10 @@ export class Telnet { return "Telnet"; } + ui() { + return "Console"; + } + build(data) { return new Control(data, this.color); } diff --git a/ui/home.css b/ui/home.css index 22624af..9cf8cb3 100644 --- a/ui/home.css +++ b/ui/home.css @@ -369,16 +369,6 @@ flex-direction: column; color: #fff; font-size: 1.2em; - position: relative; -} - -#home-content-preload-drop { - height: 0px; - width: 0px; - overflow: hidden; - position: absolute; - bottom: 0; - right: 0; } @media (max-width: 768px) { diff --git a/ui/home.vue b/ui/home.vue index a4e601f..9b185b2 100644 --- a/ui/home.vue +++ b/ui/home.vue @@ -104,8 +104,6 @@ >.
- -