mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 02:02:43 +00:00
UI: hide client count nav link when chrooted listener (#28346)
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'];
|
||||
|
||||
Reference in New Issue
Block a user