From 59b0e6737f2f2c85635fc4c452562796eee40b3b Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Mon, 17 Jun 2019 15:32:36 +0000 Subject: [PATCH] Update provider correctly when showing the dialog (#5995) --- .../browser/connectionDialogService.ts | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/sql/workbench/services/connection/browser/connectionDialogService.ts b/src/sql/workbench/services/connection/browser/connectionDialogService.ts index 475d734b71..f04de414b8 100644 --- a/src/sql/workbench/services/connection/browser/connectionDialogService.ts +++ b/src/sql/workbench/services/connection/browser/connectionDialogService.ts @@ -69,11 +69,9 @@ export class ConnectionDialogService implements IConnectionDialogService { private _providerNameToDisplayNameMap: { [providerDisplayName: string]: string } = {}; private _providerTypes: string[] = []; private _currentProviderType: string = Constants.mssqlProviderName; - private _previousProviderType: string = undefined; private _connecting: boolean = false; private _connectionErrorTitle = localize('connectionError', 'Connection error'); private _dialogDeferredPromise: Deferred; - private _toDispose = []; /** * This is used to work around the interconnectedness of this code @@ -356,9 +354,12 @@ export class ConnectionDialogService implements IConnectionDialogService { } private createModel(model: IConnectionProfile): ConnectionProfile { - let defaultProvider = this.getDefaultProviderName(); + const defaultProvider = this.getDefaultProviderName(); let providerName = model ? model.providerName : defaultProvider; providerName = providerName ? providerName : defaultProvider; + if (model && !model.providerName) { + model.providerName = providerName; + } let newProfile = new ConnectionProfile(this._capabilitiesService, model || providerName); newProfile.saveProfile = true; newProfile.generateNewId(); @@ -441,18 +442,10 @@ export class ConnectionDialogService implements IConnectionDialogService { this._connectionDialog.onFillinConnectionInputs((input) => this.handleFillInConnectionInputs(input)); this._connectionDialog.onResetConnection(() => this.handleProviderOnResetConnection()); this._connectionDialog.render(); - this._previousProviderType = this._currentProviderType; } this._connectionDialog.newConnectionParams = params; - // if provider changed - if ((this._previousProviderType !== this._currentProviderType) || - // or if currentProvider not set correctly yet - !(this._currentProviderType === Constants.cmsProviderName && params.providers && params.providers.length > 1)) { - this._previousProviderType = undefined; - this._connectionDialog.updateProvider(this._providerNameToDisplayNameMap[this.getDefaultProviderName()]); - } else { - this._connectionDialog.newConnectionParams = params; - } + this._connectionDialog.updateProvider(this._providerNameToDisplayNameMap[this._currentProviderType]); + return new Promise(() => { this._connectionDialog.open(this._connectionManagementService.getRecentConnections(params.providers).length > 0); this.uiController.focusOnOpen();