From 67401d743265f188367e84c4c58e0339772ae0ca Mon Sep 17 00:00:00 2001 From: alexweininger Date: Mon, 9 Dec 2024 13:20:54 -0800 Subject: [PATCH] auth: Minor fixes to signInToTenant --- auth/src/signInToTenant.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/auth/src/signInToTenant.ts b/auth/src/signInToTenant.ts index d7d7befe21..a8554c1612 100644 --- a/auth/src/signInToTenant.ts +++ b/auth/src/signInToTenant.ts @@ -21,7 +21,7 @@ export async function signInToTenant(subscriptionProvider: AzureSubscriptionProv async function pickTenant(subscriptionProvider: AzureSubscriptionProvider): Promise { const pick = await vscode.window.showQuickPick(getPicks(subscriptionProvider), { - placeHolder: 'Select Directory to Sign In To', // TODO: localize + placeHolder: 'Select a Tenant (Directory) to Sign In To', // TODO: localize matchOnDescription: true, // allow searching by tenantId ignoreFocusOut: true, }); @@ -34,12 +34,15 @@ interface TenantQuickPickItem extends vscode.QuickPickItem { async function getPicks(subscriptionProvider: AzureSubscriptionProvider): Promise { const unauthenticatedTenants = await getUnauthenticatedTenants(subscriptionProvider); - const picks: TenantQuickPickItem[] = unauthenticatedTenants.map(tenant => ({ - label: tenant.displayName ?? '', - description: tenant.tenantId ?? '', - detail: tenant.defaultDomain ?? '', - tenant, - })); + const picks: TenantQuickPickItem[] = unauthenticatedTenants + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + .sort((a, b) => (a.displayName!).localeCompare(b.displayName!)) + .map(tenant => ({ + label: tenant.displayName ?? '', + description: tenant.tenantId ?? '', + detail: tenant.defaultDomain ?? '', + tenant, + })); return picks; }