mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 02:02:43 +00:00
UI: Make resultant-acl banner dismissable (#25106)
This commit is contained in:
3
changelog/25106.txt
Normal file
3
changelog/25106.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
```release-note:bug
|
||||||
|
ui: Allows users to dismiss the resultant-acl banner.
|
||||||
|
```
|
||||||
@@ -3,23 +3,31 @@
|
|||||||
SPDX-License-Identifier: BUSL-1.1
|
SPDX-License-Identifier: BUSL-1.1
|
||||||
~}}
|
~}}
|
||||||
|
|
||||||
<Hds::Alert @type="inline" @color="critical" data-test-resultant-acl-banner as |A|>
|
{{#unless this.hideBanner}}
|
||||||
<A.Title>Resultant ACL check failed</A.Title>
|
<Hds::Alert
|
||||||
<A.Description>
|
@type="inline"
|
||||||
{{if
|
@color="critical"
|
||||||
@isEnterprise
|
@onDismiss={{fn (mut this.hideBanner) true}}
|
||||||
"You do not have access to resources in this namespace."
|
data-test-resultant-acl-banner
|
||||||
"Links might be shown that you don't have access to. Contact your administrator to update your policy."
|
as |A|
|
||||||
}}
|
>
|
||||||
</A.Description>
|
<A.Title>Resultant ACL check failed</A.Title>
|
||||||
{{#if @isEnterprise}}
|
<A.Description>
|
||||||
<A.Link::Standalone
|
{{if
|
||||||
@icon="arrow-right"
|
@isEnterprise
|
||||||
@iconPosition="trailing"
|
"You do not have access to resources in this namespace."
|
||||||
@text={{concat "Log into " this.ns " namespace"}}
|
"Links might be shown that you don't have access to. Contact your administrator to update your policy."
|
||||||
@route="vault.cluster.logout"
|
}}
|
||||||
@query={{this.queryParams}}
|
</A.Description>
|
||||||
data-test-resultant-acl-reauthenticate
|
{{#if @isEnterprise}}
|
||||||
/>
|
<A.Link::Standalone
|
||||||
{{/if}}
|
@icon="arrow-right"
|
||||||
</Hds::Alert>
|
@iconPosition="trailing"
|
||||||
|
@text={{concat "Log into " this.ns " namespace"}}
|
||||||
|
@route="vault.cluster.logout"
|
||||||
|
@query={{this.queryParams}}
|
||||||
|
data-test-resultant-acl-reauthenticate
|
||||||
|
/>
|
||||||
|
{{/if}}
|
||||||
|
</Hds::Alert>
|
||||||
|
{{/unless}}
|
||||||
@@ -5,10 +5,12 @@
|
|||||||
|
|
||||||
import { service } from '@ember/service';
|
import { service } from '@ember/service';
|
||||||
import Component from '@glimmer/component';
|
import Component from '@glimmer/component';
|
||||||
|
import { tracked } from '@glimmer/tracking';
|
||||||
|
|
||||||
export default class ResultantAclBannerComponent extends Component {
|
export default class ResultantAclBannerComponent extends Component {
|
||||||
@service namespace;
|
@service namespace;
|
||||||
@service router;
|
@service router;
|
||||||
|
@tracked hideBanner = false;
|
||||||
|
|
||||||
get ns() {
|
get ns() {
|
||||||
return this.namespace.path || 'root';
|
return this.namespace.path || 'root';
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { module, test } from 'qunit';
|
import { module, test } from 'qunit';
|
||||||
import { setupRenderingTest } from 'vault/tests/helpers';
|
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';
|
import { hbs } from 'ember-cli-htmlbars';
|
||||||
|
|
||||||
module('Integration | Component | resultant-acl-banner', function (hooks) {
|
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]')
|
.dom('[data-test-resultant-acl-reauthenticate]')
|
||||||
.hasText('Log into root namespace', 'Shows reauth link with default namespace');
|
.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`<ResultantAclBanner />`);
|
||||||
|
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');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user