Fix #4089 Linked account cancel (#5347)

VSCode serialization changed rejection handling to only serialize errors, which caused things to break
- Changed to return either account info or a cancel message in the resolve
- Rewrote to use promises. Tracking how to return canceled through 4+ thenables was way trickier than just using a promise
- Updated unit tests to handle new scenario
- Tested integration tests, realized they a) didn't run and b) didn't passed. 
  - Added vscode dev dependency to fix run issue
  - Fixed tests to account for behavior changes in tree state.
This commit is contained in:
Kevin Cunnane
2019-05-06 09:13:03 -07:00
committed by GitHub
parent b9d985b663
commit 022761aa4b
11 changed files with 1130 additions and 145 deletions

View File

@@ -36,11 +36,11 @@ export class ExtHostAccountManagement extends ExtHostAccountManagementShape {
return this._withProvider(handle, (provider: azdata.AccountProvider) => provider.initialize(restoredAccounts));
}
public $prompt(handle: number): Thenable<azdata.Account> {
public $prompt(handle: number): Thenable<azdata.Account | azdata.PromptFailedResult> {
return this._withProvider(handle, (provider: azdata.AccountProvider) => provider.prompt());
}
public $refresh(handle: number, account: azdata.Account): Thenable<azdata.Account> {
public $refresh(handle: number, account: azdata.Account): Thenable<azdata.Account | azdata.PromptFailedResult> {
return this._withProvider(handle, (provider: azdata.AccountProvider) => provider.refresh(account));
}

View File

@@ -81,10 +81,10 @@ export class MainThreadAccountManagement implements MainThreadAccountManagementS
initialize(restoredAccounts: azdata.Account[]): Thenable<azdata.Account[]> {
return self._proxy.$initialize(handle, restoredAccounts);
},
prompt(): Thenable<azdata.Account> {
prompt(): Thenable<azdata.Account | azdata.PromptFailedResult> {
return self._proxy.$prompt(handle);
},
refresh(account: azdata.Account): Thenable<azdata.Account> {
refresh(account: azdata.Account): Thenable<azdata.Account | azdata.PromptFailedResult> {
return self._proxy.$refresh(handle, account);
}
};

View File

@@ -30,8 +30,8 @@ export abstract class ExtHostAccountManagementShape {
$clear(handle: number, accountKey: azdata.AccountKey): Thenable<void> { throw ni(); }
$getSecurityToken(account: azdata.Account, resource?: azdata.AzureResource): Thenable<{}> { throw ni(); }
$initialize(handle: number, restoredAccounts: azdata.Account[]): Thenable<azdata.Account[]> { throw ni(); }
$prompt(handle: number): Thenable<azdata.Account> { throw ni(); }
$refresh(handle: number, account: azdata.Account): Thenable<azdata.Account> { throw ni(); }
$prompt(handle: number): Thenable<azdata.Account | azdata.PromptFailedResult> { throw ni(); }
$refresh(handle: number, account: azdata.Account): Thenable<azdata.Account | azdata.PromptFailedResult> { throw ni(); }
$accountsChanged(handle: number, accounts: azdata.Account[]): Thenable<void> { throw ni(); }
}