diff --git a/addons/api/mirage/scenarios/ipc.js b/addons/api/mirage/scenarios/ipc.js index 6366fbb6c..652459391 100644 --- a/addons/api/mirage/scenarios/ipc.js +++ b/addons/api/mirage/scenarios/ipc.js @@ -199,6 +199,18 @@ export default function initializeMockIPC(server, config) { getDesktopVersion() { return { desktopVersion: '1.0.0' }; } + + getLogLevel() { + return 'debug'; + } + + setLogLevel() { + return 'warn'; + } + + getLogPath() { + return '~/.config/Boundary/logs/desktop-client.log'; + } } /** diff --git a/addons/core/translations/en-us.yaml b/addons/core/translations/en-us.yaml index 43d9d4d60..4d642b5ef 100644 --- a/addons/core/translations/en-us.yaml +++ b/addons/core/translations/en-us.yaml @@ -111,6 +111,13 @@ settings: cache-daemon: Cache Daemon client: Client color-theme: Color Theme + provider: Provider + hcp: HashiCorp Cloud Platform + self-managed: Self-managed + connected: Connected + server: + title: Server + description: Boundary connects you to targets using this server managed by your organization. logs: title: Logs logging-level: Logging level diff --git a/ui/desktop/app/components/settings-card/index.hbs b/ui/desktop/app/components/settings-card/index.hbs index 93e501885..80d79e3d4 100644 --- a/ui/desktop/app/components/settings-card/index.hbs +++ b/ui/desktop/app/components/settings-card/index.hbs @@ -17,7 +17,6 @@ {{#if (has-block 'action')}}
- {{! this will contain buttons }} {{yield to='action'}}
{{/if}} @@ -25,7 +24,7 @@ {{#if @description}} - + {{@description}} {{/if}} diff --git a/ui/desktop/app/components/settings-card/server/index.hbs b/ui/desktop/app/components/settings-card/server/index.hbs new file mode 100644 index 000000000..cee93da88 --- /dev/null +++ b/ui/desktop/app/components/settings-card/server/index.hbs @@ -0,0 +1,41 @@ +{{! + Copyright (c) HashiCorp, Inc. + SPDX-License-Identifier: BUSL-1.1 +}} + + + <:state> + {{#if @model.serverInformation}} + + {{/if}} + + <:body> +
+ + {{t 'settings.provider'}} + + + {{this.providerName}} + +
+
+ + {{t 'form.cluster-url.label'}} + + +
+ + +
\ No newline at end of file diff --git a/ui/desktop/app/components/settings-card/server/index.js b/ui/desktop/app/components/settings-card/server/index.js new file mode 100644 index 000000000..07187a372 --- /dev/null +++ b/ui/desktop/app/components/settings-card/server/index.js @@ -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'); + } + } +} diff --git a/ui/desktop/app/routes/scopes/scope/projects/settings/index.js b/ui/desktop/app/routes/scopes/scope/projects/settings/index.js index 82c26d5dd..09fb66aae 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/settings/index.js +++ b/ui/desktop/app/routes/scopes/scope/projects/settings/index.js @@ -10,6 +10,7 @@ export default class ScopesScopeProjectsSettingsIndexRoute extends Route { // =services @service ipc; @service session; + @service clusterUrl; // =methods async model() { @@ -48,6 +49,7 @@ export default class ScopesScopeProjectsSettingsIndexRoute extends Route { const logLevel = await this.ipc.invoke('getLogLevel'); const logPath = await this.ipc.invoke('getLogPath'); + const serverInformation = this.clusterUrl.rendererClusterUrl; return { cacheDaemonErrors, @@ -56,6 +58,7 @@ export default class ScopesScopeProjectsSettingsIndexRoute extends Route { formattedDesktopVersion, logLevel, logPath, + serverInformation, }; } } diff --git a/ui/desktop/app/styles/app.scss b/ui/desktop/app/styles/app.scss index 4b44e9f91..f052b25ae 100644 --- a/ui/desktop/app/styles/app.scss +++ b/ui/desktop/app/styles/app.scss @@ -674,6 +674,10 @@ $chevron-down: url("data:image/svg+xml;utf-8, { + const windowOrigin = 'hashicorp.cloud'; + const clusterUrl = test.owner.lookup('service:clusterUrl'); + clusterUrl.rendererClusterUrl = windowOrigin; + }; + + setDefaultClusterUrl(this); + + test('it displays HCP cluster url in server information section', async function (assert) { + await render(hbs``); + assert.dom(SERVER_NAME).hasText('HashiCorp Cloud Platform'); + assert.dom(SERVER_URL).hasText('hashicorp.cloud'); + }); + + test('it displays non HCP cluster url in server information section', async function (assert) { + this.owner.lookup('service:clusterUrl').rendererClusterUrl = + 'everythingelse'; + await render(hbs``); + assert.dom(SERVER_NAME).hasText('Self-Managed'); + assert.dom(SERVER_URL).hasText('everythingelse'); + }); +});