Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auth: Minor fixes to signInToTenant #1854

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions auth/src/signInToTenant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function signInToTenant(subscriptionProvider: AzureSubscriptionProv

async function pickTenant(subscriptionProvider: AzureSubscriptionProvider): Promise<string | undefined> {
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,
});
Expand All @@ -34,12 +34,15 @@ interface TenantQuickPickItem extends vscode.QuickPickItem {

async function getPicks(subscriptionProvider: AzureSubscriptionProvider): Promise<TenantQuickPickItem[]> {
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;
}
Loading