Expand account picker support to multiple providers (#23952)

* fix dropdown behavior

* expand account picker support to multiple providers

* fix tests

* fixed unresolved promise issue
This commit is contained in:
Christopher Suh
2023-07-21 08:43:18 -07:00
committed by GitHub
parent 9a891605c8
commit f5bed289af
10 changed files with 57 additions and 20 deletions

View File

@@ -50,7 +50,12 @@ export class AddAccountAction extends Action {
// Fire the event that we've started adding accounts
this._addAccountStartEmitter.fire();
try {
await this._accountManagementService.addAccount(this._providerId);
if (!this._providerId) {
let providerId = await this._accountManagementService.promptProvider();
await this._accountManagementService.addAccount(providerId);
} else {
await this._accountManagementService.addAccount(this._providerId);
}
this._addAccountCompleteEmitter.fire();
} catch (err) {
this.logService.error(`Error while adding account: ${err}`);

View File

@@ -21,7 +21,6 @@ export class AccountPickerViewModel {
public selectedTenantId: string | undefined;
constructor(
_providerId: string,
@IAccountManagementService private _accountManagementService: IAccountManagementService
) {
// Create our event emitters

View File

@@ -21,6 +21,7 @@ export interface IAccountManagementService {
getAccountProviderMetadata(): Promise<azdata.AccountProviderMetadata[]>;
getAccountsForProvider(providerId: string): Promise<azdata.Account[]>;
getAccounts(): Promise<azdata.Account[]>;
promptProvider(): Promise<string | undefined>;
/**
* @deprecated
*/