mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add eslint rule padding-line-between-statements (#1593)
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
1 parent
7b77f18376
commit
dcf253e7d5
401 files changed
+2018
-40
No files matched your search
@@ -50,26 +50,32 @@ export class TerminalApi extends WebSocketApi {
|
||||
const { id, node } = this.options;
|
||||
const wss = `ws${protocol === "https:" ? "s" : ""}://`;
|
||||
const query: TerminalApiQuery = { id };
|
||||
|
||||
if (port) {
|
||||
port = `:${port}`;
|
||||
}
|
||||
|
||||
if (node) {
|
||||
query.node = node;
|
||||
query.type = "node";
|
||||
}
|
||||
|
||||
return `${wss}${hostname}${port}/api?${stringify(query)}`;
|
||||
}
|
||||
|
||||
async connect() {
|
||||
const apiUrl = await this.getUrl();
|
||||
|
||||
this.emitStatus("Connecting ...");
|
||||
this.onData.addListener(this._onReady, { prepend: true });
|
||||
|
||||
return super.connect(apiUrl);
|
||||
}
|
||||
|
||||
destroy() {
|
||||
if (!this.socket) return;
|
||||
const exitCode = String.fromCharCode(4); // ctrl+d
|
||||
|
||||
this.sendCommand(exitCode);
|
||||
setTimeout(() => super.destroy(), 2000);
|
||||
}
|
||||
@@ -87,6 +93,7 @@ export class TerminalApi extends WebSocketApi {
|
||||
this.onData.removeListener(this._onReady);
|
||||
this.flush();
|
||||
this.onData.emit(data); // re-emit data
|
||||
|
||||
return false; // prevent calling rest of listeners
|
||||
}
|
||||
|
||||
@@ -100,6 +107,7 @@ export class TerminalApi extends WebSocketApi {
|
||||
|
||||
sendTerminalSize(cols: number, rows: number) {
|
||||
const newSize = { Width: cols, Height: rows };
|
||||
|
||||
if (!isEqual(this.size, newSize)) {
|
||||
this.sendCommand(JSON.stringify(newSize), TerminalChannels.TERMINAL_SIZE);
|
||||
this.size = newSize;
|
||||
@@ -108,6 +116,7 @@ export class TerminalApi extends WebSocketApi {
|
||||
|
||||
protected parseMessage(data: string) {
|
||||
data = data.substr(1); // skip channel
|
||||
|
||||
return base64.decode(data);
|
||||
}
|
||||
|
||||
@@ -125,10 +134,12 @@ export class TerminalApi extends WebSocketApi {
|
||||
|
||||
protected emitStatus(data: string, options: { color?: TerminalColor; showTime?: boolean } = {}) {
|
||||
const { color, showTime } = options;
|
||||
|
||||
if (color) {
|
||||
data = `${color}${data}${TerminalColor.NO_COLOR}`;
|
||||
}
|
||||
let time;
|
||||
|
||||
if (showTime) {
|
||||
time = `${(new Date()).toLocaleString()} `;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user