[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:
Vault Automation 2026-04-23 13:23:57 -04:00 committed by GitHub
parent cb9e2e49bb
commit eec654c6d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 1 deletions

View File

@ -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"

View File

@ -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'];