diff --git a/addons/api/addon/models/session.js b/addons/api/addon/models/session.js index 696da71fa..6498634fc 100644 --- a/addons/api/addon/models/session.js +++ b/addons/api/addon/models/session.js @@ -110,6 +110,7 @@ export default class SessionModel extends GeneratedSessionModel { @tracked started_desktop_client; @tracked proxy_address; @tracked proxy_port; + @tracked host; credentials = A(); @equal('status', STATUS_SESSION_ACTIVE) isActive; @@ -159,6 +160,14 @@ export default class SessionModel extends GeneratedSessionModel { this.credentials.pushObject(new SessionCredential(cred)); } + /** + * Adds associated host to session if host present + * @param {HostModel} host + */ + addHost(host) { + this.host = host; + } + /** * Cancels the session via the `cancel` method. * See serializer and adapter for more information. diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 40ea5c3f8..faa7655eb 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -253,6 +253,7 @@ host: title_plural: Hosts no_name_title: Unnamed Host description: A host is a resource that may be accessed by a Boundary target. + details: Host Details messages: welcome: title: Welcome to Hosts diff --git a/addons/rose/app/styles/rose/components/metadata-list/_index.scss b/addons/rose/app/styles/rose/components/metadata-list/_index.scss index ba876da5e..82273979c 100644 --- a/addons/rose/app/styles/rose/components/metadata-list/_index.scss +++ b/addons/rose/app/styles/rose/components/metadata-list/_index.scss @@ -17,6 +17,6 @@ .rose-metadata-list-item { display: flex; align-items: center; - column-gap: 0.3rem; + column-gap: 0.5rem; } } diff --git a/ui/desktop/app/routes/scopes/scope/projects/targets/target.js b/ui/desktop/app/routes/scopes/scope/projects/targets/target.js index 19eeded64..534a845ec 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/targets/target.js +++ b/ui/desktop/app/routes/scopes/scope/projects/targets/target.js @@ -115,6 +115,10 @@ export default class ScopesScopeProjectsTargetsTargetRoute extends Route { if (credentials) { credentials.forEach((cred) => session.addCredential(cred)); } + if (session.host_id) { + const host = await this.store.findRecord('host', session.host_id); + session.addHost(host); + } await this.router.transitionTo( 'scopes.scope.projects.sessions.session', diff --git a/ui/desktop/app/styles/app.scss b/ui/desktop/app/styles/app.scss index 2e5be7251..a1c80fcc8 100644 --- a/ui/desktop/app/styles/app.scss +++ b/ui/desktop/app/styles/app.scss @@ -512,12 +512,16 @@ $chevron-down: url("data:image/svg+xml;utf-8, -
- {{t 'resources.target.details'}} -
- - {{! Target name }} - - {{@model.target.name}} - - {{! Project name }} - - {{@model.target.project.displayName}} - - {{! Target description }} - {{#if @model.target.description}} - - {{@model.target.description}} - - {{/if}} - {{! Target type }} - - {{#if @model.target.isSSH}} - {{t 'resources.target.types.ssh'}} - {{else}} - {{t 'resources.target.types.tcp'}} - {{/if}} - - {{! Target ID }} - - + {{#if @model.host}} +
+
- {{@model.target.id}} - - - + {{t 'resources.host.details'}} +
+ + {{! Host name }} + {{#if @model.host.name}} + + {{@model.host.name}} + + {{/if}} + {{! Host description }} + {{#if @model.host.description}} + + {{@model.host.description}} + + {{/if}} + {{! Host ID }} + + + {{@model.host.id}} + + + +
+ {{/if}} +
+
+ {{t 'resources.target.details'}} +
+ + {{! Target name }} + + {{@model.target.name}} + + {{! Project name }} + + {{@model.target.project.displayName}} + + {{! Target description }} + {{#if @model.target.description}} + + {{@model.target.description}} + + {{/if}} + {{! Target type }} + + {{#if @model.target.isSSH}} + {{t 'resources.target.types.ssh'}} + {{else}} + {{t 'resources.target.types.tcp'}} + {{/if}} + + {{! Target ID }} + + + {{@model.target.id}} + + + +
diff --git a/ui/desktop/app/templates/scopes/scope/projects/targets/target.hbs b/ui/desktop/app/templates/scopes/scope/projects/targets/target.hbs index d9df72b12..e3ad27371 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/targets/target.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/targets/target.hbs @@ -39,46 +39,48 @@ -
-
- {{t 'resources.target.details'}} -
- - {{! Target name }} - - {{@model.target.name}} - - {{! Project name }} - - {{@model.target.project.displayName}} - - {{! Target description }} - {{#if @model.target.description}} - - {{@model.target.description}} +
+
+
+ {{t 'resources.target.details'}} +
+ + {{! Target name }} + + {{@model.target.name}} - {{/if}} - {{! Target type }} - - {{#if @model.target.isSSH}} - {{t 'resources.target.types.ssh'}} - {{else}} - {{t 'resources.target.types.tcp'}} + {{! Project name }} + + {{@model.target.project.displayName}} + + {{! Target description }} + {{#if @model.target.description}} + + {{@model.target.description}} + {{/if}} - - {{! Target ID }} - - - {{@model.target.id}} - - - + {{! Target type }} + + {{#if @model.target.isSSH}} + {{t 'resources.target.types.ssh'}} + {{else}} + {{t 'resources.target.types.tcp'}} + {{/if}} + + {{! Target ID }} + + + {{@model.target.id}} + + + +
diff --git a/ui/desktop/tests/acceptance/projects/sessions/session-test.js b/ui/desktop/tests/acceptance/projects/sessions/session-test.js index 35ef1b1dc..820e9bd1b 100644 --- a/ui/desktop/tests/acceptance/projects/sessions/session-test.js +++ b/ui/desktop/tests/acceptance/projects/sessions/session-test.js @@ -85,7 +85,13 @@ module('Acceptance | projects | sessions | session', function (hooks) { scope: stubs.org, }); stubs.project = { id: instances.scopes.project.id, type: 'project' }; - + instances.hostCatalog = this.server.create('host-catalog', { + scope: instances.scopes.project, + }); + instances.host = this.server.create('host', { + scope: instances.scopes.project, + hostCatalog: instances.hostCatalog, + }); instances.authMethods.global = this.server.create('auth-method', { scope: instances.scopes.global, });