mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-05 04:16:31 +02:00
[UI][VAULT-44070] Hide billing metrics sidebar link from namespaces other than root and admin (#14186) (#14229)
* Only show dashboard if user is in hvd namespace and root namespace * Add tests.. * Fix test names Co-authored-by: Kianna <30884335+kiannaquach@users.noreply.github.com>
This commit is contained in:
parent
cb9e2e49bb
commit
eec654c6d6
@ -59,7 +59,7 @@
|
||||
data-test-sidebar-nav-link="Client count"
|
||||
/>
|
||||
{{/if}}
|
||||
{{#if this.version.hasConsumptionBilling}}
|
||||
{{#if (and this.version.hasConsumptionBilling (or this.isRootNamespace this.namespace.inHvdAdminNamespace))}}
|
||||
<Nav.Link
|
||||
@route="vault.cluster.billing.overview"
|
||||
@text="Billing metrics"
|
||||
|
||||
@ -148,6 +148,31 @@ module('Integration | Component | sidebar-nav-cluster', function (hooks) {
|
||||
assert.dom(GENERAL.navHeading('Client Counts')).doesNotExist('Client count link is hidden.');
|
||||
});
|
||||
|
||||
test('it should show billing metrics link when in root namespace and Consumption Billing feature is enabled', async function (assert) {
|
||||
stubFeaturesAndPermissions(this.owner, true, false, ['Consumption Billing']);
|
||||
const namespace = this.owner.lookup('service:namespace');
|
||||
namespace.setNamespace('root');
|
||||
await renderComponent();
|
||||
assert.dom(GENERAL.navLink('Billing metrics')).exists('Billing metrics link is visible.');
|
||||
});
|
||||
|
||||
test('it should show billing metrics link when in HVD admin namespace and Consumption Billing feature is enabled', async function (assert) {
|
||||
stubFeaturesAndPermissions(this.owner, true, false, ['Consumption Billing']);
|
||||
this.flags.featureFlags = ['VAULT_CLOUD_ADMIN_NAMESPACE'];
|
||||
const namespace = this.owner.lookup('service:namespace');
|
||||
namespace.setNamespace('admin');
|
||||
await renderComponent();
|
||||
assert.dom(GENERAL.navLink('Billing metrics')).exists('Billing metrics link is visible.');
|
||||
});
|
||||
|
||||
test('it should hide billing metrics link when in namespace other than root or admin when Consumption Billing feature is enabled', async function (assert) {
|
||||
stubFeaturesAndPermissions(this.owner, true, false, ['Consumption Billing']);
|
||||
const namespace = this.owner.lookup('service:namespace');
|
||||
namespace.setNamespace('namespace-1');
|
||||
await renderComponent();
|
||||
assert.dom(GENERAL.navLink('Billing metrics')).doesNotExist('Billing metrics link is hidden.');
|
||||
});
|
||||
|
||||
test('it does NOT show Secrets Recovery when user is in HVD admin namespace', async function (assert) {
|
||||
this.flags.featureFlags = ['VAULT_CLOUD_ADMIN_NAMESPACE'];
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user