12666 Passed azureAccount into onFetchDatabases and set on tempProfile. (#13239)

This commit is contained in:
Justin M
2020-11-16 11:24:22 -08:00
committed by GitHub
parent b57bf53b67
commit c18a54bc1d
4 changed files with 8 additions and 5 deletions

View File

@@ -88,6 +88,8 @@ export class ConnectionStore {
} }
return { profile: credentialsItem, savedCred: !!savedCred }; return { profile: credentialsItem, savedCred: !!savedCred };
}); });
} else if (credentialsItem.authenticationType === 'AzureMFA' && credentialsItem.azureAccount) {
return Promise.resolve({ profile: credentialsItem, savedCred: true });
} else { } else {
// No need to look up the password // No need to look up the password
return Promise.resolve({ profile: credentialsItem, savedCred: credentialsItem.savePassword }); return Promise.resolve({ profile: credentialsItem, savedCred: credentialsItem.savePassword });

View File

@@ -47,8 +47,8 @@ export class ConnectionController implements IConnectionComponentController {
onCreateNewServerGroup: () => this.onCreateNewServerGroup(), onCreateNewServerGroup: () => this.onCreateNewServerGroup(),
onAdvancedProperties: () => this.handleOnAdvancedProperties(), onAdvancedProperties: () => this.handleOnAdvancedProperties(),
onSetAzureTimeOut: () => this.handleonSetAzureTimeOut(), onSetAzureTimeOut: () => this.handleonSetAzureTimeOut(),
onFetchDatabases: (serverName: string, authenticationType: string, userName?: string, password?: string) => this.onFetchDatabases( onFetchDatabases: (serverName: string, authenticationType: string, userName?: string, password?: string, azureAccount?: string) => this.onFetchDatabases(
serverName, authenticationType, userName, password).then(result => { serverName, authenticationType, userName, password, azureAccount).then(result => {
return result; return result;
}), }),
onAzureTenantSelection: (azureTenantId?: string) => this.onAzureTenantSelection(azureTenantId), onAzureTenantSelection: (azureTenantId?: string) => this.onAzureTenantSelection(azureTenantId),
@@ -56,7 +56,7 @@ export class ConnectionController implements IConnectionComponentController {
this._providerName = providerName; this._providerName = providerName;
} }
protected async onFetchDatabases(serverName: string, authenticationType: string, userName?: string, password?: string): Promise<string[]> { protected async onFetchDatabases(serverName: string, authenticationType: string, userName?: string, password?: string, azureAccount?: string): Promise<string[]> {
let tempProfile = this._model; let tempProfile = this._model;
tempProfile.serverName = serverName; tempProfile.serverName = serverName;
tempProfile.authenticationType = authenticationType; tempProfile.authenticationType = authenticationType;
@@ -64,6 +64,7 @@ export class ConnectionController implements IConnectionComponentController {
tempProfile.password = password; tempProfile.password = password;
tempProfile.groupFullName = ''; tempProfile.groupFullName = '';
tempProfile.saveProfile = false; tempProfile.saveProfile = false;
tempProfile.azureAccount = azureAccount;
let uri = this._connectionManagementService.getConnectionUri(tempProfile); let uri = this._connectionManagementService.getConnectionUri(tempProfile);
if (this._databaseCache.has(uri)) { if (this._databaseCache.has(uri)) {
let cachedDatabases: string[] = this._databaseCache.get(uri); let cachedDatabases: string[] = this._databaseCache.get(uri);

View File

@@ -42,7 +42,7 @@ export interface IConnectionComponentCallbacks {
onCreateNewServerGroup?: () => void; onCreateNewServerGroup?: () => void;
onAdvancedProperties?: () => void; onAdvancedProperties?: () => void;
onSetAzureTimeOut?: () => void; onSetAzureTimeOut?: () => void;
onFetchDatabases?: (serverName: string, authenticationType: string, userName?: string, password?: string) => Promise<string[]>; onFetchDatabases?: (serverName: string, authenticationType: string, userName?: string, password?: string, azureAccount?: string) => Promise<string[]>;
onAzureTenantSelection?: (azureTenantId?: string) => void; onAzureTenantSelection?: (azureTenantId?: string) => void;
} }

View File

@@ -364,7 +364,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
this._databaseDropdownExpanded = true; this._databaseDropdownExpanded = true;
if (this.serverName) { if (this.serverName) {
this._databaseNameInputBox.values = [this._loadingDatabaseName]; this._databaseNameInputBox.values = [this._loadingDatabaseName];
this._callbacks.onFetchDatabases(this.serverName, this.authenticationType, this.userName, this._password).then(databases => { this._callbacks.onFetchDatabases(this.serverName, this.authenticationType, this.userName, this._password, this.azureAccount).then(databases => {
if (databases) { if (databases) {
this._databaseNameInputBox.values = databases.sort((a, b) => a.localeCompare(b)); this._databaseNameInputBox.values = databases.sort((a, b) => a.localeCompare(b));
} else { } else {