diff --git a/changelog/25106.txt b/changelog/25106.txt new file mode 100644 index 000000000000..d861b1a98109 --- /dev/null +++ b/changelog/25106.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: Allows users to dismiss the resultant-acl banner. +``` \ No newline at end of file diff --git a/ui/app/components/resultant-acl-banner.hbs b/ui/app/components/resultant-acl-banner.hbs index 81a6833e4aa8..5c5b52b63e36 100644 --- a/ui/app/components/resultant-acl-banner.hbs +++ b/ui/app/components/resultant-acl-banner.hbs @@ -3,23 +3,31 @@ SPDX-License-Identifier: BUSL-1.1 ~}} - - Resultant ACL check failed - - {{if - @isEnterprise - "You do not have access to resources in this namespace." - "Links might be shown that you don't have access to. Contact your administrator to update your policy." - }} - - {{#if @isEnterprise}} - - {{/if}} - \ No newline at end of file +{{#unless this.hideBanner}} + + Resultant ACL check failed + + {{if + @isEnterprise + "You do not have access to resources in this namespace." + "Links might be shown that you don't have access to. Contact your administrator to update your policy." + }} + + {{#if @isEnterprise}} + + {{/if}} + +{{/unless}} \ No newline at end of file diff --git a/ui/app/components/resultant-acl-banner.js b/ui/app/components/resultant-acl-banner.js index c2a4213d70c4..793b0f973a46 100644 --- a/ui/app/components/resultant-acl-banner.js +++ b/ui/app/components/resultant-acl-banner.js @@ -5,10 +5,12 @@ import { service } from '@ember/service'; import Component from '@glimmer/component'; +import { tracked } from '@glimmer/tracking'; export default class ResultantAclBannerComponent extends Component { @service namespace; @service router; + @tracked hideBanner = false; get ns() { return this.namespace.path || 'root'; diff --git a/ui/tests/integration/components/resultant-acl-banner-test.js b/ui/tests/integration/components/resultant-acl-banner-test.js index 63905aa269f9..97de2c59bd37 100644 --- a/ui/tests/integration/components/resultant-acl-banner-test.js +++ b/ui/tests/integration/components/resultant-acl-banner-test.js @@ -5,7 +5,7 @@ import { module, test } from 'qunit'; import { setupRenderingTest } from 'vault/tests/helpers'; -import { render } from '@ember/test-helpers'; +import { click, render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; module('Integration | Component | resultant-acl-banner', function (hooks) { @@ -44,4 +44,11 @@ module('Integration | Component | resultant-acl-banner', function (hooks) { .dom('[data-test-resultant-acl-reauthenticate]') .hasText('Log into root namespace', 'Shows reauth link with default namespace'); }); + + test('it goes away when dismiss button clicked', async function (assert) { + await render(hbs``); + assert.dom('[data-test-resultant-acl-banner]').exists('Shows banner initially'); + await click('.hds-dismiss-button'); + assert.dom('[data-test-resultant-acl-banner]').doesNotExist('Hides banner after dismiss'); + }); });