From 7ff3bae26d2052e13f99ca67b7cc7a75217048b2 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 12 Aug 2020 17:16:41 -0400 Subject: [PATCH 1/9] chore: Add auth-method index route --- .../app/components/form/auth-method/index.hbs | 47 ++++++++++++++++ ui/core/app/router.js | 4 +- .../app/routes/scopes/scope/auth-methods.js | 56 +++++++++++++++++++ .../scopes/scope/auth-methods/auth-method.js | 16 ++++++ .../scope/auth-methods/auth-method/index.js | 4 ++ .../scopes/scope/auth-methods/auth-method.hbs | 1 + .../scope/auth-methods/auth-method/index.hbs | 24 ++++++++ .../scopes/scope/auth-methods/index.hbs | 7 ++- .../components/form/auth-method/index-test.js | 26 +++++++++ .../scope/auth-methods/auth-method-test.js | 11 ++++ .../auth-methods/auth-method/index-test.js | 11 ++++ ui/core/translations/en-us.yaml | 1 + 12 files changed, 206 insertions(+), 2 deletions(-) create mode 100644 ui/core/app/components/form/auth-method/index.hbs create mode 100644 ui/core/app/routes/scopes/scope/auth-methods/auth-method.js create mode 100644 ui/core/app/routes/scopes/scope/auth-methods/auth-method/index.js create mode 100644 ui/core/app/templates/scopes/scope/auth-methods/auth-method.hbs create mode 100644 ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs create mode 100644 ui/core/tests/integration/components/form/auth-method/index-test.js create mode 100644 ui/core/tests/unit/routes/scopes/scope/auth-methods/auth-method-test.js create mode 100644 ui/core/tests/unit/routes/scopes/scope/auth-methods/auth-method/index-test.js diff --git a/ui/core/app/components/form/auth-method/index.hbs b/ui/core/app/components/form/auth-method/index.hbs new file mode 100644 index 000000000..158f80db2 --- /dev/null +++ b/ui/core/app/components/form/auth-method/index.hbs @@ -0,0 +1,47 @@ + + + {{#if @model.errors.name}} + + {{#each @model.errors.name as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{#if @model.errors.description}} + + {{#each @model.errors.description as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + \ No newline at end of file diff --git a/ui/core/app/router.js b/ui/core/app/router.js index 1471216ea..e23fad074 100644 --- a/ui/core/app/router.js +++ b/ui/core/app/router.js @@ -35,7 +35,9 @@ Router.map(function () { }); this.route('new'); }); - this.route('auth-methods', function() {}); + this.route('auth-methods', function() { + this.route('auth-method', { path: ':auth_method_id' }, function() {}); + }); }); }); }); diff --git a/ui/core/app/routes/scopes/scope/auth-methods.js b/ui/core/app/routes/scopes/scope/auth-methods.js index 112c40248..9c747ba6f 100644 --- a/ui/core/app/routes/scopes/scope/auth-methods.js +++ b/ui/core/app/routes/scopes/scope/auth-methods.js @@ -1,6 +1,13 @@ import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; +import { action } from '@ember/object'; export default class ScopesScopeAuthMethodsRoute extends Route { + // =services + + @service intl; + @service notify; + // =methods /** @@ -11,4 +18,53 @@ export default class ScopesScopeAuthMethodsRoute extends Route { const { id: scopeID} = this.modelFor('scopes.scope'); return this.store.findAll('auth-method', { adapterOptions: { scopeID } }); } + + // =actions + /** + * Rollback changes to an auth-method. + * @param {AuthMethodModel} authMethod + */ + @action + cancel(authMethod) { + const { isNew } = authMethod; + authMethod.rollbackAttributes(); + if (isNew) this.transitionTo('scopes.scope.auth-methods'); + } + + /** + * Save an auth-method in current scope. + * @param {AuthMethodModel} authMethod + */ + @action + async save(authMethod) { + const { isNew } = authMethod; + try { + await authMethod.save(); + this.refresh(); + this.notify.success( + this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success') + ); + this.transitionTo('scopes.scope.auth-methods.auth-method'); + } catch (error) { + //TODO: replace with translated strings + this.notify.error(error.message, { closeAfter: null }); + } + } + + /** + * Delete an auth-method in current scope and redirect to auth-methods + * @param {AuthMethodModel} authMethod + */ + @action + async delete(authMethod) { + try { + await authMethod.destroyRecord(); + this.refresh(); + this.notify.success(this.intl.t('notify.delete-success')); + this.transitionTo('scopes.scope.auth-methods'); + } catch (error) { + //TODO: replace with translated strings + this.notify.error(error.message, { closeAfter: null }); + } + } } diff --git a/ui/core/app/routes/scopes/scope/auth-methods/auth-method.js b/ui/core/app/routes/scopes/scope/auth-methods/auth-method.js new file mode 100644 index 000000000..5cc752eac --- /dev/null +++ b/ui/core/app/routes/scopes/scope/auth-methods/auth-method.js @@ -0,0 +1,16 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeAuthMethodsAuthMethodRoute extends Route { + // =methods + + /** + * Load a single auth-method in current scope. + * @param {object} params + * @param {string} params.auth_method_id + * @return {authMethodModel} + */ + async model({ auth_method_id}) { + const { id: scopeID } = this.modelFor('scopes.scope'); + return this.store.findRecord('auth-method', auth_method_id, { adapterOptions: { scopeID }}); + } +} diff --git a/ui/core/app/routes/scopes/scope/auth-methods/auth-method/index.js b/ui/core/app/routes/scopes/scope/auth-methods/auth-method/index.js new file mode 100644 index 000000000..5cef508e0 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/auth-methods/auth-method/index.js @@ -0,0 +1,4 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeAuthMethodsAuthMethodIndexRoute extends Route { +} diff --git a/ui/core/app/templates/scopes/scope/auth-methods/auth-method.hbs b/ui/core/app/templates/scopes/scope/auth-methods/auth-method.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/auth-methods/auth-method.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs new file mode 100644 index 000000000..3fbc14eca --- /dev/null +++ b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs @@ -0,0 +1,24 @@ + + +

{{t "resources.auth-method"}}

+
+ + + + + {{t 'titles.details'}} + + + + + + + {{@model.type}} + + + +
\ No newline at end of file diff --git a/ui/core/app/templates/scopes/scope/auth-methods/index.hbs b/ui/core/app/templates/scopes/scope/auth-methods/index.hbs index 1b805f939..3286dff79 100644 --- a/ui/core/app/templates/scopes/scope/auth-methods/index.hbs +++ b/ui/core/app/templates/scopes/scope/auth-methods/index.hbs @@ -18,7 +18,12 @@ {{#each @model as |authMethod|}} - {{authMethod.name}} + + {{authMethod.name}} + {{authMethod.description}} diff --git a/ui/core/tests/integration/components/form/auth-method/index-test.js b/ui/core/tests/integration/components/form/auth-method/index-test.js new file mode 100644 index 000000000..df00881db --- /dev/null +++ b/ui/core/tests/integration/components/form/auth-method/index-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import { hbs } from 'ember-cli-htmlbars'; + +module('Integration | Component | form/auth-method/index', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs``); + + assert.equal(this.element.textContent.trim(), ''); + + // Template block usage: + await render(hbs` + + template block text + + `); + + assert.equal(this.element.textContent.trim(), 'template block text'); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/auth-methods/auth-method-test.js b/ui/core/tests/unit/routes/scopes/scope/auth-methods/auth-method-test.js new file mode 100644 index 000000000..36b2e2f2d --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/auth-methods/auth-method-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/auth-methods/auth-method', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/auth-methods/auth-method'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/auth-methods/auth-method/index-test.js b/ui/core/tests/unit/routes/scopes/scope/auth-methods/auth-method/index-test.js new file mode 100644 index 000000000..5a51858df --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/auth-methods/auth-method/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/auth-methods/auth-method/index', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/auth-methods/auth-method/index'); + assert.ok(route); + }); +}); diff --git a/ui/core/translations/en-us.yaml b/ui/core/translations/en-us.yaml index 1002147e2..996073949 100644 --- a/ui/core/translations/en-us.yaml +++ b/ui/core/translations/en-us.yaml @@ -31,6 +31,7 @@ resources: project: Project host-catalog: Host Catalog host-catalogs: Host Catalogs + auth-method: Auth Method auth-methods: Auth Methods titles: iam: IAM From 3524b7c3ff51a1e1daeae08b8e43a90340e6d0c2 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Thu, 13 Aug 2020 10:47:51 -0400 Subject: [PATCH 2/9] chore: Remove unused delete method --- .../app/components/form/auth-method/index.hbs | 6 +++++ .../app/routes/scopes/scope/auth-methods.js | 17 ------------ .../scope/auth-methods/auth-method/index.hbs | 3 --- .../components/form/auth-method-test.js | 21 +++++++++++++++ .../components/form/auth-method/index-test.js | 26 ------------------- 5 files changed, 27 insertions(+), 46 deletions(-) create mode 100644 ui/core/tests/integration/components/form/auth-method-test.js delete mode 100644 ui/core/tests/integration/components/form/auth-method/index-test.js diff --git a/ui/core/app/components/form/auth-method/index.hbs b/ui/core/app/components/form/auth-method/index.hbs index 158f80db2..c2dccd6b6 100644 --- a/ui/core/app/components/form/auth-method/index.hbs +++ b/ui/core/app/components/form/auth-method/index.hbs @@ -5,6 +5,12 @@ @error={{@model.errors.base}} as |form| > + + - - {{@model.type}} - {}; + this.cancel = () => {}; + + await render(hbs` + `); + + assert.ok(find('form')); + }); +}); diff --git a/ui/core/tests/integration/components/form/auth-method/index-test.js b/ui/core/tests/integration/components/form/auth-method/index-test.js deleted file mode 100644 index df00881db..000000000 --- a/ui/core/tests/integration/components/form/auth-method/index-test.js +++ /dev/null @@ -1,26 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | form/auth-method/index', function(hooks) { - setupRenderingTest(hooks); - - test('it renders', async function(assert) { - // Set any properties with this.set('myProperty', 'value'); - // Handle any actions with this.set('myAction', function(val) { ... }); - - await render(hbs``); - - assert.equal(this.element.textContent.trim(), ''); - - // Template block usage: - await render(hbs` - - template block text - - `); - - assert.equal(this.element.textContent.trim(), 'template block text'); - }); -}); From 0d73c81ca533a4ddc1cb8a9f73f3f284ad192fa0 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Thu, 13 Aug 2020 15:12:31 -0400 Subject: [PATCH 3/9] chore: Add auth-method type badge to page title --- .../scopes/scope/auth-methods/auth-method/index.hbs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs index 4fa1f7ea3..0d9a5ca5e 100644 --- a/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs +++ b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs @@ -1,6 +1,9 @@ -

{{t "resources.auth-method"}}

+

+ {{t "resources.auth-method"}} + {{@model.type}} +

From 89384a29de061baa3d6306c83d3110c8819e4888 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Thu, 13 Aug 2020 15:41:33 -0400 Subject: [PATCH 4/9] test: Add authmethods acceptance test --- ui/core/tests/acceptance/auth-methods-test.js | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 ui/core/tests/acceptance/auth-methods-test.js diff --git a/ui/core/tests/acceptance/auth-methods-test.js b/ui/core/tests/acceptance/auth-methods-test.js new file mode 100644 index 000000000..fe4dc5c0e --- /dev/null +++ b/ui/core/tests/acceptance/auth-methods-test.js @@ -0,0 +1,82 @@ +import { module, test } from 'qunit'; +import { visit, currentURL } from '@ember/test-helpers'; +import { setupApplicationTest } from 'ember-qunit'; +import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; +import a11yAudit from 'ember-a11y-testing/test-support/audit'; +import { + authenticateSession, + // These are left here intentionally for future reference. + //currentSession, + //invalidateSession, +} from 'ember-simple-auth/test-support'; + +module('Acceptance | auth methods', function (hooks) { + setupApplicationTest(hooks); + setupMirage(hooks); + + const instances = { + scopes: { + global: null, + org: null + }, + authMethod: null + }; + const urls = { + orgScope: null, + authMethods: null + }; + + hooks.beforeEach(function () { + // Setup Mirage mock resources for this test + instances.scopes.global = this.server.create('scope', { id: 'global' }); + instances.scopes.org = this.server.create('scope', { type: 'org', + scope: { id: instances.scopes.global.id, type: instances.scopes.global.type } + }); + instances.authMethod = this.server.create('auth-method', { + scope: { + id: instances.scopes.org.id, + type: instances.scopes.org.type + } + }); + + // Generate route URLs for resources + urls.orgScope = `/scopes/${instances.scopes.org.id}`; + urls.authMethods = `${urls.orgScope}/auth-methods`; + }); + + test('visiting auth methods', async function (assert) { + assert.expect(1); + authenticateSession(); + await visit(urls.authMethods); + await a11yAudit(); + assert.equal(currentURL(), urls.authMethods); + }); + + test('can navigate to an auth method form', async function (assert) { + assert.expect(0); + }); + + test('can update an auth method and save changes', async function (assert) { + assert.expect(0); + }); + + test('can update an auth method and cancel changes', async function (assert) { + assert.expect(0); + }); + + test('errors are displayed when save on auth method fails', async function (assert) { + assert.expect(0); + }); + + test('errors are displayed when delete on an auth method fails', async function (assert) { + assert.expect(0); + }); + + test('saving a new auth method with invalid fields displays error messages', async function (assert) { + assert.expect(0); + }); + + test('saving an existing auth method with invalid fields displays error messages', async function (assert) { + assert.expect(0); + }); +}); From 8dd13a0936979f7032abfa9d06d0ec674dcc1f22 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Thu, 13 Aug 2020 16:08:45 -0400 Subject: [PATCH 5/9] chore: Create auth-method route --- ui/core/app/router.js | 1 + ui/core/app/routes/scopes/scope/auth-methods.js | 2 +- .../app/routes/scopes/scope/auth-methods/new.js | 14 ++++++++++++++ .../templates/scopes/scope/auth-methods/index.hbs | 8 ++++++++ .../templates/scopes/scope/auth-methods/new.hbs | 15 +++++++++++++++ ui/core/tests/acceptance/auth-methods-test.js | 12 ++++++++++++ .../routes/scopes/scope/auth-methods/new-test.js | 11 +++++++++++ 7 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 ui/core/app/routes/scopes/scope/auth-methods/new.js create mode 100644 ui/core/app/templates/scopes/scope/auth-methods/new.hbs create mode 100644 ui/core/tests/unit/routes/scopes/scope/auth-methods/new-test.js diff --git a/ui/core/app/router.js b/ui/core/app/router.js index da0c7dcce..af71f6132 100644 --- a/ui/core/app/router.js +++ b/ui/core/app/router.js @@ -38,6 +38,7 @@ Router.map(function () { }); this.route('auth-methods', function() { this.route('auth-method', { path: ':auth_method_id' }, function() {}); + this.route('new'); }); }); }); diff --git a/ui/core/app/routes/scopes/scope/auth-methods.js b/ui/core/app/routes/scopes/scope/auth-methods.js index 91c6ac1f4..ffad801fa 100644 --- a/ui/core/app/routes/scopes/scope/auth-methods.js +++ b/ui/core/app/routes/scopes/scope/auth-methods.js @@ -44,7 +44,7 @@ export default class ScopesScopeAuthMethodsRoute extends Route { this.notify.success( this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success') ); - this.transitionTo('scopes.scope.auth-methods.auth-method'); + this.transitionTo('scopes.scope.auth-methods.auth-method', authMethod); } catch (error) { //TODO: replace with translated strings this.notify.error(error.message, { closeAfter: null }); diff --git a/ui/core/app/routes/scopes/scope/auth-methods/new.js b/ui/core/app/routes/scopes/scope/auth-methods/new.js new file mode 100644 index 000000000..ceeb6a5d7 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/auth-methods/new.js @@ -0,0 +1,14 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeAuthMethodsNewRoute extends Route { + // =methods + + /** + * Create a new unsaved auth-method. + * @return {AuthMethodModel} + */ + model() { + const scopeModel = this.modelFor('scopes.scope'); + return this.store.createRecord('auth-method', { type: 'password', scopeModel }); + } +} diff --git a/ui/core/app/templates/scopes/scope/auth-methods/index.hbs b/ui/core/app/templates/scopes/scope/auth-methods/index.hbs index 9d741b6cd..61c7a08e4 100644 --- a/ui/core/app/templates/scopes/scope/auth-methods/index.hbs +++ b/ui/core/app/templates/scopes/scope/auth-methods/index.hbs @@ -3,6 +3,14 @@

{{t "resources.auth-methods"}}

+ + {{#if @model}} + + {{t "titles.new"}} + + {{/if}} + + {{#if @model}} diff --git a/ui/core/app/templates/scopes/scope/auth-methods/new.hbs b/ui/core/app/templates/scopes/scope/auth-methods/new.hbs new file mode 100644 index 000000000..315156454 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/auth-methods/new.hbs @@ -0,0 +1,15 @@ +{{title (t "titles.new")}} + + + +

{{t "titles.new"}}

+
+ + + + +
\ No newline at end of file diff --git a/ui/core/tests/acceptance/auth-methods-test.js b/ui/core/tests/acceptance/auth-methods-test.js index fe4dc5c0e..5b816f253 100644 --- a/ui/core/tests/acceptance/auth-methods-test.js +++ b/ui/core/tests/acceptance/auth-methods-test.js @@ -64,6 +64,18 @@ module('Acceptance | auth methods', function (hooks) { assert.expect(0); }); + test('can create new auth method', async function (assert) { + assert.expect(0); + }); + + test('can cancel new auth method creation', async function (assert) { + assert.expect(0); + }); + + test('saving a new auth method with invalid fields displays error messages', async function (assert) { + assert.expect(0); + }); + test('errors are displayed when save on auth method fails', async function (assert) { assert.expect(0); }); diff --git a/ui/core/tests/unit/routes/scopes/scope/auth-methods/new-test.js b/ui/core/tests/unit/routes/scopes/scope/auth-methods/new-test.js new file mode 100644 index 000000000..6eea2751c --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/auth-methods/new-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/auth-methods/new', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/auth-methods/new'); + assert.ok(route); + }); +}); From e790d5871738ad9239bfc17bf7efead96d9c529b Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Thu, 13 Aug 2020 17:20:10 -0400 Subject: [PATCH 6/9] chore: Use translated string for auth-method type --- .../app/components/form/auth-method/index.hbs | 2 +- .../scope/auth-methods/auth-method/index.hbs | 8 ++++---- .../scopes/scope/auth-methods/index.hbs | 16 +++++++++------- .../components/form/auth-method-test.js | 2 ++ 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/ui/core/app/components/form/auth-method/index.hbs b/ui/core/app/components/form/auth-method/index.hbs index c2dccd6b6..7c1bc5162 100644 --- a/ui/core/app/components/form/auth-method/index.hbs +++ b/ui/core/app/components/form/auth-method/index.hbs @@ -6,7 +6,7 @@ as |form| > diff --git a/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs index 0d9a5ca5e..580249d53 100644 --- a/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs +++ b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs @@ -1,9 +1,9 @@ -

- {{t "resources.auth-method"}} - {{@model.type}} -

+

{{t "resources.auth-method"}}

+ + {{t (concat 'auth.method-types.' @model.type)}} +
diff --git a/ui/core/app/templates/scopes/scope/auth-methods/index.hbs b/ui/core/app/templates/scopes/scope/auth-methods/index.hbs index 61c7a08e4..3cf07c9af 100644 --- a/ui/core/app/templates/scopes/scope/auth-methods/index.hbs +++ b/ui/core/app/templates/scopes/scope/auth-methods/index.hbs @@ -27,17 +27,19 @@ {{#each @model as |authMethod|}} - - {{authMethod.name}} - +

+ + {{authMethod.name}} + +

{{authMethod.description}}
- {{authMethod.type}} + {{t (concat 'auth.method-types.' authMethod.type)}} {{authMethod.id}} diff --git a/ui/core/tests/integration/components/form/auth-method-test.js b/ui/core/tests/integration/components/form/auth-method-test.js index e7320e927..267e516b5 100644 --- a/ui/core/tests/integration/components/form/auth-method-test.js +++ b/ui/core/tests/integration/components/form/auth-method-test.js @@ -9,9 +9,11 @@ module('Integration | Component | form/auth-method', function (hooks) { test('it renders', async function (assert) { this.submit = () => {}; this.cancel = () => {}; + this.model = { type: 'password' }; await render(hbs` `); From 99169e7ff982e1bf80b8f49e944b9b8f3b84a555 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Thu, 13 Aug 2020 17:54:02 -0400 Subject: [PATCH 7/9] chore: Add 'New' button to auth-methods welcome message --- ui/core/app/templates/scopes/scope/auth-methods/index.hbs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/core/app/templates/scopes/scope/auth-methods/index.hbs b/ui/core/app/templates/scopes/scope/auth-methods/index.hbs index 3cf07c9af..5b4fffc2a 100644 --- a/ui/core/app/templates/scopes/scope/auth-methods/index.hbs +++ b/ui/core/app/templates/scopes/scope/auth-methods/index.hbs @@ -55,6 +55,10 @@ {{t 'descriptions.auth-methods-welcome'}} + + + {{t 'titles.new'}} + From 252e5764f1b417ac67fecc09a41c29ef77c78893 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Thu, 13 Aug 2020 18:04:27 -0400 Subject: [PATCH 8/9] chore: Add breadcrumbs to auth-methods views --- .../controllers/scopes/scope/auth-methods.js | 18 ++++++++++++++++++ .../scopes/scope/auth-methods/auth-method.js | 13 +++++++++++++ .../scopes/scope/auth-methods/new.js | 18 ++++++++++++++++++ .../scope/auth-methods/auth-method/index.hbs | 4 ++++ .../scopes/scope/auth-methods/index.hbs | 4 ++++ .../scopes/scope/auth-methods/new.hbs | 4 ++++ .../scopes/scope/auth-methods-test.js | 12 ++++++++++++ .../scope/auth-methods/auth-method-test.js | 12 ++++++++++++ .../scopes/scope/auth-methods/new-test.js | 12 ++++++++++++ 9 files changed, 97 insertions(+) create mode 100644 ui/core/app/controllers/scopes/scope/auth-methods.js create mode 100644 ui/core/app/controllers/scopes/scope/auth-methods/auth-method.js create mode 100644 ui/core/app/controllers/scopes/scope/auth-methods/new.js create mode 100644 ui/core/tests/unit/controllers/scopes/scope/auth-methods-test.js create mode 100644 ui/core/tests/unit/controllers/scopes/scope/auth-methods/auth-method-test.js create mode 100644 ui/core/tests/unit/controllers/scopes/scope/auth-methods/new-test.js diff --git a/ui/core/app/controllers/scopes/scope/auth-methods.js b/ui/core/app/controllers/scopes/scope/auth-methods.js new file mode 100644 index 000000000..ab152cf62 --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/auth-methods.js @@ -0,0 +1,18 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeAuthMethodsController extends Controller { + // =services + + @service intl; + + // =attributes + + /** + * Translated auth-methods breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.intl.t('resources.auth-methods'); + } +} diff --git a/ui/core/app/controllers/scopes/scope/auth-methods/auth-method.js b/ui/core/app/controllers/scopes/scope/auth-methods/auth-method.js new file mode 100644 index 000000000..1005f0216 --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/auth-methods/auth-method.js @@ -0,0 +1,13 @@ +import Controller from '@ember/controller'; + +export default class ScopesScopeAuthMethodsAuthMethodController extends Controller { + // =attributes + + /** + * An auth-method breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.model.displayName; + } +} diff --git a/ui/core/app/controllers/scopes/scope/auth-methods/new.js b/ui/core/app/controllers/scopes/scope/auth-methods/new.js new file mode 100644 index 000000000..ba550f456 --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/auth-methods/new.js @@ -0,0 +1,18 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeAuthMethodsNewController extends Controller { + // =services + + @service intl; + + // =attributes + + /** + * Translated new auth-method breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.intl.t('titles.new'); + } +} diff --git a/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs index 580249d53..c08c3fd4a 100644 --- a/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs +++ b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/index.hbs @@ -6,6 +6,10 @@ + + + + diff --git a/ui/core/app/templates/scopes/scope/auth-methods/index.hbs b/ui/core/app/templates/scopes/scope/auth-methods/index.hbs index 5b4fffc2a..2d772bcd6 100644 --- a/ui/core/app/templates/scopes/scope/auth-methods/index.hbs +++ b/ui/core/app/templates/scopes/scope/auth-methods/index.hbs @@ -3,6 +3,10 @@

{{t "resources.auth-methods"}}

+ + + + {{#if @model}} diff --git a/ui/core/app/templates/scopes/scope/auth-methods/new.hbs b/ui/core/app/templates/scopes/scope/auth-methods/new.hbs index 315156454..44c4f35d6 100644 --- a/ui/core/app/templates/scopes/scope/auth-methods/new.hbs +++ b/ui/core/app/templates/scopes/scope/auth-methods/new.hbs @@ -5,6 +5,10 @@

{{t "titles.new"}}

+ + + + Date: Fri, 14 Aug 2020 10:49:22 -0400 Subject: [PATCH 9/9] chore: Wrap auth-method description in a paragraph tag --- .../scopes/scope/auth-methods/index.hbs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/ui/core/app/templates/scopes/scope/auth-methods/index.hbs b/ui/core/app/templates/scopes/scope/auth-methods/index.hbs index 5b4fffc2a..e49f040ba 100644 --- a/ui/core/app/templates/scopes/scope/auth-methods/index.hbs +++ b/ui/core/app/templates/scopes/scope/auth-methods/index.hbs @@ -27,15 +27,13 @@ {{#each @model as |authMethod|}} -

- - {{authMethod.name}} - -

- {{authMethod.description}} + + {{authMethod.name}} + +

{{authMethod.description}}