UI: hide client count nav link when chrooted listener (#28346)

This commit is contained in:
Chelsea Shaw
2024-09-11 08:29:33 -05:00
committed by GitHub
parent 855743fef0
commit abdeda43ca
3 changed files with 35 additions and 3 deletions

View File

@@ -53,7 +53,7 @@
{{#if
(or
(and this.isRootNamespace (has-permission "status" routeParams=(array "replication" "raft" "license" "seal")))
(has-permission "clients" routeParams="activity")
(and (has-permission "clients" routeParams="activity") (not this.hasChrootNamespace))
)
}}
<Nav.Title data-test-sidebar-nav-heading="Monitoring">Monitoring</Nav.Title>
@@ -81,7 +81,9 @@
data-test-sidebar-nav-link="Raft Storage"
/>
{{/if}}
{{#if (and (has-permission "clients" routeParams="activity") (not this.cluster.dr.isSecondary))}}
{{#if
(and (has-permission "clients" routeParams="activity") (not this.cluster.dr.isSecondary) (not this.hasChrootNamespace))
}}
<Nav.Link
@route="vault.cluster.clients"
@text="Client Count"

View File

@@ -17,8 +17,12 @@ export default class SidebarNavClusterComponent extends Component {
return this.currentCluster.cluster;
}
get hasChrootNamespace() {
return this.cluster?.hasChrootNamespace;
}
get isRootNamespace() {
// should only return true if we're in the true root namespace
return this.namespace.inRootNamespace && !this.cluster?.hasChrootNamespace;
return this.namespace.inRootNamespace && !this.hasChrootNamespace;
}
}

View File

@@ -112,6 +112,32 @@ module('Integration | Component | sidebar-nav-cluster', function (hooks) {
});
});
test('it should hide client counts link in chroot namespace', async function (assert) {
this.owner.lookup('service:permissions').setPaths({
data: {
chroot_namespace: 'admin',
root: true,
},
});
this.owner.lookup('service:currentCluster').setCluster({
id: 'foo',
anyReplicationEnabled: true,
usingRaft: true,
hasChrootNamespace: true,
});
const links = ['Client Counts', 'Replication', 'Raft Storage', 'License', 'Seal Vault'];
await renderComponent();
assert
.dom('[data-test-sidebar-nav-heading="Monitoring"]')
.doesNotExist('Monitoring heading is hidden in chroot namespace');
links.forEach((link) => {
assert
.dom(`[data-test-sidebar-nav-link="${link}"]`)
.doesNotExist(`${link} is hidden in chroot namespace`);
});
});
test('it should render badge for promotional links on managed clusters', async function (assert) {
this.owner.lookup('service:flags').featureFlags = ['VAULT_CLOUD_ADMIN_NAMESPACE'];
const promotionalLinks = ['Secrets Sync'];