From fb2cfb13af5e8f9012a084f1ffa574ee67dd3568 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Tue, 9 Feb 2021 22:46:45 -0500 Subject: [PATCH 1/3] feat: Show info messages when resources are empty --- addons/core/translations/resources/en-us.yaml | 3 + .../scopes/scope/projects/targets/index.hbs | 138 ++++++++++-------- .../scope/projects/targets/target/hosts.hbs | 74 ++++++---- .../projects/targets/target/sessions.hbs | 94 +++++++----- 4 files changed, 177 insertions(+), 132 deletions(-) diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index ff2dce9eb..55b547d0b 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -195,6 +195,9 @@ target: messages: welcome: title: Welcome to Targets + none: + title: No Targets Available + description: No Targets to display yet. Contact your Boundary admin if you don't see a Target you expect access to. actions: create: New Target delete: Delete Target 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 b816ced05..bbb3e7b5d 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/targets/index.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/targets/index.hbs @@ -7,73 +7,87 @@ - - - - {{t "form.name.label"}} - {{t "form.id.label"}} - {{t "form.type.label"}} - {{t "resources.project.title"}} - - - - - {{#each @model as |model|}} - - - - - {{model.target.displayName}} - -

{{model.target.description}}

-
- - - {{model.target.id}} - - - - {{#if model.target.type}} - - {{t (concat "resources.target.types." model.target.type)}} - - {{/if}} - - -
+ {{#if @model}} + + + + + {{t "form.name.label"}} + {{t "form.id.label"}} + {{t "form.type.label"}} + {{t "resources.project.title"}} + + + + + {{#each @model as |model|}} + + + + + {{model.target.displayName}} + +

{{model.target.description}}

+
+ - {{model.project.id}} + {{model.target.id}} -
- - {{model.project.name}} - -
- - - {{t "resources.session.actions.connect"}} - - -
- {{/each}} -
-
+ + + {{#if model.target.type}} + + {{t (concat "resources.target.types." model.target.type)}} + + {{/if}} + + +
+ + {{model.project.id}} + +
+ + {{model.project.name}} + +
+ + + {{t "resources.session.actions.connect"}} + + + + {{/each}} + + + + {{else}} + + + + + {{t "resources.target.messages.none.description"}} + + + + + {{/if}}
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 bb76d5e56..e2cf73f39 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 @@ -1,32 +1,46 @@ {{page-title (t "resources.host-set.title_plural")}} - - - {{#each @model.hosts as |host|}} - - - {{host.displayName}} -

{{host.description}}

-
- - - {{host.id}} - - - {{host.attributes.address}} - - {{t (concat 'resources.host.types.' host.type)}} - - - - {{t "resources.session.actions.connect"}} - - -
- {{/each}} -
-
+{{#if @model.hosts}} + + + + {{#each @model.hosts as |host|}} + + + {{host.displayName}} +

{{host.description}}

+
+ + + {{host.id}} + + + {{host.attributes.address}} + + {{t (concat 'resources.host.types.' host.type)}} + + + + {{t "resources.session.actions.connect"}} + + +
+ {{/each}} +
+
+ +{{else}} + + + + + {{t "resources.host.messages.none.description"}} + + + + +{{/if}} 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 48f10efda..d9edc3900 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 @@ -1,40 +1,54 @@ - - - {{!-- - TODO: sort these via the controller so that active and pending appear first - similar to the way the sessions routes are sorted. - --}} - {{#each @model.target.sessions as |session|}} - - - - - {{session.id}} - - - - - - - {{session.status}} - - - {{#if session.isCancelable}} - - {{t "actions.cancel"}} - - {{/if}} - - - {{/each}} - - +{{#if @model.target.sessions}} + + + + {{!-- + TODO: sort these via the controller so that active and pending appear first + similar to the way the sessions routes are sorted. + --}} + {{#each @model.target.sessions as |session|}} + + + + + {{session.id}} + + + + + + + {{session.status}} + + + {{#if session.isCancelable}} + + {{t "actions.cancel"}} + + {{/if}} + + + {{/each}} + + + +{{else}} + + + + + {{t "resources.session.messages.none.description"}} + + + + +{{/if}} \ No newline at end of file From 40cb386cfd3cf82e0403fdca9d9d8b389047e556 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 10 Feb 2021 21:49:33 -0500 Subject: [PATCH 2/3] chore: Add friendly tag to desktop info messages Adding a friendly tag to translation file properties helps maintain the current structure while adding non-administrative language to info messages. --- addons/core/translations/resources/en-us.yaml | 9 +++++++++ .../templates/scopes/scope/projects/sessions/index.hbs | 4 ++-- .../scopes/scope/projects/targets/target/hosts.hbs | 4 ++-- .../scopes/scope/projects/targets/target/sessions.hbs | 4 ++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 55b547d0b..e670a70d7 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -95,6 +95,9 @@ host: none: title: No Hosts description: No hosts available in this scope. + none-friendly: + title: No Hosts Available + description: No hosts available to display yet. actions: add: Add Host create: New Host @@ -110,6 +113,12 @@ session: none: title: No Sessions description: There are no active sessions within the current scope. + none-friendly: + title: No Sessions Available + description: No sessions available to display yet. + none-active-friendly: + title: No Active Sessions Available + description: No active sessions available to display yet. actions: connect: Connect org: 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 35c53bb63..4c124cc24 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs @@ -83,9 +83,9 @@ {{else}} - + - {{t "resources.session.messages.none.description"}} + {{t "resources.session.messages.none-friendly.description"}} 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 e2cf73f39..92ae3eebe 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 @@ -36,9 +36,9 @@ {{else}} - + - {{t "resources.host.messages.none.description"}} + {{t "resources.host.messages.none-friendly.description"}} 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 d9edc3900..0c8095880 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 @@ -44,9 +44,9 @@ {{else}} - + - {{t "resources.session.messages.none.description"}} + {{t "resources.session.messages.none-active-friendly.description"}} From cb04f93a8333d5e8b77f11bc5c4b0b5ebb0263de Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Fri, 12 Feb 2021 09:34:42 -0500 Subject: [PATCH 3/3] style: Fix tab spacing in sessions template --- .../projects/targets/target/sessions.hbs | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) 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 8806a81af..fa93594e3 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 @@ -17,26 +17,27 @@ - {{!-- - Two if's here because: - 1) Local proxy info is only relevant if the session is - active or pending (aka isCancelable). Once the session - is canceled or in the process thereof, the local proxy - may no longer be used. - 2) The session actually has proxy information associated - with it. It's possible for the user to start sessions - from other devices (or even another tab), in which case we - won't have the local proxy info available here. - --}} - {{#if session.isCancelable}} - {{#if session.proxy}} - - {{session.proxy}} - + {{!-- + Two if's here because: + 1) Local proxy info is only relevant if the session is + active or pending (aka isCancelable). Once the session + is canceled or in the process thereof, the local proxy + may no longer be used. + 2) The session actually has proxy information associated + with it. It's possible for the user to start sessions + from other devices (or even another tab), in which case we + won't have the local proxy info available here. + --}} + {{#if session.isCancelable}} + {{#if session.proxy}} + + {{session.proxy}} + + {{/if}} {{/if}}