feat: 🎸 Update scope dropdown in login to show current scope (#3308)

* feat: 🎸 Update scope dropdown in login to show current scope

* test: 💍 Update e2e tests
This commit is contained in:
Zhihe Li authored and GitHub committed 2026-06-08 17:08:23 -04:00
1 parent b9517e0233
commit 576fef9f8a
7 files changed
+32 -25

No files matched your search

@@ -30,7 +30,6 @@ copy-error-detail-to-clipboard: Copy error detail to clipboard
authenticate: Sign In
deauthenticate: Sign Out
choose-org: Choose Scope
choose-different-org: Choose a different scope
add-host-set: Create Host Set
add-host: Create Host
add-principals: Add Principals
@@ -174,8 +174,8 @@ test(
// Log in using ldap account
await loginPage.logout(adminLoginName);
await page.getByText('Choose a different scope').click();
await page.getByRole('link', { name: orgName }).click();
await page.getByRole('button', { name: /global/i }).click();
await page.getByRole('option', { name: orgName }).click();
await page.getByRole('link', { name: ldapAuthMethodName }).click();
await loginPage.login(ldapUserName, ldapUserPassword);
await expect(
@@ -129,8 +129,8 @@ test(
// Log in using oidc account
await loginPage.logout(adminLoginName);
await page.getByText('Choose a different scope').click();
await page.getByRole('link', { name: orgName }).click();
await page.getByRole('button', { name: /global/i }).click();
await page.getByRole('option', { name: orgName }).click();
await page.getByRole('link', { name: oidcAuthMethodName }).click();
const pagePromise = context.waitForEvent('page');
await page.getByRole('button', { name: 'Sign In' }).click();
@@ -58,8 +58,8 @@ test(
// Log in using new account
await loginPage.logout(adminLoginName);
await page.getByText('Choose a different scope').click();
await page.getByRole('link', { name: orgName }).click();
await page.getByRole('button', { name: /global/i }).click();
await page.getByRole('option', { name: orgName }).click();
await page.getByRole('link', { name: authMethodName }).click();
await loginPage.login(username, password);
@@ -97,8 +97,8 @@ test(
// Log in using new password
await loginPage.logout(adminLoginName);
await page.getByText('Choose a different scope').click();
await page.getByRole('link', { name: orgName }).click();
await page.getByRole('button', { name: /global/i }).click();
await page.getByRole('option', { name: orgName }).click();
await page.getByRole('link', { name: authMethodName }).click();
await loginPage.login(username, newPassword);
await expect(
@@ -52,8 +52,8 @@ test(
// Log in using new account
await page.reload();
await page.getByText('Choose a different scope').click();
await page.getByRole('link', { name: org.name }).click();
await page.getByRole('button', { name: /global/i }).click();
await page.getByRole('option', { name: org.name }).click();
await page.getByRole('link', { name: authMethod.name }).click();
const loginPage = new LoginPage(page);
await loginPage.login(username, password);
@@ -79,8 +79,8 @@ test(
// Confirm user cannot log in with old password
await loginPage.logout(username);
await page.getByText('Choose a different scope').click();
await page.getByRole('link', { name: org.name }).click();
await page.getByRole('button', { name: /global/i }).click();
await page.getByRole('option', { name: org.name }).click();
await page.getByRole('link', { name: authMethod.name }).click();
await page.getByLabel('Login Name').fill(username);
await page.getByLabel('Password', { exact: true }).fill(password);
@@ -28,23 +28,25 @@
<Hds::Dropdown @listPosition='bottom-left' as |dd|>
<dd.ToggleButton
@text={{t 'actions.choose-different-org'}}
@icon='org'
@text={{@model.scope.displayName}}
@icon={{if (eq @model.scope.id 'global') 'globe' 'org'}}
@color='secondary'
/>
<dd.Interactive
<dd.Checkmark
@route='scopes.scope.authenticate'
@model='global'
@selected={{eq @model.scope.id 'global'}}
>
{{t 'titles.global'}}
</dd.Interactive>
</dd.Checkmark>
{{#each this.sortedScopes as |scope|}}
<dd.Interactive
<dd.Checkmark
@route='scopes.scope.authenticate'
@model={{scope.id}}
@selected={{eq @model.scope.id scope.id}}
>
{{scope.displayName}}
</dd.Interactive>
</dd.Checkmark>
{{/each}}
</Hds::Dropdown>
<Hds::Separator />
@@ -18,17 +18,23 @@
<Hds::Dropdown @listPosition='bottom-left' as |dd|>
<dd.ToggleButton
@text={{t 'actions.choose-different-org'}}
@icon='org'
@text={{@model.scope.displayName}}
@icon={{if (eq @model.scope.id 'global') 'globe' 'org'}}
@color='secondary'
/>
<dd.Interactive {{on 'click' (fn this.selectScope 'global' dd.close)}}>
<dd.Checkmark
@selected={{eq @model.scope.id 'global'}}
{{on 'click' (fn this.selectScope 'global' dd.close)}}
>
{{t 'titles.global'}}
</dd.Interactive>
</dd.Checkmark>
{{#each this.sortedScopes as |scope|}}
<dd.Interactive {{on 'click' (fn this.selectScope scope.id dd.close)}}>
<dd.Checkmark
@selected={{eq @model.scope.id scope.id}}
{{on 'click' (fn this.selectScope scope.id dd.close)}}
>
{{scope.displayName}}
</dd.Interactive>
</dd.Checkmark>
{{/each}}
</Hds::Dropdown>