From 8b349dbcde213091a0d1e958496d7948cf9abaec Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Mon, 1 Jul 2019 22:11:14 +0000 Subject: [PATCH] Change service installation messages to not steal focus (#6227) * Change service installation messages to not steal focus * Undo unnecessary changes to localized strings in serviceClient.ts * Add default case for missing server event types --- .../import/src/services/serviceClient.ts | 7 ++++--- extensions/mssql/src/main.ts | 21 +++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/extensions/import/src/services/serviceClient.ts b/extensions/import/src/services/serviceClient.ts index da2de41727..7e343692b9 100644 --- a/extensions/import/src/services/serviceClient.ts +++ b/extensions/import/src/services/serviceClient.ts @@ -109,10 +109,10 @@ export class ServiceClient { private generateHandleServerProviderEvent(): EventAndListener { let dots = 0; return (e: string, ...args: any[]) => { - this.outputChannel.show(); - this.statusView.show(); switch (e) { case Events.INSTALL_START: + this.outputChannel.show(true); + this.statusView.show(); this.outputChannel.appendLine(localize('installingServiceDetailed', 'Installing {0} service to {1}', Constants.serviceName, args[0])); this.statusView.text = localize('installingService', 'Installing Service'); break; @@ -121,7 +121,7 @@ export class ServiceClient { break; case Events.DOWNLOAD_START: this.outputChannel.appendLine(localize('downloadingService', 'Downloading {0}', args[0])); - this.outputChannel.append(`(${Math.ceil(args[1] / 1024)} KB)`); + this.outputChannel.append(localize('downloadingServiceSize', '({0} KB)', Math.ceil(args[1] / 1024).toLocaleString(vscode.env.language))); this.statusView.text = localize('downloadingServiceStatus', 'Downloading Service'); break; case Events.DOWNLOAD_PROGRESS: @@ -135,6 +135,7 @@ export class ServiceClient { this.outputChannel.appendLine(localize('downloadingServiceComplete', 'Done!')); break; default: + console.error(`Unknown event from Server Provider ${e}`); break; } }; diff --git a/extensions/mssql/src/main.ts b/extensions/mssql/src/main.ts index ee04d9192d..7dda2a7fee 100644 --- a/extensions/mssql/src/main.ts +++ b/extensions/mssql/src/main.ts @@ -362,20 +362,20 @@ function generateServerOptions(executablePath: string): ServerOptions { function generateHandleServerProviderEvent() { let dots = 0; return (e: string, ...args: any[]) => { - outputChannel.show(); - statusView.show(); switch (e) { case Events.INSTALL_START: - outputChannel.appendLine(`Installing ${Constants.serviceName} service to ${args[0]}`); - statusView.text = 'Installing Service'; + outputChannel.show(true); + statusView.show(); + outputChannel.appendLine(localize('installingServiceChannelMsg', 'Installing {0} service to {1}', Constants.serviceName, args[0])); + statusView.text = localize('installingServiceStatusMsg', 'Installing Service'); break; case Events.INSTALL_END: - outputChannel.appendLine('Installed'); + outputChannel.appendLine(localize('installedServiceChannelMsg', 'Installed')); break; case Events.DOWNLOAD_START: - outputChannel.appendLine(`Downloading ${args[0]}`); - outputChannel.append(`(${Math.ceil(args[1] / 1024)} KB)`); - statusView.text = 'Downloading Service'; + outputChannel.appendLine(localize('downloadingServiceChannelMsg', 'Downloading {0}', args[0])); + outputChannel.append(localize('downloadingServiceSizeChannelMsg', '({0} KB)', Math.ceil(args[1] / 1024).toLocaleString(vscode.env.language))); + statusView.text = localize('downloadingServiceStatusMsg', 'Downloading Service'); break; case Events.DOWNLOAD_PROGRESS: let newDots = Math.ceil(args[0] / 5); @@ -385,7 +385,10 @@ function generateHandleServerProviderEvent() { } break; case Events.DOWNLOAD_END: - outputChannel.appendLine('Done!'); + outputChannel.appendLine(localize('downloadServiceDoneChannelMsg', 'Done!')); + break; + default: + console.error(`Unknown event from Server Provider ${e}`); break; } };