From b2daf60bce22389c4ffdfdd6c30c0cb8f367d5a5 Mon Sep 17 00:00:00 2001 From: Egor Kichin Date: Tue, 27 Dec 2022 10:28:10 +0300 Subject: [PATCH 1/2] Fix test and server logs in vs-code. --- vscode-plugin/src/client/client.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vscode-plugin/src/client/client.ts b/vscode-plugin/src/client/client.ts index 765352ad..98ba760f 100644 --- a/vscode-plugin/src/client/client.ts +++ b/vscode-plugin/src/client/client.ts @@ -130,10 +130,18 @@ export class Client { if (this.noConnectionEstablishedBefore) { this.noConnectionEstablishedBefore = false; await this.events.onDidConnectFirstTimeEventEmitter.fire(); + await Promise.all([ + this.provideLogChannel(), + this.provideGTestChannel() + ]); } if (!this.isConnectionEstablished()) { messages.showInfoMessage(messages.successfullyConnected); logger.info('Successfully connected to server'); + await Promise.all([ + this.provideLogChannel(), + this.provideGTestChannel() + ]); } if (this.newClient || !response.getLinked()) { await Promise.all([ @@ -238,7 +246,6 @@ export class Client { private async writeGTestLog(responseAny: any): Promise { const gtestEntry = responseAny as LogEntry; - utbotUI.channels().outputGTestChannel.show(true); utbotUI.channels().outputGTestChannel.appendLine(gtestEntry.getMessage()); } From f34f2cf02c909b2c183619077f5177bab28f97bd Mon Sep 17 00:00:00 2001 From: Egor Kichin Date: Mon, 9 Jan 2023 12:27:57 +0300 Subject: [PATCH 2/2] Add opportunity to enter sftp password in pop-up window. --- vscode-plugin/src/config/defaultValues.ts | 9 +++++++-- vscode-plugin/src/wizard/wizard.ts | 13 +++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/vscode-plugin/src/config/defaultValues.ts b/vscode-plugin/src/config/defaultValues.ts index ed7da2cd..976af00a 100644 --- a/vscode-plugin/src/config/defaultValues.ts +++ b/vscode-plugin/src/config/defaultValues.ts @@ -60,10 +60,15 @@ export class DefaultConfigValues { return username.toString(); } - public static getDefaultSFTPPassword(): string{ + public static async getDefaultSFTPPassword(): Promise { const password = vsUtils.getFromSftpConfig("password"); if ((password === undefined) || (password.length === 0)) { - return "utbot"; + vs.window.createInputBox().show(); + const passwordInput = vs.window.showInputBox({ + password: true, + title: "Password", + }) ?? ''; + return passwordInput; } return password.toString(); } diff --git a/vscode-plugin/src/wizard/wizard.ts b/vscode-plugin/src/wizard/wizard.ts index c3c2765e..f47696a1 100644 --- a/vscode-plugin/src/wizard/wizard.ts +++ b/vscode-plugin/src/wizard/wizard.ts @@ -103,11 +103,18 @@ export class UtbotWizardPanel { break; } else if (message.command.startsWith(`SFTP_`)) { + let password = await defcfg.DefaultConfigValues.getDefaultSFTPPassword(); + const username = defcfg.DefaultConfigValues.getDefaultSFTPUsername().toString(); + if (password === undefined){ + password = ''; + } this.pingSFTPAction( message.host, message.port, message.command + '_success', - message.command + '_failure'); + message.command + '_failure', + password.toString(), + username); break; } } @@ -269,10 +276,8 @@ export class UtbotWizardPanel { } private lastSFTPRequest: Promise | null = null; - private pingSFTPAction(host: string, port: number, successCmd: string, failureCmd: string): void { + private pingSFTPAction(host: string, port: number, successCmd: string, failureCmd: string, password: string, username: string): void { const ssh = new NodeSSH(); - const username = defcfg.DefaultConfigValues.getDefaultSFTPUsername().toString(); - const password = defcfg.DefaultConfigValues.getDefaultSFTPPassword().toString(); const capturedPingPromiseForLambda = ssh.connect({ host: host, port: port,