diff --git a/ui/admin/app/routes/scopes/scope/index.js b/ui/admin/app/routes/scopes/scope/index.js index b2ddf3f21..30816d538 100644 --- a/ui/admin/app/routes/scopes/scope/index.js +++ b/ui/admin/app/routes/scopes/scope/index.js @@ -36,9 +36,9 @@ export default class ScopesScopeIndexRoute extends Route { return this.router.transitionTo('onboarding'); } - // If this a project scope, there are no further sub scopes, so show edit + // If this a project scope, there are no further sub scopes, so show targets if (model.isProject) { - return this.router.transitionTo('scopes.scope.edit'); + return this.router.transitionTo('scopes.scope.targets'); } // For all other scope types (global and org), show sub scopes diff --git a/ui/admin/app/templates/scopes/scope.hbs b/ui/admin/app/templates/scopes/scope.hbs index 4942104e9..66a2341a2 100644 --- a/ui/admin/app/templates/scopes/scope.hbs +++ b/ui/admin/app/templates/scopes/scope.hbs @@ -92,20 +92,19 @@ {{/if}} {{#if @model.isOrg}} - {{t - 'titles.scope-level' - scope=(t 'resources.org.title') - }} - {{#if this.session.data.authenticated.isGlobal}} - {{/if}} + {{t + 'titles.scope-level' + scope=(t 'resources.org.title') + }} + {{t 'titles.project-actions'}} - {{#if (can 'navigate model' @model collection='sessions')}} - - {{/if}} - {{#if (can 'navigate model' @model collection='targets')}} {{/if}} + {{#if (can 'navigate model' @model collection='sessions')}} + + {{/if}} + {{t 'titles.scope-iam' scope=(t 'resources.project.title') diff --git a/ui/admin/tests/acceptance/roles/org-scope-test.js b/ui/admin/tests/acceptance/roles/org-scope-test.js index 99710f1eb..91212d296 100644 --- a/ui/admin/tests/acceptance/roles/org-scope-test.js +++ b/ui/admin/tests/acceptance/roles/org-scope-test.js @@ -102,7 +102,7 @@ module('Acceptance | roles | org-scope', function (hooks) { await click(commonSelectors.HREF(urls.roleScopes)); await click(commonSelectors.TABLE_RESOURCE_LINK(scopeUrl)); - assert.strictEqual(currentURL(), `${scopeUrl}/edit`); + assert.strictEqual(currentURL(), `${scopeUrl}/targets`); }); test('user can navigate to parent scope from role grant scopes', async function (assert) { diff --git a/ui/admin/tests/acceptance/scopes-test.js b/ui/admin/tests/acceptance/scopes-test.js index e0897ea30..6592f0f8f 100644 --- a/ui/admin/tests/acceptance/scopes-test.js +++ b/ui/admin/tests/acceptance/scopes-test.js @@ -47,8 +47,8 @@ module('Acceptance | scopes', function (hooks) { projectScope: null, newProjectScope: null, project2Scope: null, - projectScopeEdit: null, - project2ScopeEdit: null, + projectTargets: null, + project2Targets: null, }; hooks.beforeEach(async function () { @@ -82,8 +82,8 @@ module('Acceptance | scopes', function (hooks) { urls.newProjectScope = `${urls.orgScopes}/new`; urls.projectScope = `/scopes/${instances.scopes.project.id}`; urls.project2Scope = `/scopes/${instances.scopes.project2.id}`; - urls.projectScopeEdit = `${urls.projectScope}/edit`; - urls.project2ScopeEdit = `${urls.project2Scope}/edit`; + urls.projectTargets = `${urls.projectScope}/targets`; + urls.project2Targets = `${urls.project2Scope}/targets`; // Generate resource counter getScopeCount = (type) => this.server.schema.scopes.where({ type }).length; await authenticateSession({ isGlobal: true, username: 'admin' }); @@ -135,12 +135,12 @@ module('Acceptance | scopes', function (hooks) { await visit(urls.projectScope); await a11yAudit(); - assert.strictEqual(currentURL(), urls.projectScopeEdit); + assert.strictEqual(currentURL(), urls.projectTargets); await click(SCOPES_DROPDOWN_BTN); await click(SCOPES_DROPDOWN_SELECTOR(urls.project2Scope)); - assert.strictEqual(currentURL(), urls.project2ScopeEdit); + assert.strictEqual(currentURL(), urls.project2Targets); }); test('can create new org scopes', async function (assert) { diff --git a/ui/admin/tests/acceptance/targets/read-test.js b/ui/admin/tests/acceptance/targets/read-test.js index 7f3dddeb4..4b0386b90 100644 --- a/ui/admin/tests/acceptance/targets/read-test.js +++ b/ui/admin/tests/acceptance/targets/read-test.js @@ -116,11 +116,10 @@ module('Acceptance | targets | read', function (hooks) { test('cannot navigate to an ssh target form without proper authorization', async function (assert) { featuresService.enable('ssh-target'); - await visit(urls.projectScope); instances.sshTarget.authorized_actions = instances.sshTarget.authorized_actions.filter((item) => item !== 'read'); - await click(commonSelectors.HREF(urls.targets)); + await visit(urls.projectScope); assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.tcpTarget)).isVisible(); assert @@ -130,11 +129,10 @@ module('Acceptance | targets | read', function (hooks) { test('cannot navigate to a tcp target form without proper authorization', async function (assert) { featuresService.enable('ssh-target'); - await visit(urls.projectScope); instances.tcpTarget.authorized_actions = instances.tcpTarget.authorized_actions.filter((item) => item !== 'read'); - await click(commonSelectors.HREF(urls.targets)); + await visit(urls.projectScope); assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.sshTarget)).isVisible(); assert diff --git a/ui/admin/tests/unit/controllers/scopes/scope/targets/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/targets/index-test.js index 2a8100d39..3fcf48a44 100644 --- a/ui/admin/tests/unit/controllers/scopes/scope/targets/index-test.js +++ b/ui/admin/tests/unit/controllers/scopes/scope/targets/index-test.js @@ -37,6 +37,7 @@ module('Unit | Controller | scopes/scope/targets/index', function (hooks) { }; const urls = { + orgScope: null, projectScope: null, targets: null, target: null, @@ -71,6 +72,7 @@ module('Unit | Controller | scopes/scope/targets/index', function (hooks) { scope: instances.scopes.global, }); + urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`; urls.projectScope = `/scopes/${instances.scopes.project.id}`; urls.targets = `${urls.projectScope}/targets`; urls.target = `${urls.targets}/${instances.target.id}`; @@ -164,7 +166,7 @@ module('Unit | Controller | scopes/scope/targets/index', function (hooks) { }); test('delete action destroys specified model', async function (assert) { - await visit(urls.projectScope); + await visit(urls.orgScope); const target = await store.findRecord('target', instances.target.id); const targetCount = getTargetCount();