mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 09:35:38 -05:00
Update provider correctly when showing the dialog (#5995)
This commit is contained in:
@@ -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<IConnectionProfile>;
|
||||
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<void>(() => {
|
||||
this._connectionDialog.open(this._connectionManagementService.getRecentConnections(params.providers).length > 0);
|
||||
this.uiController.focusOnOpen();
|
||||
|
||||
Reference in New Issue
Block a user