consul/ui/packages/consul-ui/app/components/hcp-nav-item/index.js

22 lines
684 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
/**
* If the user has accessed consul from HCP managed consul, we do NOT want to display the
* "HCP Consul Central↗" link in the nav bar. As we're already displaying a BackLink to HCP.
*/
export default class HcpLinkItemComponent extends Component {
@service env;
get shouldShowBackToHcpItem() {
const isConsulHcpUrlDefined = !!this.env.var('CONSUL_HCP_URL');
const isConsulHcpEnabled = !!this.env.var('CONSUL_HCP_ENABLED');
return isConsulHcpEnabled && isConsulHcpUrlDefined;
}
}