mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -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 _providerNameToDisplayNameMap: { [providerDisplayName: string]: string } = {};
|
||||||
private _providerTypes: string[] = [];
|
private _providerTypes: string[] = [];
|
||||||
private _currentProviderType: string = Constants.mssqlProviderName;
|
private _currentProviderType: string = Constants.mssqlProviderName;
|
||||||
private _previousProviderType: string = undefined;
|
|
||||||
private _connecting: boolean = false;
|
private _connecting: boolean = false;
|
||||||
private _connectionErrorTitle = localize('connectionError', 'Connection error');
|
private _connectionErrorTitle = localize('connectionError', 'Connection error');
|
||||||
private _dialogDeferredPromise: Deferred<IConnectionProfile>;
|
private _dialogDeferredPromise: Deferred<IConnectionProfile>;
|
||||||
private _toDispose = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is used to work around the interconnectedness of this code
|
* 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 {
|
private createModel(model: IConnectionProfile): ConnectionProfile {
|
||||||
let defaultProvider = this.getDefaultProviderName();
|
const defaultProvider = this.getDefaultProviderName();
|
||||||
let providerName = model ? model.providerName : defaultProvider;
|
let providerName = model ? model.providerName : defaultProvider;
|
||||||
providerName = providerName ? providerName : defaultProvider;
|
providerName = providerName ? providerName : defaultProvider;
|
||||||
|
if (model && !model.providerName) {
|
||||||
|
model.providerName = providerName;
|
||||||
|
}
|
||||||
let newProfile = new ConnectionProfile(this._capabilitiesService, model || providerName);
|
let newProfile = new ConnectionProfile(this._capabilitiesService, model || providerName);
|
||||||
newProfile.saveProfile = true;
|
newProfile.saveProfile = true;
|
||||||
newProfile.generateNewId();
|
newProfile.generateNewId();
|
||||||
@@ -441,18 +442,10 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
|||||||
this._connectionDialog.onFillinConnectionInputs((input) => this.handleFillInConnectionInputs(input));
|
this._connectionDialog.onFillinConnectionInputs((input) => this.handleFillInConnectionInputs(input));
|
||||||
this._connectionDialog.onResetConnection(() => this.handleProviderOnResetConnection());
|
this._connectionDialog.onResetConnection(() => this.handleProviderOnResetConnection());
|
||||||
this._connectionDialog.render();
|
this._connectionDialog.render();
|
||||||
this._previousProviderType = this._currentProviderType;
|
|
||||||
}
|
}
|
||||||
this._connectionDialog.newConnectionParams = params;
|
this._connectionDialog.newConnectionParams = params;
|
||||||
// if provider changed
|
this._connectionDialog.updateProvider(this._providerNameToDisplayNameMap[this._currentProviderType]);
|
||||||
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;
|
|
||||||
}
|
|
||||||
return new Promise<void>(() => {
|
return new Promise<void>(() => {
|
||||||
this._connectionDialog.open(this._connectionManagementService.getRecentConnections(params.providers).length > 0);
|
this._connectionDialog.open(this._connectionManagementService.getRecentConnections(params.providers).length > 0);
|
||||||
this.uiController.focusOnOpen();
|
this.uiController.focusOnOpen();
|
||||||
|
|||||||
Reference in New Issue
Block a user