Use a unique key for the accounts (#11380)

* Use a unique key for the accounts

* Fix some tests

* Simplify display name

* Change to a random UUID
This commit is contained in:
Amir Omidi
2020-07-17 13:39:53 -07:00
committed by GitHub
parent eb82cd3f4b
commit 5613a97fae
9 changed files with 31 additions and 23 deletions

2
src/sql/azdata.d.ts vendored
View File

@@ -2160,7 +2160,7 @@ declare module 'azdata' {
displayName: string;
/**
* User id that identifies the account, such as "user@contoso.com".
* Unique user id that identifies the account.
*/
userId: string;
}

View File

@@ -484,4 +484,10 @@ declare module 'azdata' {
childProvider?: string;
type?: ExtensionNodeType;
}
export interface AccountDisplayInfo {
email?: string;
name?: string;
}
}

View File

@@ -71,13 +71,7 @@ export class AccountPickerListRenderer implements IListRenderer<azdata.Account,
templateData.icon.classList.add('account-logo', account.displayInfo.accountType);
templateData.contextualDisplayName.innerText = account.displayInfo.contextualDisplayName;
// show the account display name text, something like "User Name (user@email.com)"
if (account.displayInfo.userId && account.displayInfo.displayName) {
templateData.displayName.innerText = account.displayInfo.displayName + ' (' + account.displayInfo.userId + ')';
} else {
templateData.displayName.innerText = account.displayInfo.displayName;
}
templateData.displayName.innerText = account.displayInfo.displayName;
if (account.isStale) {
templateData.badgeContent.className = 'badge-content codicon warning-badge';

View File

@@ -520,7 +520,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
let oldSelection = this._azureAccountDropdown.value;
const accounts = await this._accountManagementService.getAccounts();
this._azureAccountList = accounts.filter(a => a.key.providerId.startsWith('azure'));
let accountDropdownOptions = this._azureAccountList.map(account => account.key.accountId);
let accountDropdownOptions = this._azureAccountList.map(account => account.displayInfo.displayName);
if (accountDropdownOptions.length === 0) {
// If there are no accounts add a blank option so that add account isn't automatically selected
accountDropdownOptions.unshift('');