mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-22 15:11:07 +02:00
* update namespace service to include admin namespace check * add test * whoops, copy pasta forgot to update assertion * make comment clearer * delete space
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import Component from '@glimmer/component';
|
|
import { service } from '@ember/service';
|
|
|
|
import NamespaceService from 'vault/services/namespace';
|
|
|
|
export type Args = {
|
|
isRootNamespace: boolean;
|
|
replication: unknown;
|
|
secretsEngines: unknown;
|
|
vaultConfiguration: unknown;
|
|
version: { isEnterprise: boolean };
|
|
};
|
|
|
|
export default class OverviewComponent extends Component<Args> {
|
|
@service declare readonly namespace: NamespaceService;
|
|
|
|
/**
|
|
* the client count card should show in the following conditions
|
|
* Self Managed clusters that are running enterprise and showing the `root` namespace
|
|
* Managed clusters that are running enterprise and show the `admin` namespace
|
|
*/
|
|
// for self managed clusters, this is the `root` namespace
|
|
// for HVD clusters, this is the `admin` namespace
|
|
get shouldShowClientCount() {
|
|
const { version, isRootNamespace } = this.args;
|
|
const { namespace } = this;
|
|
|
|
// don't show client count if this isn't an enterprise cluster
|
|
if (!version.isEnterprise) return false;
|
|
|
|
// HVD clusters
|
|
if (namespace.inHvdAdminNamespace) return true;
|
|
|
|
// SM clusters
|
|
if (isRootNamespace) return true;
|
|
|
|
return false;
|
|
}
|
|
}
|