mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-09 00:33:28 -04:00
[UI][VAULT-44070] Hide billing metrics sidebar link from namespaces other than root and admin (#14186) (#14381) (#14394)
* 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
854eef5135
commit
ef1f6faa52
2 changed files with 26 additions and 1 deletions
|
|
@ -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…
Reference in a new issue