Accounts: Enable notification for accounts change (#2432)

* Enable notification for accounts change

* Fixed bugs in extHostAccountManagement.test.ts

* Fixed as commented:
1. Removed AccountWithProviderHandle
2. Use a private dictionary _accounts in ExtHostAccountManagement to cache all accounts and corresponding provider handles.
3. getSecurityToken gets provider handle from _accounts for specified account.
4. Added / changed unit tests for getAllAccounts & getSecurityToken
This commit is contained in:
Vincent Feng
2018-09-07 08:23:28 +08:00
committed by GitHub
parent 197e1c651f
commit 005c28dd3a
6 changed files with 177 additions and 47 deletions

View File

@@ -92,11 +92,14 @@ export function createApiFactory(
accountUpdated(updatedAccount: sqlops.Account): void {
return extHostAccountManagement.$accountUpdated(updatedAccount);
},
getAllAccounts(): Thenable<sqlops.AccountWithProviderHandle[]> {
getAllAccounts(): Thenable<sqlops.Account[]> {
return extHostAccountManagement.$getAllAccounts();
},
getSecurityToken(account: sqlops.AccountWithProviderHandle): Thenable<{}> {
return extHostAccountManagement.$getSecurityToken(account.providerHandle, account.account);
getSecurityToken(account: sqlops.Account): Thenable<{}> {
return extHostAccountManagement.$getSecurityToken(account);
},
onDidChangeAccounts(listener: (e: sqlops.DidChangeAccountsParams) => void, thisArgs?: any, disposables?: extHostTypes.Disposable[]) {
return extHostAccountManagement.onDidChangeAccounts(listener, thisArgs, disposables);
}
};