mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 09:35:36 -05:00
Public api changes to namespace accounts & connection. (#2383)
* 1.Added following functions to namespace accounts
function getAllAccounts(): Thenable<AccountWithProviderHandle[]>;
function getSecurityToken(account: AccountWithProviderHandle): Thenable<{}>;
2.Added class AccountWithProviderHandle as the wrapper for Account
3.Changed function openConnectionDialog of namespace connection to allow connection dialog initialized with specified parameters, i.e., server name, database name, etc.
function openConnectionDialog(provider?: string[], initialConnectionProfile?: IConnectionProfile): Thenable<connection.Connection>;
* Added unit tests for ExtHostAccountManagement.$getAllAccounts
This commit is contained in:
@@ -64,6 +64,33 @@ export class ExtHostAccountManagement extends ExtHostAccountManagementShape {
|
||||
this._proxy.$accountUpdated(updatedAccount);
|
||||
}
|
||||
|
||||
public $getAllAccounts(): Thenable<sqlops.AccountWithProviderHandle[]> {
|
||||
if (Object.keys(this._providers).length === 0) {
|
||||
throw new Error('No account providers registered.');
|
||||
}
|
||||
|
||||
let accountWithProviderHandles: sqlops.AccountWithProviderHandle[] = [];
|
||||
let promises: Thenable<void>[] = [];
|
||||
|
||||
for (let providerKey in this._providers) {
|
||||
let providerHandle = parseInt(providerKey);
|
||||
let provider = this._providers[providerHandle];
|
||||
|
||||
promises.push(this._proxy.$getAccountsForProvider(provider.metadata.id).then(
|
||||
(accounts) => {
|
||||
accounts.forEach((account) => {
|
||||
accountWithProviderHandles.push({
|
||||
account: account,
|
||||
providerHandle: providerHandle
|
||||
});
|
||||
});
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
return Promise.all(promises).then(() => accountWithProviderHandles);
|
||||
}
|
||||
|
||||
public $registerAccountProvider(providerMetadata: sqlops.AccountProviderMetadata, provider: sqlops.AccountProvider): Disposable {
|
||||
let self = this;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user