diff --git a/ui/core/app/router.js b/ui/core/app/router.js index 70de27a3c..21a0a2ff8 100644 --- a/ui/core/app/router.js +++ b/ui/core/app/router.js @@ -72,7 +72,9 @@ Router.map(function () { }); this.route('auth-methods', function() { - this.route('auth-method', { path: ':auth_method_id' }, function() {}); + this.route('auth-method', { path: ':auth_method_id' }, function() { + this.route('accounts'); + }); this.route('new'); }); 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 index e75ba7cb3..a0d7dca9d 100644 --- a/ui/core/app/routes/scopes/scope/auth-methods/auth-method.js +++ b/ui/core/app/routes/scopes/scope/auth-methods/auth-method.js @@ -12,4 +12,28 @@ export default class ScopesScopeAuthMethodsAuthMethodRoute extends Route { async model({ auth_method_id }) { return this.store.findRecord('auth-method', auth_method_id); } + + /** + * Renders the auth-method specific templates for header, navigation, + * and actions page sections. + * @override + */ + renderTemplate() { + super.renderTemplate(...arguments); + + this.render('scopes/scope/auth-methods/auth-method/-header', { + into: 'scopes/scope/auth-methods/auth-method', + outlet: 'header', + }); + + this.render('scopes/scope/auth-methods/auth-method/-navigation', { + into: 'scopes/scope/auth-methods/auth-method', + outlet: 'navigation', + }); + + this.render('scopes/scope/auth-methods/auth-method/-actions', { + into: 'scopes/scope/auth-methods/auth-method', + outlet: 'actions', + }); + } } diff --git a/ui/core/app/routes/scopes/scope/auth-methods/auth-method/accounts.js b/ui/core/app/routes/scopes/scope/auth-methods/auth-method/accounts.js new file mode 100644 index 000000000..1f56c6e5e --- /dev/null +++ b/ui/core/app/routes/scopes/scope/auth-methods/auth-method/accounts.js @@ -0,0 +1,15 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route { + + // =methods + + /** + * Returns accounts in current auth method. + * @return {Promise{[AccountModel]}} + */ + model() { + const { id: auth_method_id } = this.modelFor('scopes.scope.auth-methods.auth-method'); + return this.store.query('account', { auth_method_id }); + } +} 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 index c24cd6895..2a878ff51 100644 --- a/ui/core/app/templates/scopes/scope/auth-methods/auth-method.hbs +++ b/ui/core/app/templates/scopes/scope/auth-methods/auth-method.hbs @@ -1 +1,25 @@ -{{outlet}} +{{title @model.displayName}} + + + + + + + + + {{outlet "header"}} + + + + {{outlet "navigation"}} + + + + {{outlet "actions"}} + + + + {{outlet}} + + + diff --git a/ui/core/app/templates/scopes/scope/auth-methods/auth-method/-actions.hbs b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/-actions.hbs new file mode 100644 index 000000000..16b9c9813 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/-actions.hbs @@ -0,0 +1,9 @@ + + + {{t 'actions.delete-auth-method'}} + + \ No newline at end of file diff --git a/ui/core/app/templates/scopes/scope/auth-methods/auth-method/-header.hbs b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/-header.hbs new file mode 100644 index 000000000..12f2b18eb --- /dev/null +++ b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/-header.hbs @@ -0,0 +1,4 @@ +

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

+ + {{t (concat 'auth.method-types.' @model.type)}} + \ No newline at end of file diff --git a/ui/core/app/templates/scopes/scope/auth-methods/auth-method/-navigation.hbs b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/-navigation.hbs new file mode 100644 index 000000000..1c3f4d037 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/-navigation.hbs @@ -0,0 +1,8 @@ + + + {{t 'titles.details'}} + + + {{t 'titles.accounts'}} + + \ No newline at end of file diff --git a/ui/core/app/templates/scopes/scope/auth-methods/auth-method/accounts.hbs b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/accounts.hbs new file mode 100644 index 000000000..0436296b8 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/auth-methods/auth-method/accounts.hbs @@ -0,0 +1,37 @@ +{{title (t 'titles.accounts')}} + +{{#if @model}} + + + + + {{t 'form.label.name'}} + {{t 'form.label.id'}} + + + + {{#each @model as |account|}} + + + {{account.name}} +

{{account.description}}

+
+ + {{account.id}} + +
+ {{/each}} +
+
+ +{{else}} + + + + + {{t "descriptions.auth-method-accounts-welcome"}} + + + + +{{/if}} 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 ce0ea1a8b..8a43bfb87 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,40 +1,5 @@ - - -

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

- - {{t (concat 'auth.method-types.' @model.type)}} - -
- - - - - - - - - {{t 'titles.details'}} - - - - - - - - {{t 'actions.delete-auth-method'}} - - - - - - - -
+ diff --git a/ui/core/tests/unit/routes/scopes/scope/auth-methods/auth-method/accounts-test.js b/ui/core/tests/unit/routes/scopes/scope/auth-methods/auth-method/accounts-test.js new file mode 100644 index 000000000..785f478eb --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/auth-methods/auth-method/accounts-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/accounts', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/auth-methods/auth-method/accounts'); + assert.ok(route); + }); +}); diff --git a/ui/core/translations/en-us.yaml b/ui/core/translations/en-us.yaml index 394f1e6ec..316883f4c 100644 --- a/ui/core/translations/en-us.yaml +++ b/ui/core/translations/en-us.yaml @@ -102,6 +102,8 @@ titles: members: Members group-members-welcome: Welcome to Members no-available-users: No Users Available + accounts: Accounts + auth-method-accounts-welcome: Welcome to Accounts descriptions: host-catalogs: Overview of collections of hosts and host sets. empty-set: There are no items to display yet. You may be able to add items or try back later. @@ -122,6 +124,7 @@ descriptions: no-principals-available: Principals are not available for assignment. group-members-welcome: Users belonging to this group appear here. no-available-users: No users are available to add to this group. + auth-method-accounts-welcome: No accounts are available in this auth method. states: info: Info success: Success