diff --git a/ui/admin/app/routes/scopes/scope/targets.js b/ui/admin/app/routes/scopes/scope/targets.js index 1136d15ae..b9c41f5ca 100644 --- a/ui/admin/app/routes/scopes/scope/targets.js +++ b/ui/admin/app/routes/scopes/scope/targets.js @@ -152,8 +152,8 @@ export default class ScopesScopeTargetsRoute extends Route { @notifySuccess('notifications.delete-success') async deleteAlias(alias) { await alias.destroyRecord(); - await this.router.replaceWith('scopes.scope.targets.target'); - this.router.refresh(); + this.router.refresh('scopes.scope.targets.target'); + await this.router.transitionTo('scopes.scope.targets.target'); } /** diff --git a/ui/admin/app/routes/scopes/scope/targets/target/index.js b/ui/admin/app/routes/scopes/scope/targets/target/index.js index 445cb905e..82eaf9151 100644 --- a/ui/admin/app/routes/scopes/scope/targets/target/index.js +++ b/ui/admin/app/routes/scopes/scope/targets/target/index.js @@ -14,12 +14,15 @@ export default class ScopesScopeTargetsTargetIndexRoute extends Route { // =methods /** - * Adds storage bucket name to the context. + * Adds storage bucket name, globalScope and aliases model to the context. * @param {Controller} controller * @param {TargetModel} target */ async setupController(controller, target) { super.setupController(...arguments); + const globalScope = await this.store.peekRecord('scope', 'global'); + controller.set('globalScope', globalScope); + if (target?.storage_bucket_id) { const { storage_bucket_id } = target; const storageBucket = await this.store.findRecord( diff --git a/ui/admin/app/styles/app.scss b/ui/admin/app/styles/app.scss index c168c3260..e27a024c4 100644 --- a/ui/admin/app/styles/app.scss +++ b/ui/admin/app/styles/app.scss @@ -625,7 +625,6 @@ .target-sidebar-aliases { margin-bottom: 3rem; - width: 300px; .description { color: var(--token-form-helper-text-color); diff --git a/ui/admin/app/templates/scopes/scope/targets/target/index.hbs b/ui/admin/app/templates/scopes/scope/targets/target/index.hbs index cb0260846..f54ed9115 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/index.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/index.hbs @@ -30,36 +30,22 @@ @cancel={{route-action 'cancel' @model}} /> - -
-

{{t 'resources.alias.title_plural'}}

-

- {{t 'resources.alias.form.sidebar.help'}} -

- {{#if @model.aliases}} + {{#if @model.aliases}} +
+

{{t 'resources.alias.title_plural'}}

+

+ {{t 'resources.alias.form.sidebar.help'}} +

{{#each this.aliases as |alias|}} - - - - - - {{/each}} @@ -91,36 +77,32 @@ @icon='at-sign' @color='boundary' @text={{alias.value}} + @route='scopes.scope.targets.target.manage-alias' + @model={{alias.id}} /> - - - - - - {{/each}} {{/if}} - {{else}} - +
+ {{else}} + {{#if (can 'create model' this.globalScope collection='aliases')}} +
+

{{t 'resources.alias.title_plural'}}

+

+ {{t 'resources.alias.form.sidebar.help'}} +

+ + +
{{/if}} -
+ {{/if}}
{{#if (and @model.isSSH (feature-flag 'ssh-session-recording'))}}

{{t 'resources.target.form.sidebar.label'}}

diff --git a/ui/admin/app/templates/scopes/scope/targets/target/manage-alias.hbs b/ui/admin/app/templates/scopes/scope/targets/target/manage-alias.hbs index 51fe7b28c..08fc755aa 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/manage-alias.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/manage-alias.hbs @@ -45,7 +45,6 @@ /> {{/if}} {{#if perms.canDelete}} - item !== 'create', + ); + await visit(urls.tcpTarget); + + assert.dom(ALIASES_SIDEBAR).doesNotExist(); + assert.dom(LINK_TO_NEW_ALIAS).doesNotExist(); + assert.dom(ALIASES_SIDEBAR_LIST).doesNotExist(); + }); + test('can click `view more aliases` to see the remaining associated aliases if there are more than 3', async function (assert) { instances.tcpTarget.update({ aliases: [ @@ -247,19 +260,4 @@ module('Acceptance | targets | read', function (hooks) { await click(VIEW_MORE_BTN); assert.dom(FLYOUT_COMPONENT).exists(); }); - - test('users can click on associated alias card on the right sidebar', async function (assert) { - instances.tcpTarget.update({ - aliases: [{ id: aliasResource.id, value: aliasResource.value }], - }); - await visit(urls.tcpTarget); - - assert.dom(ALIASES_SIDEBAR_LIST).exists(); - await click(DROPDOWN_BUTTON_SELECTOR); - - assert.dom(DROPDOWN_ITEM_SELECTOR).exists(); - assert.dom(DROPDOWN_ITEM_SELECTOR).hasText('Manage'); - await click(DROPDOWN_ITEM_SELECTOR); - assert.strictEqual(currentURL(), urls.alias); - }); });