diff --git a/ui/desktop/app/components/copyable/index.js b/ui/desktop/app/components/copyable/index.js index 17652e911..3de4687ff 100644 --- a/ui/desktop/app/components/copyable/index.js +++ b/ui/desktop/app/components/copyable/index.js @@ -1,9 +1,10 @@ import Component from '@glimmer/component'; -import ClipboardJS from 'clipboard'; import { action } from '@ember/object'; +import { getOwner } from '@ember/application'; import { generateComponentID } from 'rose/utilities/component-auto-id'; import { task, timeout } from 'ember-concurrency'; import { tracked } from '@glimmer/tracking'; +import ClipboardJS from 'clipboard'; export default class CopyableComponent extends Component { @@ -46,6 +47,18 @@ export default class CopyableComponent extends Component { return ClipboardJS.isSupported(); } + // =methods + + /** + * Returns the first element with the specified class name if exists, + * otherwise undefined. + * @return {?HTMLElement} + */ + getFirstElementByClassName(className) { + const document = getOwner(this).lookup('service:-document').documentElement; + return document.getElementsByClassName(className)[0]; + } + // =actions /** @@ -57,6 +70,13 @@ export default class CopyableComponent extends Component { /* istanbul ignore next */ this.clipboard = new ClipboardJS(`#${this.copyableButtonId}`, { text: () => this.args.text, + // ClipboardJS depends on inserting a hidden textarea that receives + // focus in order to copy text to the clipboard. However, our modal + // has a focus trap that prevents this focus. Thus we try to set the + // container to a modal (if exists), since this is the only container + // a user would be able to interact with. If a modal doesn't exist, + // container is set to `undefined` and thus uses the default body element. + container: this.getFirstElementByClassName('rose-dialog') }); /* istanbul ignore next */ this.clipboard.on('success', (clipboardEvent) => { diff --git a/ui/desktop/app/templates/application.hbs b/ui/desktop/app/templates/application.hbs index 6dfa45877..9c504be7b 100644 --- a/ui/desktop/app/templates/application.hbs +++ b/ui/desktop/app/templates/application.hbs @@ -57,11 +57,19 @@ @dismiss={{accept}} as |dialog|> - {{t 'states.connection.success.description' - port=confirmation.text.port - address=confirmation.text.address - protocol=confirmation.text.protocol - }} + + + {{t 'states.connection.success.description' + port=confirmation.text.port + address=confirmation.text.address + protocol=confirmation.text.protocol + }} + + diff --git a/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs b/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs index b6beccc53..35c53bb63 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs @@ -27,7 +27,13 @@ class={{concat "session-status-" sessionAggregate.session.status}} @name="app-icons/action-session" @size="medium" /> - {{sessionAggregate.session.id}} + + {{sessionAggregate.session.id}} + {{sessionAggregate.target.displayName}} diff --git a/ui/desktop/app/templates/scopes/scope/projects/targets/index.hbs b/ui/desktop/app/templates/scopes/scope/projects/targets/index.hbs index bee6e9d46..b200db570 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/targets/index.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/targets/index.hbs @@ -30,16 +30,34 @@

{{model.target.description}}

- {{model.target.id}} + + {{model.target.id}} + - {{model.target.type}} + {{#if model.target.type}} + + {{t (concat "resources.target.types." model.target.type)}} + + {{/if}} +
+ + {{model.project.id}} + +
{{model.project.name}} -

{{model.project.id}}

diff --git a/ui/desktop/app/templates/scopes/scope/projects/targets/target/-header.hbs b/ui/desktop/app/templates/scopes/scope/projects/targets/target/-header.hbs index 41f83d562..fb4da6c13 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/targets/target/-header.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/targets/target/-header.hbs @@ -1,4 +1,13 @@

{{@model.target.displayName}}

-

{{@model.target.description}}

\ No newline at end of file +

{{@model.target.description}}

+

+ + {{@model.target.id}} + +

\ No newline at end of file diff --git a/ui/desktop/app/templates/scopes/scope/projects/targets/target/hosts.hbs b/ui/desktop/app/templates/scopes/scope/projects/targets/target/hosts.hbs index a925671d7..1d17dcbd7 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/targets/target/hosts.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/targets/target/hosts.hbs @@ -8,7 +8,15 @@ {{host.displayName}}

{{host.description}}

- {{host.id}} + + + {{host.id}} + + {{host.attributes.address}} {{t (concat 'resources.host.types.' host.type)}} diff --git a/ui/desktop/app/templates/scopes/scope/projects/targets/target/sessions.hbs b/ui/desktop/app/templates/scopes/scope/projects/targets/target/sessions.hbs index 49a8e2585..8263162c9 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/targets/target/sessions.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/targets/target/sessions.hbs @@ -7,7 +7,13 @@ class={{concat "session-status-" session.status}} @name="app-icons/action-session" @size="medium" /> - {{session.id}} + + {{session.id}} +