Icu 14781 add a section for server information (#2438)

This commit is contained in:
Dharini Jeeva authored and Zhihe Li committed 2024-09-24 11:58:25 -04:00
1 parent 63ec418cf0
commit de5defeab2
9 files changed
+136 -3

No files matched your search

@@ -17,7 +17,6 @@
{{#if (has-block 'action')}}
<div class='action'>
{{! this will contain buttons }}
{{yield to='action'}}
</div>
{{/if}}
@@ -25,7 +24,7 @@
</div>
{{#if @description}}
<Hds::Text::Body @tag='p'>
<Hds::Text::Body @tag='p' @color='faint'>
{{@description}}
</Hds::Text::Body>
{{/if}}
@@ -0,0 +1,41 @@
{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
}}
<SettingsCard
@header={{t 'settings.server.title'}}
@icon='cloud'
@description={{t 'settings.server.description'}}
>
<:state>
{{#if @model.serverInformation}}
<Hds::Badge
@text={{t 'settings.connected'}}
@icon='check'
@color='success'
/>
{{/if}}
</:state>
<:body>
<div>
<Hds::Text::Display>
{{t 'settings.provider'}}
</Hds::Text::Display>
<Hds::Text::Body @tag='p' @weight='medium' data-test-server-name>
{{this.providerName}}
</Hds::Text::Body>
</div>
<div class='large-column'>
<Hds::Text::Display>
{{t 'form.cluster-url.label'}}
</Hds::Text::Display>
<Hds::Copy::Snippet
data-test-server-url
@textToCopy={{@model.serverInformation}}
@isFullWidth={{true}}
/>
</div>
</:body>
</SettingsCard>
@@ -0,0 +1,26 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
export default class SettingsCardServerComponent extends Component {
// =services
@service intl;
// =attributes
/**
* Returns the provider name for HCP and generic name for non HCP servers
* @type {string}
*/
get providerName() {
const regex = /boundary\.(hashicorp|hcp)/;
if (this.args.model.serverInformation?.match(regex)) {
return this.intl.t('settings.hcp');
} else {
return this.intl.t('settings.self-managed');
}
}
}