From fded59c995862a1ad21c9077c12046355613ae0d Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Sun, 27 Sep 2020 22:25:50 -0400 Subject: [PATCH 1/4] feat: Add account form help text --- ui/core/app/components/form/account/password/index.hbs | 2 ++ .../components/form/account/password/set-password/index.hbs | 1 + ui/core/translations/form/en-us.yaml | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/ui/core/app/components/form/account/password/index.hbs b/ui/core/app/components/form/account/password/index.hbs index 33e8a3759..a608fb281 100644 --- a/ui/core/app/components/form/account/password/index.hbs +++ b/ui/core/app/components/form/account/password/index.hbs @@ -55,6 +55,7 @@ @value={{@model.attributes.login_name}} @label={{t "form.login_name.label"}} @error={{@model.errors.name}} + @helperText={{t "form.login_name.help"}} readonly={{false}} as |field|> {{#if @model.errors.name}} @@ -73,6 +74,7 @@ @value={{this.password}} @label={{t "form.password.label"}} @error={{@model.errors.name}} + @helperText={{t "form.login_name.password.help"}} readonly={{false}} autocomplete="new-password" as |field|> diff --git a/ui/core/app/components/form/account/password/set-password/index.hbs b/ui/core/app/components/form/account/password/set-password/index.hbs index 80780ccc3..5103b7ed9 100644 --- a/ui/core/app/components/form/account/password/set-password/index.hbs +++ b/ui/core/app/components/form/account/password/set-password/index.hbs @@ -12,6 +12,7 @@ @value={{this.password}} @label={{t "form.password.label"}} @error={{@model.errors.name}} + @helperText={{t "form.login_name.set_password.help"}} readonly={{false}} autocomplete="new-password" as |field|> diff --git a/ui/core/translations/form/en-us.yaml b/ui/core/translations/form/en-us.yaml index 79e48056e..ffba8f6c8 100644 --- a/ui/core/translations/form/en-us.yaml +++ b/ui/core/translations/form/en-us.yaml @@ -11,6 +11,11 @@ type: help: The type of the resource, to help differentiate schemas login_name: label: Username + help: The username for the account + password: + help: The password for the account + set_password: + help: Create a new password for the account password: label: Password grant: From 814ff071292c70e0b7d06202a13b16c4ffb7dbbb Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Mon, 28 Sep 2020 14:21:07 -0400 Subject: [PATCH 2/4] refactor: Flatten account help text in translation file --- .../app/components/form/account/password/index.hbs | 14 +++++++------- .../form/account/password/set-password/index.hbs | 8 ++++---- ui/core/translations/form/en-us.yaml | 7 +++---- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/ui/core/app/components/form/account/password/index.hbs b/ui/core/app/components/form/account/password/index.hbs index a608fb281..e2890657e 100644 --- a/ui/core/app/components/form/account/password/index.hbs +++ b/ui/core/app/components/form/account/password/index.hbs @@ -54,13 +54,13 @@ @type="text" @value={{@model.attributes.login_name}} @label={{t "form.login_name.label"}} - @error={{@model.errors.name}} + @error={{@model.errors.login_name}} @helperText={{t "form.login_name.help"}} readonly={{false}} as |field|> - {{#if @model.errors.name}} + {{#if @model.errors.login_name}} - {{#each @model.errors.name as |error|}} + {{#each @model.errors.login_name as |error|}} {{error.message}} {{/each}} @@ -73,14 +73,14 @@ @type="password" @value={{this.password}} @label={{t "form.password.label"}} - @error={{@model.errors.name}} - @helperText={{t "form.login_name.password.help"}} + @error={{@model.errors.password}} + @helperText={{t "form.password.help"}} readonly={{false}} autocomplete="new-password" as |field|> - {{#if @model.errors.name}} + {{#if @model.errors.password}} - {{#each @model.errors.name as |error|}} + {{#each @model.errors.password as |error|}} {{error.message}} {{/each}} diff --git a/ui/core/app/components/form/account/password/set-password/index.hbs b/ui/core/app/components/form/account/password/set-password/index.hbs index 5103b7ed9..0a316121e 100644 --- a/ui/core/app/components/form/account/password/set-password/index.hbs +++ b/ui/core/app/components/form/account/password/set-password/index.hbs @@ -11,14 +11,14 @@ @type="password" @value={{this.password}} @label={{t "form.password.label"}} - @error={{@model.errors.name}} - @helperText={{t "form.login_name.set_password.help"}} + @error={{@model.errors.password}} + @helperText={{t "form.set_password.help"}} readonly={{false}} autocomplete="new-password" as |field|> - {{#if @model.errors.name}} + {{#if @model.errors.password}} - {{#each @model.errors.name as |error|}} + {{#each @model.errors.password as |error|}} {{error.message}} {{/each}} diff --git a/ui/core/translations/form/en-us.yaml b/ui/core/translations/form/en-us.yaml index ffba8f6c8..205b7d987 100644 --- a/ui/core/translations/form/en-us.yaml +++ b/ui/core/translations/form/en-us.yaml @@ -12,12 +12,11 @@ type: login_name: label: Username help: The username for the account - password: - help: The password for the account - set_password: - help: Create a new password for the account +set_password: + help: Create a new password for the account password: label: Password + help: The password for the account grant: label: Grant help: A permissions grant string for a role From 8288820317950da24d18576323b28540a1808d08 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Mon, 28 Sep 2020 14:23:53 -0400 Subject: [PATCH 3/4] refactor: set password form label and helper text --- .../app/components/form/account/password/set-password/index.hbs | 2 +- ui/core/translations/form/en-us.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/core/app/components/form/account/password/set-password/index.hbs b/ui/core/app/components/form/account/password/set-password/index.hbs index 0a316121e..d3a1f6df2 100644 --- a/ui/core/app/components/form/account/password/set-password/index.hbs +++ b/ui/core/app/components/form/account/password/set-password/index.hbs @@ -10,7 +10,7 @@ @name="password" @type="password" @value={{this.password}} - @label={{t "form.password.label"}} + @label={{t "form.set_password.label"}} @error={{@model.errors.password}} @helperText={{t "form.set_password.help"}} readonly={{false}} diff --git a/ui/core/translations/form/en-us.yaml b/ui/core/translations/form/en-us.yaml index 205b7d987..ed2e1e160 100644 --- a/ui/core/translations/form/en-us.yaml +++ b/ui/core/translations/form/en-us.yaml @@ -13,6 +13,7 @@ login_name: label: Username help: The username for the account set_password: + label: Password help: Create a new password for the account password: label: Password From 29ec96774ed061e1fc4bc49b94638df7db42b9c2 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Mon, 28 Sep 2020 17:18:47 -0400 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=F0=9F=90=9B=20gracefully=20handle?= =?UTF-8?q?=20missing=20user=20and/or=20target=20on=20sessions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/core/app/routes/application.js | 3 ++- .../app/routes/scopes/scope/projects/project/sessions.js | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ui/core/app/routes/application.js b/ui/core/app/routes/application.js index 387c8fef2..e54bbd206 100644 --- a/ui/core/app/routes/application.js +++ b/ui/core/app/routes/application.js @@ -6,6 +6,7 @@ import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import { later } from '@ember/runloop'; import loading from 'ember-loading/decorator'; +import { A } from '@ember/array'; /** * Entry route for the application. @@ -81,7 +82,7 @@ export default class ApplicationRoute extends Route.extend( */ @action error(e) { - const isUnauthenticated = e?.errors[0]?.isUnauthenticated; + const isUnauthenticated = A(e?.errors)?.firstObject?.isUnauthenticated; if (isUnauthenticated) { this.session.invalidate(); return false; diff --git a/ui/core/app/routes/scopes/scope/projects/project/sessions.js b/ui/core/app/routes/scopes/scope/projects/project/sessions.js index 63b53d7db..c5f7c8004 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/sessions.js +++ b/ui/core/app/routes/scopes/scope/projects/project/sessions.js @@ -45,8 +45,12 @@ export default class ScopesScopeProjectsProjectSessionsRoute extends Route { return all( sessions.map(session => hash({ session, - user: this.store.findRecord('user', session.user_id), - target: this.store.findRecord('target', session.target_id), + user: session.user_id + ? this.store.findRecord('user', session.user_id) + : null, + target: session.target_id + ? this.store.findRecord('target', session.target_id) + : null, })) ); }