{{#if @model}}
-
-
-
- {{#let
- (resource-filter 'scopes.scope.workers.index' 'tags')
- as |filter|
- }}
- {{#if filter.allowedValues}}
-
- {{#each-in
- (group-by 'key' filter.allowedValues)
- as |key tags|
- }}
-
-
-
-
-
-
- {{/each-in}}
-
- {{/if}}
- {{/let}}
- {{#if
- (has-resource-filter-selections
- 'scopes.scope.workers.index' 'tags'
- )
- }}
-
- {{/if}}
-
-
-
-
-
-
-
+
+
+ {{#each-in (group-by 'key' itemOptions) as |key groupItems|}}
+
+
+ {{key}}
+
+ {{#each groupItems as |item|}}
+
+ {{item.name}}
+
+ {{/each}}
+ {{/each-in}}
+
+
+
+
`[data-test-worker-tags-flyout-button="${workerId}"]`;
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/groups/group/add-members-test.js b/ui/admin/tests/unit/controllers/scopes/scope/groups/group/add-members-test.js
index 0784b5ec4..f19225749 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/groups/group/add-members-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/groups/group/add-members-test.js
@@ -31,7 +31,9 @@ module(
globalScope: null,
addMembers: null,
};
-
+ const model = {
+ scopes: [{ id: 'global', type: 'global' }],
+ };
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
@@ -82,33 +84,19 @@ module(
assert.deepEqual(group.members, [user]);
});
- test('callFilterBy action adds expected property values to route', async function (assert) {
- const route = this.owner.lookup(
- 'route:scopes/scope/groups/group/add-members',
- );
- await visit(urls.addMembers);
- const scope = await store.findRecord('scope', instances.scopes.global.id);
+ test('applyFilter action sets expected values correctly', async function (assert) {
+ controller.set('model', model);
+ const selectedItems = ['yes'];
+ controller.applyFilter('scopeIds', selectedItems);
- assert.notOk(route.scope);
-
- controller.callFilterBy('scope', [scope]);
-
- assert.deepEqual(route.scope, [scope]);
+ assert.deepEqual(controller.scopeIds, selectedItems);
});
- test('callClearAllFilters action removes all filter values from route', async function (assert) {
- const route = this.owner.lookup(
- 'route:scopes/scope/groups/group/add-members',
- );
- await visit(urls.addMembers);
- const scope = await store.findRecord('scope', instances.scopes.global.id);
- route.scope = [scope];
+ test('filters returns expected entries', function (assert) {
+ controller.set('model', model);
- assert.deepEqual(route.scope, [scope]);
-
- controller.callClearAllFilters();
-
- assert.deepEqual(route.scope, []);
+ assert.ok(controller.filters.allFilters);
+ assert.ok(controller.filters.selectedFilters);
});
},
);
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/roles/role/add-principals-test.js b/ui/admin/tests/unit/controllers/scopes/scope/roles/role/add-principals-test.js
index 2e7c23619..f17cb23bf 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/roles/role/add-principals-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/roles/role/add-principals-test.js
@@ -31,6 +31,9 @@ module(
const urls = {
addPrincipals: null,
};
+ const model = {
+ scopes: [{ id: 'global', type: 'global' }],
+ };
hooks.beforeEach(async function () {
await authenticateSession({});
@@ -98,33 +101,19 @@ module(
]);
});
- test('callFilterBy action adds expected property values to route', async function (assert) {
- const route = this.owner.lookup(
- 'route:scopes/scope/roles/role/add-principals',
- );
- await visit(urls.addPrincipals);
- const scope = await store.findRecord('scope', instances.scopes.global.id);
+ test('applyFilter action sets expected values correctly', async function (assert) {
+ controller.set('model', model);
+ const selectedItems = ['yes'];
+ controller.applyFilter('scopeIds', selectedItems);
- assert.notOk(route.scope);
-
- controller.callFilterBy('scope', [scope]);
-
- assert.deepEqual(route.scope, [scope]);
+ assert.deepEqual(controller.scopeIds, selectedItems);
});
- test('callClearAllFilters action removes all filter values from route', async function (assert) {
- const route = this.owner.lookup(
- 'route:scopes/scope/roles/role/add-principals',
- );
- await visit(urls.addPrincipals);
- const scope = await store.findRecord('scope', instances.scopes.global.id);
- route.scope = [scope];
+ test('filters returns expected entries', function (assert) {
+ controller.set('model', model);
- assert.deepEqual(route.scope, [scope]);
-
- controller.callClearAllFilters();
-
- assert.deepEqual(route.scope, []);
+ assert.ok(controller.filters.allFilters);
+ assert.ok(controller.filters.selectedFilters);
});
},
);
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/workers/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/workers/index-test.js
index 8c445a160..958e57e4c 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/workers/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/workers/index-test.js
@@ -32,6 +32,10 @@ module('Unit | Controller | scopes/scope/workers/index', function (hooks) {
workers: null,
};
+ const model = {
+ tags: [{ key: 'env', value: 'os', type: 'config' }],
+ };
+
hooks.beforeEach(async function () {
await authenticateSession({});
intl = this.owner.lookup('service:intl');
@@ -85,31 +89,20 @@ module('Unit | Controller | scopes/scope/workers/index', function (hooks) {
assert.strictEqual(getWorkerCount(), workerCount - 1);
});
- test('callFilterBy action adds expected property values to route', async function (assert) {
- const route = this.owner.lookup('route:scopes/scope/workers/index');
- await visit(urls.workers);
+ test('applyFilter action sets expected values correctly', async function (assert) {
+ controller.set('model', model);
const tag = { key: 'type', value: 'dev', type: 'config' };
+ // Encode the tag to base64
+ const encodedTag = window.btoa(JSON.stringify(tag));
+ controller.applyFilter('tags', [encodedTag]);
- assert.notOk(route.tags);
-
- controller.callFilterBy('tags', [tag]);
-
- assert.deepEqual(route.tags, [tag]);
+ assert.deepEqual(controller.tags, [encodedTag]);
});
- test('callClearAllFilters action removes all filter values from route', async function (assert) {
- const route = this.owner.lookup('route:scopes/scope/workers/index');
- await visit(urls.workers);
- const tag = { key: 'type', value: 'dev', type: 'config' };
- controller.callFilterBy('tags', [tag]);
-
- assert.deepEqual(route.tags, [
- { key: 'type', value: 'dev', type: 'config' },
- ]);
-
- controller.callClearAllFilters();
-
- assert.deepEqual(route.tags, []);
+ test('filters returns expected entries', function (assert) {
+ controller.set('model', model.tags);
+ assert.ok(controller.filters.allFilters);
+ assert.ok(controller.filters.selectedFilters);
});
test('messageDescription returns correct translation with list authorization', async function (assert) {
diff --git a/ui/desktop/app/controllers/scopes/scope/authenticate.js b/ui/desktop/app/controllers/scopes/scope/authenticate.js
index 9f437e7ac..db8caf354 100644
--- a/ui/desktop/app/controllers/scopes/scope/authenticate.js
+++ b/ui/desktop/app/controllers/scopes/scope/authenticate.js
@@ -5,13 +5,12 @@
import Controller from '@ember/controller';
import { service } from '@ember/service';
-
+import { action } from '@ember/object';
export default class ScopesScopeAuthenticateController extends Controller {
// =services
@service clusterUrl;
@service router;
-
// =attributes
/**
@@ -25,6 +24,13 @@ export default class ScopesScopeAuthenticateController extends Controller {
];
}
+ // =actions
+
+ @action
+ selectScope(scope, callback) {
+ this.router.transitionTo('scopes.scope.authenticate', scope);
+ callback();
+ }
/**
* Checks if the current route is the OIDC method authentication route.
* @type {boolean}
diff --git a/ui/desktop/app/templates/scopes/scope.hbs b/ui/desktop/app/templates/scopes/scope.hbs
index 378a038ce..b2a570455 100644
--- a/ui/desktop/app/templates/scopes/scope.hbs
+++ b/ui/desktop/app/templates/scopes/scope.hbs
@@ -7,22 +7,21 @@
{{#if this.session.isAuthenticated}}
-
- {{!-- {{#if this.session.data.authenticated.isGlobal}} --}}
-
+
+
+
{{t 'titles.global'}}
-
-
- {{!-- {{/if}} --}}
+
+
{{#each this.scopes.orgs as |scope|}}
-
+
{{scope.displayName}}
-
+
{{/each}}
-
+
{{/if}}
\ No newline at end of file
diff --git a/ui/desktop/app/templates/scopes/scope/-header-nav.hbs b/ui/desktop/app/templates/scopes/scope/-header-nav.hbs
deleted file mode 100644
index 92cbbcfc5..000000000
--- a/ui/desktop/app/templates/scopes/scope/-header-nav.hbs
+++ /dev/null
@@ -1,22 +0,0 @@
-{{!
- Copyright (c) HashiCorp, Inc.
- SPDX-License-Identifier: BUSL-1.1
-}}
-
-
- {{!-- {{#if this.session.data.authenticated.isGlobal}} --}}
-
- {{t 'titles.global'}}
-
-
- {{!-- {{/if}} --}}
- {{#each this.scopes.orgs as |scope|}}
-
- {{scope.displayName}}
-
- {{/each}}
-
\ No newline at end of file
diff --git a/ui/desktop/app/templates/scopes/scope/authenticate.hbs b/ui/desktop/app/templates/scopes/scope/authenticate.hbs
index c3b017c4d..53273be88 100644
--- a/ui/desktop/app/templates/scopes/scope/authenticate.hbs
+++ b/ui/desktop/app/templates/scopes/scope/authenticate.hbs
@@ -17,20 +17,23 @@
}}
>
-
-
+
+
+
{{t 'titles.global'}}
-
+
{{#each this.sortedScopes as |scope|}}
-
+
{{scope.displayName}}
-
+
{{/each}}
-
+
{{#each @model.authMethods as |authMethod|}}
diff --git a/ui/desktop/tests/acceptance/authentication-test.js b/ui/desktop/tests/acceptance/authentication-test.js
index 3f175756a..f9f453e6b 100644
--- a/ui/desktop/tests/acceptance/authentication-test.js
+++ b/ui/desktop/tests/acceptance/authentication-test.js
@@ -217,9 +217,9 @@ module('Acceptance | authentication', function (hooks) {
test('org scopes with no auth methods are not visible in dropdown', async function (assert) {
await visit(urls.authenticate.methods.global);
- await click('.rose-dropdown-trigger');
+ await click('.hds-dropdown-toggle-button');
- assert.dom('.rose-dropdown-content a').exists({ count: 2 });
+ assert.dom('.hds-dropdown-list-item button').exists({ count: 2 });
});
test('change cluster url is visible when no auth methods are available', async function (assert) {
diff --git a/ui/desktop/tests/acceptance/projects/sessions/index-test.js b/ui/desktop/tests/acceptance/projects/sessions/index-test.js
index 91bc008d6..4d9bb439c 100644
--- a/ui/desktop/tests/acceptance/projects/sessions/index-test.js
+++ b/ui/desktop/tests/acceptance/projects/sessions/index-test.js
@@ -399,7 +399,8 @@ module('Acceptance | projects | sessions | index', function (hooks) {
.isVisible();
// change scope in app header
- await click('.rose-header-nav .rose-dropdown a:nth-of-type(3)');
+ await click('.rose-header-nav .hds-dropdown-toggle-button');
+ await click('.rose-header-nav .hds-dropdown-list-item:nth-of-type(4) a');
// navigate to back sessions
await click(`[href="${urls.sessions2}"]`);
diff --git a/ui/desktop/tests/acceptance/projects/targets/index-test.js b/ui/desktop/tests/acceptance/projects/targets/index-test.js
index ac9f006ba..6c4ca1f6a 100644
--- a/ui/desktop/tests/acceptance/projects/targets/index-test.js
+++ b/ui/desktop/tests/acceptance/projects/targets/index-test.js
@@ -467,7 +467,9 @@ module('Acceptance | projects | targets | index', function (hooks) {
.dom(`[data-test-target-project-id="${instances.scopes.project2.id}"]`)
.exists();
- await click('.rose-header-nav .rose-dropdown a:nth-of-type(2)');
+ await click('.rose-header-nav .hds-dropdown-toggle-button');
+ await click('.rose-header-nav .hds-dropdown-list-item:nth-of-type(3) a');
+
assert
.dom(`[data-test-target-project-id="${instances.scopes.project.id}"]`)
.exists();
diff --git a/ui/desktop/tests/acceptance/scopes-test.js b/ui/desktop/tests/acceptance/scopes-test.js
index 0b7b67f42..caef320fd 100644
--- a/ui/desktop/tests/acceptance/scopes-test.js
+++ b/ui/desktop/tests/acceptance/scopes-test.js
@@ -228,13 +228,17 @@ module('Acceptance | scopes', function (hooks) {
);
await visit(urls.targets);
- await click('.rose-header-nav .rose-dropdown a:nth-of-type(2)');
+ await click('.rose-header-nav .hds-dropdown-toggle-button');
+ await click('.rose-header-nav .hds-dropdown-list-item:nth-of-type(3) a');
+
assert.strictEqual(currentURL(), urls.targets);
- await click('.rose-header-nav .rose-dropdown a:nth-of-type(3)');
+ await click('.rose-header-nav .hds-dropdown-list-item:nth-of-type(4) a');
+
assert.strictEqual(currentURL(), urls.org2Targets);
- await click('.rose-header-nav .rose-dropdown a:nth-of-type(1)');
+ await click('.rose-header-nav .hds-dropdown-list-item:nth-of-type(1) a');
+
assert.strictEqual(currentURL(), urls.globalTargets);
});