vault/ui/app/components/dashboard/vault-version-title.js
Kianna 8835514e76
UI: [VAULT-12979] Dashboard Landing Page (#21057)
Co-authored-by: Chelsea Shaw <cshaw@hashicorp.com>
Co-authored-by: clairebontempo@gmail.com <clairebontempo@gmail.com>
Co-authored-by: Angel Garbarino <angel@hashicorp.com>
2023-08-24 13:30:45 -07:00

35 lines
866 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
/**
* @module DashboardVaultVersionTitle
* DashboardVaultVersionTitle component are use to display the vault version title and the badges
*
* @example
* ```js
* <Dashboard::VaultVersionTitle />
* ```
*/
export default class DashboardVaultVersionTitle extends Component {
@service version;
@service namespace;
get versionHeader() {
return this.version.isEnterprise
? `Vault v${this.version.version.slice(0, this.version.version.indexOf('+'))}`
: `Vault v${this.version.version}`;
}
get namespaceDisplay() {
if (this.namespace.inRootNamespace) return 'root';
const parts = this.namespace.path?.split('/');
return parts[parts.length - 1];
}
}