From 1a836b0210e1bcafd22ba1ad0097a5ee1fe069c9 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Mon, 27 Jul 2020 14:12:19 -0400 Subject: [PATCH 01/13] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Refactor=20user?= =?UTF-8?q?=20CRUD+L=20to=20/scopes/:scope=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/controllers/orgs/org/groups/group.js | 1 - .../app/controllers/orgs/org/groups/new.js | 1 - ui/core/app/controllers/orgs/org/projects.js | 2 - .../app/controllers/orgs/org/projects/new.js | 2 - .../controllers/orgs/org/projects/project.js | 2 - .../org/projects/project/host-catalogs.js | 2 - .../project/host-catalogs/host-catalog.js | 2 - .../org/projects/project/host-catalogs/new.js | 2 - ui/core/app/controllers/orgs/org/roles.js | 1 - ui/core/app/controllers/orgs/org/roles/new.js | 1 - .../app/controllers/orgs/org/roles/role.js | 1 - ui/core/app/controllers/orgs/org/users.js | 1 - .../app/controllers/scopes/scope/projects.js | 2 - .../controllers/scopes/scope/projects/new.js | 2 - .../scopes/scope/projects/project.js | 2 - ui/core/app/router.js | 35 +++--- ui/core/app/routes/orgs.js | 2 - .../app/routes/orgs/org/groups/group/index.js | 3 +- ui/core/app/routes/orgs/org/projects/index.js | 2 +- .../app/routes/orgs/org/projects/project.js | 2 +- .../org/projects/project/host-catalogs.js | 1 - .../project/host-catalogs/host-catalog.js | 2 - .../host-catalogs/host-catalog/index.js | 3 +- .../projects/project/host-catalogs/index.js | 3 +- .../org/projects/project/host-catalogs/new.js | 5 +- .../routes/orgs/org/projects/project/index.js | 3 +- ui/core/app/routes/orgs/org/roles.js | 1 - ui/core/app/routes/orgs/org/users/index.js | 3 +- ui/core/app/routes/scopes.js | 3 +- ui/core/app/routes/scopes/scope.js | 2 - ui/core/app/routes/scopes/scope/projects.js | 2 - .../app/routes/scopes/scope/projects/index.js | 3 +- .../app/routes/scopes/scope/projects/new.js | 4 +- .../routes/scopes/scope/projects/project.js | 2 - .../scopes/scope/projects/project/index.js | 3 +- ui/core/app/routes/scopes/scope/users.js | 73 +++++++++++ .../app/routes/scopes/scope/users/index.js | 3 + ui/core/app/routes/scopes/scope/users/new.js | 13 ++ ui/core/app/routes/scopes/scope/users/user.js | 17 +++ .../routes/scopes/scope/users/user/index.js | 3 + ui/core/app/templates/scopes/scope.hbs | 8 +- ui/core/app/templates/scopes/scope/users.hbs | 3 + .../templates/scopes/scope/users/index.hbs | 63 ++++++++++ .../app/templates/scopes/scope/users/new.hbs | 21 ++++ .../app/templates/scopes/scope/users/user.hbs | 3 + .../scopes/scope/users/user/index.hbs | 35 ++++++ ui/core/tests/acceptance/bread-crumbs-test.js | 117 ++++++++++++++---- ui/core/tests/acceptance/groups-test.js | 9 +- .../tests/acceptance/host-catalogs-test.js | 106 ++++++++-------- ui/core/tests/acceptance/projects-test.js | 16 ++- ui/core/tests/acceptance/roles-test.js | 6 +- ui/core/tests/acceptance/users-test.js | 8 +- .../components/bread-crumbs-test.js | 42 ++++--- .../components/form/host-catalog-test.js | 4 +- .../unit/controllers/orgs/org/groups-test.js | 4 +- .../controllers/orgs/org/groups/group-test.js | 4 +- .../controllers/orgs/org/groups/new-test.js | 4 +- .../controllers/orgs/org/projects-test.js | 4 +- .../controllers/orgs/org/projects/new-test.js | 4 +- .../orgs/org/projects/project-test.js | 4 +- .../projects/project/host-catalogs-test.js | 10 +- .../host-catalogs/host-catalog-test.js | 21 ++-- .../project/host-catalogs/new-test.js | 21 ++-- .../unit/controllers/orgs/org/roles-test.js | 4 +- .../controllers/orgs/org/roles/new-test.js | 4 +- .../controllers/orgs/org/roles/role-test.js | 4 +- .../unit/controllers/orgs/org/users-test.js | 4 +- .../controllers/orgs/org/users/new-test.js | 4 +- .../controllers/orgs/org/users/user-test.js | 4 +- .../controllers/scopes/scope/projects-test.js | 4 +- .../scopes/scope/projects/new-test.js | 4 +- .../scopes/scope/projects/project-test.js | 8 +- .../tests/unit/routes/orgs/org/groups-test.js | 4 +- .../unit/routes/orgs/org/groups/group-test.js | 4 +- .../orgs/org/groups/group/index-test.js | 4 +- .../unit/routes/orgs/org/groups/index-test.js | 4 +- .../unit/routes/orgs/org/groups/new-test.js | 4 +- .../projects/project/host-catalogs-test.js | 10 +- .../host-catalogs/host-catalog-test.js | 19 +-- .../host-catalogs/host-catalog/index-test.js | 19 +-- .../project/host-catalogs/index-test.js | 19 +-- .../project/host-catalogs/new-test.js | 10 +- .../orgs/org/projects/project/index-test.js | 4 +- .../tests/unit/routes/orgs/org/roles-test.js | 4 +- .../unit/routes/orgs/org/roles/index-test.js | 4 +- .../unit/routes/orgs/org/roles/new-test.js | 4 +- .../unit/routes/orgs/org/roles/role-test.js | 4 +- .../tests/unit/routes/orgs/org/users-test.js | 4 +- .../unit/routes/orgs/org/users/index-test.js | 4 +- .../unit/routes/orgs/org/users/new-test.js | 4 +- .../unit/routes/orgs/org/users/user-test.js | 4 +- ui/core/tests/unit/routes/scopes-test.js | 4 +- .../tests/unit/routes/scopes/scope-test.js | 4 +- .../unit/routes/scopes/scope/projects-test.js | 4 +- .../scopes/scope/projects/index-test.js | 4 +- .../routes/scopes/scope/projects/new-test.js | 4 +- .../scopes/scope/projects/project-test.js | 4 +- .../scope/projects/project/index-test.js | 4 +- .../unit/routes/scopes/scope/users-test.js | 11 ++ .../routes/scopes/scope/users/index-test.js | 11 ++ .../routes/scopes/scope/users/new-test.js | 11 ++ .../routes/scopes/scope/users/user-test.js | 11 ++ .../scopes/scope/users/user/index-test.js | 11 ++ 103 files changed, 687 insertions(+), 303 deletions(-) create mode 100644 ui/core/app/routes/scopes/scope/users.js create mode 100644 ui/core/app/routes/scopes/scope/users/index.js create mode 100644 ui/core/app/routes/scopes/scope/users/new.js create mode 100644 ui/core/app/routes/scopes/scope/users/user.js create mode 100644 ui/core/app/routes/scopes/scope/users/user/index.js create mode 100644 ui/core/app/templates/scopes/scope/users.hbs create mode 100644 ui/core/app/templates/scopes/scope/users/index.hbs create mode 100644 ui/core/app/templates/scopes/scope/users/new.hbs create mode 100644 ui/core/app/templates/scopes/scope/users/user.hbs create mode 100644 ui/core/app/templates/scopes/scope/users/user/index.hbs create mode 100644 ui/core/tests/unit/routes/scopes/scope/users-test.js create mode 100644 ui/core/tests/unit/routes/scopes/scope/users/index-test.js create mode 100644 ui/core/tests/unit/routes/scopes/scope/users/new-test.js create mode 100644 ui/core/tests/unit/routes/scopes/scope/users/user-test.js create mode 100644 ui/core/tests/unit/routes/scopes/scope/users/user/index-test.js diff --git a/ui/core/app/controllers/orgs/org/groups/group.js b/ui/core/app/controllers/orgs/org/groups/group.js index 972fb39ed..0d12865f7 100644 --- a/ui/core/app/controllers/orgs/org/groups/group.js +++ b/ui/core/app/controllers/orgs/org/groups/group.js @@ -8,5 +8,4 @@ export default class OrgsOrgGroupsGroupController extends Controller { * @type {string} */ @alias('model.displayName') breadCrumb; - } diff --git a/ui/core/app/controllers/orgs/org/groups/new.js b/ui/core/app/controllers/orgs/org/groups/new.js index 9ca97fbe5..1c5eeb7c9 100644 --- a/ui/core/app/controllers/orgs/org/groups/new.js +++ b/ui/core/app/controllers/orgs/org/groups/new.js @@ -14,5 +14,4 @@ export default class OrgsOrgGroupsNewController extends Controller { get breadCrumb() { return this.intl.t('titles.new'); } - } diff --git a/ui/core/app/controllers/orgs/org/projects.js b/ui/core/app/controllers/orgs/org/projects.js index e1199f8e8..60c1441a7 100644 --- a/ui/core/app/controllers/orgs/org/projects.js +++ b/ui/core/app/controllers/orgs/org/projects.js @@ -2,7 +2,6 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; export default class OrgsOrgProjectsController extends Controller { - // =services @service intl; @@ -15,5 +14,4 @@ export default class OrgsOrgProjectsController extends Controller { get breadCrumb() { return this.intl.t('resources.projects'); } - } diff --git a/ui/core/app/controllers/orgs/org/projects/new.js b/ui/core/app/controllers/orgs/org/projects/new.js index 5f9540189..769d6e195 100644 --- a/ui/core/app/controllers/orgs/org/projects/new.js +++ b/ui/core/app/controllers/orgs/org/projects/new.js @@ -2,7 +2,6 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; export default class OrgsOrgProjectsNewController extends Controller { - // =services @service intl; @@ -15,5 +14,4 @@ export default class OrgsOrgProjectsNewController extends Controller { get breadCrumb() { return this.intl.t('titles.new'); } - } diff --git a/ui/core/app/controllers/orgs/org/projects/project.js b/ui/core/app/controllers/orgs/org/projects/project.js index d56cf15d9..c449ef523 100644 --- a/ui/core/app/controllers/orgs/org/projects/project.js +++ b/ui/core/app/controllers/orgs/org/projects/project.js @@ -2,12 +2,10 @@ import Controller from '@ember/controller'; import { alias } from '@ember/object/computed'; export default class OrgsOrgProjectsProjectController extends Controller { - // =attributes /** * @type {string} */ @alias('model.displayName') breadCrumb; - } diff --git a/ui/core/app/controllers/orgs/org/projects/project/host-catalogs.js b/ui/core/app/controllers/orgs/org/projects/project/host-catalogs.js index 80dde2c39..ed10e744b 100644 --- a/ui/core/app/controllers/orgs/org/projects/project/host-catalogs.js +++ b/ui/core/app/controllers/orgs/org/projects/project/host-catalogs.js @@ -2,7 +2,6 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; export default class OrgsOrgProjectsProjectHostCatalogsController extends Controller { - // =services @service intl; @@ -15,5 +14,4 @@ export default class OrgsOrgProjectsProjectHostCatalogsController extends Contro get breadCrumb() { return this.intl.t('resources.host-catalogs'); } - } diff --git a/ui/core/app/controllers/orgs/org/projects/project/host-catalogs/host-catalog.js b/ui/core/app/controllers/orgs/org/projects/project/host-catalogs/host-catalog.js index 57d0c2724..1e733a5aa 100644 --- a/ui/core/app/controllers/orgs/org/projects/project/host-catalogs/host-catalog.js +++ b/ui/core/app/controllers/orgs/org/projects/project/host-catalogs/host-catalog.js @@ -2,12 +2,10 @@ import Controller from '@ember/controller'; import { alias } from '@ember/object/computed'; export default class OrgsOrgProjectsProjectHostCatalogsHostCatalogController extends Controller { - // =attributes /** * @type {string} */ @alias('model.displayName') breadCrumb; - } diff --git a/ui/core/app/controllers/orgs/org/projects/project/host-catalogs/new.js b/ui/core/app/controllers/orgs/org/projects/project/host-catalogs/new.js index 4fb2aed63..02b865cd0 100644 --- a/ui/core/app/controllers/orgs/org/projects/project/host-catalogs/new.js +++ b/ui/core/app/controllers/orgs/org/projects/project/host-catalogs/new.js @@ -2,7 +2,6 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; export default class OrgsOrgProjectsProjectHostCatalogsNewController extends Controller { - // =services @service intl; @@ -15,5 +14,4 @@ export default class OrgsOrgProjectsProjectHostCatalogsNewController extends Con get breadCrumb() { return this.intl.t('titles.new'); } - } diff --git a/ui/core/app/controllers/orgs/org/roles.js b/ui/core/app/controllers/orgs/org/roles.js index 7f62b0e1a..16f84ae44 100644 --- a/ui/core/app/controllers/orgs/org/roles.js +++ b/ui/core/app/controllers/orgs/org/roles.js @@ -14,5 +14,4 @@ export default class OrgsOrgRolesController extends Controller { get breadCrumb() { return this.intl.t('resources.roles'); } - } diff --git a/ui/core/app/controllers/orgs/org/roles/new.js b/ui/core/app/controllers/orgs/org/roles/new.js index 38a098eaa..126c6a1b8 100644 --- a/ui/core/app/controllers/orgs/org/roles/new.js +++ b/ui/core/app/controllers/orgs/org/roles/new.js @@ -14,5 +14,4 @@ export default class OrgsOrgRolesNewController extends Controller { get breadCrumb() { return this.intl.t('titles.new'); } - } diff --git a/ui/core/app/controllers/orgs/org/roles/role.js b/ui/core/app/controllers/orgs/org/roles/role.js index 23fe25882..90425d113 100644 --- a/ui/core/app/controllers/orgs/org/roles/role.js +++ b/ui/core/app/controllers/orgs/org/roles/role.js @@ -8,5 +8,4 @@ export default class OrgsOrgRolesRoleController extends Controller { * @type {string} */ @alias('model.displayName') breadCrumb; - } diff --git a/ui/core/app/controllers/orgs/org/users.js b/ui/core/app/controllers/orgs/org/users.js index ae81e0302..fe28ecf0f 100644 --- a/ui/core/app/controllers/orgs/org/users.js +++ b/ui/core/app/controllers/orgs/org/users.js @@ -14,5 +14,4 @@ export default class OrgsOrgUsersController extends Controller { get breadCrumb() { return this.intl.t('resources.users'); } - } diff --git a/ui/core/app/controllers/scopes/scope/projects.js b/ui/core/app/controllers/scopes/scope/projects.js index cdd9bda8a..af28cf813 100644 --- a/ui/core/app/controllers/scopes/scope/projects.js +++ b/ui/core/app/controllers/scopes/scope/projects.js @@ -2,7 +2,6 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; export default class ScopesScopeProjectsController extends Controller { - // =services @service intl; @@ -15,5 +14,4 @@ export default class ScopesScopeProjectsController extends Controller { get breadCrumb() { return this.intl.t('resources.projects'); } - } diff --git a/ui/core/app/controllers/scopes/scope/projects/new.js b/ui/core/app/controllers/scopes/scope/projects/new.js index 50b30d187..d1f87399f 100644 --- a/ui/core/app/controllers/scopes/scope/projects/new.js +++ b/ui/core/app/controllers/scopes/scope/projects/new.js @@ -2,7 +2,6 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; export default class ScopesScopeProjectsNewController extends Controller { - // =services @service intl; @@ -15,5 +14,4 @@ export default class ScopesScopeProjectsNewController extends Controller { get breadCrumb() { return this.intl.t('titles.new'); } - } diff --git a/ui/core/app/controllers/scopes/scope/projects/project.js b/ui/core/app/controllers/scopes/scope/projects/project.js index 8fc8bbb1c..8d1219267 100644 --- a/ui/core/app/controllers/scopes/scope/projects/project.js +++ b/ui/core/app/controllers/scopes/scope/projects/project.js @@ -1,7 +1,6 @@ import Controller from '@ember/controller'; export default class ScopesScopeProjectsProjectController extends Controller { - // =attributes /** @@ -10,5 +9,4 @@ export default class ScopesScopeProjectsProjectController extends Controller { get breadCrumb() { return this.model.displayName; } - } diff --git a/ui/core/app/router.js b/ui/core/app/router.js index e07a9ee94..1c3e3e78b 100644 --- a/ui/core/app/router.js +++ b/ui/core/app/router.js @@ -7,11 +7,14 @@ export default class Router extends EmberRouter { } Router.map(function () { - - this.route('scopes', function() { - this.route('scope', { path: ':scope_id' }, function() { - this.route('projects', function() { - this.route('project', { path: ':project_id' }, function() {}); + this.route('scopes', function () { + this.route('scope', { path: ':scope_id' }, function () { + this.route('projects', function () { + this.route('project', { path: ':project_id' }, function () {}); + this.route('new'); + }); + this.route('users', function () { + this.route('user', { path: ':user_id' }, function () {}); this.route('new'); }); }); @@ -20,27 +23,31 @@ Router.map(function () { this.route('orgs', function () { this.route('org', { path: ':org_id' }, function () { this.route('projects', function () { - this.route('project', { path: ':project_id' }, function() { - this.route('host-catalogs', function() { - this.route('host-catalog', { path: ':host_catalog_id' }, function() {}); + this.route('project', { path: ':project_id' }, function () { + this.route('host-catalogs', function () { + this.route( + 'host-catalog', + { path: ':host_catalog_id' }, + function () {} + ); this.route('new'); }); }); this.route('new'); }); - this.route('users', function() { - this.route('user', { path: ':user_id' }, function() {}); + this.route('users', function () { + this.route('user', { path: ':user_id' }, function () {}); this.route('new'); }); - this.route('roles', function() { - this.route('role', { path: ':role_id' }, function() {}); + this.route('roles', function () { + this.route('role', { path: ':role_id' }, function () {}); this.route('new'); }); - this.route('groups', function() { - this.route('group', { path: ':group_id' }, function() {}); + this.route('groups', function () { + this.route('group', { path: ':group_id' }, function () {}); this.route('new'); }); }); diff --git a/ui/core/app/routes/orgs.js b/ui/core/app/routes/orgs.js index 199076b0b..f41f51d52 100644 --- a/ui/core/app/routes/orgs.js +++ b/ui/core/app/routes/orgs.js @@ -1,7 +1,6 @@ import Route from '@ember/routing/route'; export default class OrgsRoute extends Route { - // =methods /** @@ -11,5 +10,4 @@ export default class OrgsRoute extends Route { model() { return this.store.findAll('org'); } - } diff --git a/ui/core/app/routes/orgs/org/groups/group/index.js b/ui/core/app/routes/orgs/org/groups/group/index.js index 521f73a9c..9bd8f2675 100644 --- a/ui/core/app/routes/orgs/org/groups/group/index.js +++ b/ui/core/app/routes/orgs/org/groups/group/index.js @@ -1,4 +1,3 @@ import Route from '@ember/routing/route'; -export default class OrgsOrgGroupsGroupIndexRoute extends Route { -} +export default class OrgsOrgGroupsGroupIndexRoute extends Route {} diff --git a/ui/core/app/routes/orgs/org/projects/index.js b/ui/core/app/routes/orgs/org/projects/index.js index c22022cf9..be2068f6d 100644 --- a/ui/core/app/routes/orgs/org/projects/index.js +++ b/ui/core/app/routes/orgs/org/projects/index.js @@ -1,3 +1,3 @@ import Route from '@ember/routing/route'; -export default class OrgsOrgProjectsIndexRoute extends Route { } +export default class OrgsOrgProjectsIndexRoute extends Route {} diff --git a/ui/core/app/routes/orgs/org/projects/project.js b/ui/core/app/routes/orgs/org/projects/project.js index 8f06533bc..3171733ff 100644 --- a/ui/core/app/routes/orgs/org/projects/project.js +++ b/ui/core/app/routes/orgs/org/projects/project.js @@ -38,7 +38,7 @@ export default class OrgsOrgProjectsProjectRoute extends Route { this.render('orgs/org/projects/project/_sidebar', { into: 'orgs/org', outlet: 'sidebar', - model: model + model: model, }); super.renderTemplate(...arguments); } diff --git a/ui/core/app/routes/orgs/org/projects/project/host-catalogs.js b/ui/core/app/routes/orgs/org/projects/project/host-catalogs.js index eacc28056..685266cb4 100644 --- a/ui/core/app/routes/orgs/org/projects/project/host-catalogs.js +++ b/ui/core/app/routes/orgs/org/projects/project/host-catalogs.js @@ -1,7 +1,6 @@ import Route from '@ember/routing/route'; export default class OrgsOrgProjectsProjectHostCatalogsRoute extends Route { - // =methods /** diff --git a/ui/core/app/routes/orgs/org/projects/project/host-catalogs/host-catalog.js b/ui/core/app/routes/orgs/org/projects/project/host-catalogs/host-catalog.js index ace30520a..47d79f7bb 100644 --- a/ui/core/app/routes/orgs/org/projects/project/host-catalogs/host-catalog.js +++ b/ui/core/app/routes/orgs/org/projects/project/host-catalogs/host-catalog.js @@ -3,7 +3,6 @@ import { inject as service } from '@ember/service'; import { action } from '@ember/object'; export default class OrgsOrgProjectsProjectHostCatalogsHostCatalogRoute extends Route { - // =services @service notify; @@ -63,5 +62,4 @@ export default class OrgsOrgProjectsProjectHostCatalogsHostCatalogRoute extends this.notify.error(error.message, { closeAfter: null }); } } - } diff --git a/ui/core/app/routes/orgs/org/projects/project/host-catalogs/host-catalog/index.js b/ui/core/app/routes/orgs/org/projects/project/host-catalogs/host-catalog/index.js index ffba38db4..a4ba3aa0e 100644 --- a/ui/core/app/routes/orgs/org/projects/project/host-catalogs/host-catalog/index.js +++ b/ui/core/app/routes/orgs/org/projects/project/host-catalogs/host-catalog/index.js @@ -1,4 +1,3 @@ import Route from '@ember/routing/route'; -export default class OrgsOrgProjectsProjectHostCatalogsHostCatalogIndexRoute extends Route { -} +export default class OrgsOrgProjectsProjectHostCatalogsHostCatalogIndexRoute extends Route {} diff --git a/ui/core/app/routes/orgs/org/projects/project/host-catalogs/index.js b/ui/core/app/routes/orgs/org/projects/project/host-catalogs/index.js index a29543a30..b760aed44 100644 --- a/ui/core/app/routes/orgs/org/projects/project/host-catalogs/index.js +++ b/ui/core/app/routes/orgs/org/projects/project/host-catalogs/index.js @@ -1,4 +1,3 @@ import Route from '@ember/routing/route'; -export default class OrgsOrgProjectsProjectHostCatalogsIndexRoute extends Route { -} +export default class OrgsOrgProjectsProjectHostCatalogsIndexRoute extends Route {} diff --git a/ui/core/app/routes/orgs/org/projects/project/host-catalogs/new.js b/ui/core/app/routes/orgs/org/projects/project/host-catalogs/new.js index a2f4e2bc6..c2c224e88 100644 --- a/ui/core/app/routes/orgs/org/projects/project/host-catalogs/new.js +++ b/ui/core/app/routes/orgs/org/projects/project/host-catalogs/new.js @@ -39,7 +39,10 @@ export default class OrgsOrgProjectsProjectHostCatalogsNewRoute extends Route { async save(hostCatalog) { try { await hostCatalog.save(); - this.transitionTo('orgs.org.projects.project.host-catalogs.host-catalog', hostCatalog); + this.transitionTo( + 'orgs.org.projects.project.host-catalogs.host-catalog', + hostCatalog + ); // TODO: replace with translated strings this.notify.success('Host catalog created.'); } catch (error) { diff --git a/ui/core/app/routes/orgs/org/projects/project/index.js b/ui/core/app/routes/orgs/org/projects/project/index.js index 0843242d7..0fc6b90b7 100644 --- a/ui/core/app/routes/orgs/org/projects/project/index.js +++ b/ui/core/app/routes/orgs/org/projects/project/index.js @@ -1,4 +1,3 @@ import Route from '@ember/routing/route'; -export default class OrgsOrgProjectsProjectIndexRoute extends Route { -} +export default class OrgsOrgProjectsProjectIndexRoute extends Route {} diff --git a/ui/core/app/routes/orgs/org/roles.js b/ui/core/app/routes/orgs/org/roles.js index 807c2aeee..972aaf816 100644 --- a/ui/core/app/routes/orgs/org/roles.js +++ b/ui/core/app/routes/orgs/org/roles.js @@ -10,5 +10,4 @@ export default class OrgsOrgRolesRoute extends Route { model() { return this.store.findAll('role'); } - } diff --git a/ui/core/app/routes/orgs/org/users/index.js b/ui/core/app/routes/orgs/org/users/index.js index b6203b0d4..b3047d27e 100644 --- a/ui/core/app/routes/orgs/org/users/index.js +++ b/ui/core/app/routes/orgs/org/users/index.js @@ -1,4 +1,3 @@ import Route from '@ember/routing/route'; -export default class OrgsOrgUsersIndexRoute extends Route { -} +export default class OrgsOrgUsersIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes.js b/ui/core/app/routes/scopes.js index 5fff74b2e..59fc29266 100644 --- a/ui/core/app/routes/scopes.js +++ b/ui/core/app/routes/scopes.js @@ -1,4 +1,3 @@ import Route from '@ember/routing/route'; -export default class ScopesRoute extends Route { -} +export default class ScopesRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope.js b/ui/core/app/routes/scopes/scope.js index 8cde487bd..ac03641c7 100644 --- a/ui/core/app/routes/scopes/scope.js +++ b/ui/core/app/routes/scopes/scope.js @@ -1,7 +1,6 @@ import Route from '@ember/routing/route'; export default class ScopesScopeRoute extends Route { - // =methods /** @@ -24,5 +23,4 @@ export default class ScopesScopeRoute extends Route { return maybeExistingScope || this.store.createRecord('scope', { id }); } } - } diff --git a/ui/core/app/routes/scopes/scope/projects.js b/ui/core/app/routes/scopes/scope/projects.js index ebc5e97e5..775dc5ad6 100644 --- a/ui/core/app/routes/scopes/scope/projects.js +++ b/ui/core/app/routes/scopes/scope/projects.js @@ -3,7 +3,6 @@ import { inject as service } from '@ember/service'; import { action } from '@ember/object'; export default class ScopesScopeProjectsRoute extends Route { - // =services @service notify; @@ -82,5 +81,4 @@ export default class ScopesScopeProjectsRoute extends Route { this.notify.error(error.message, { closeAfter: null }); } } - } diff --git a/ui/core/app/routes/scopes/scope/projects/index.js b/ui/core/app/routes/scopes/scope/projects/index.js index 294371052..d763c183c 100644 --- a/ui/core/app/routes/scopes/scope/projects/index.js +++ b/ui/core/app/routes/scopes/scope/projects/index.js @@ -1,4 +1,3 @@ import Route from '@ember/routing/route'; -export default class ScopesScopeProjectsIndexRoute extends Route { -} +export default class ScopesScopeProjectsIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/projects/new.js b/ui/core/app/routes/scopes/scope/projects/new.js index 1781f5269..207ca3dbc 100644 --- a/ui/core/app/routes/scopes/scope/projects/new.js +++ b/ui/core/app/routes/scopes/scope/projects/new.js @@ -1,7 +1,6 @@ import Route from '@ember/routing/route'; export default class ScopesScopeProjectsNewRoute extends Route { - // =methods /** @@ -12,8 +11,7 @@ export default class ScopesScopeProjectsNewRoute extends Route { const { id } = this.modelFor('scopes.scope'); return this.store.createRecord('scope', { type: 'project', - scopeID: id + scopeID: id, }); } - } diff --git a/ui/core/app/routes/scopes/scope/projects/project.js b/ui/core/app/routes/scopes/scope/projects/project.js index c2aee8ed3..a418f3291 100644 --- a/ui/core/app/routes/scopes/scope/projects/project.js +++ b/ui/core/app/routes/scopes/scope/projects/project.js @@ -1,7 +1,6 @@ import Route from '@ember/routing/route'; export default class ScopesScopeProjectsProjectRoute extends Route { - // =methods /** @@ -13,5 +12,4 @@ export default class ScopesScopeProjectsProjectRoute extends Route { model({ project_id }) { return this.store.findRecord('scope', project_id); } - } diff --git a/ui/core/app/routes/scopes/scope/projects/project/index.js b/ui/core/app/routes/scopes/scope/projects/project/index.js index f5511f2e7..a004bac08 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/index.js +++ b/ui/core/app/routes/scopes/scope/projects/project/index.js @@ -1,4 +1,3 @@ import Route from '@ember/routing/route'; -export default class ScopesScopeProjectsProjectIndexRoute extends Route { -} +export default class ScopesScopeProjectsProjectIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/users.js b/ui/core/app/routes/scopes/scope/users.js new file mode 100644 index 000000000..2720f56b1 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/users.js @@ -0,0 +1,73 @@ +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; +import { action } from '@ember/object'; + +export default class ScopesScopeUsersRoute extends Route { + // =services + + @service intl; + @service notify; + + // =methods + + /** + * Load all users under current scope. + * @return {Promise{[UserModel]}} + */ + async model() { + return this.store.findAll('user', this.scopeAdapterOptions()); + } + + // =actions + /** + * Rollback changes on user. + * @param {UserModel} user + */ + @action + cancel(user) { + const { isNew } = user; + user.rollbackAttributes(); + if (isNew) this.transitionTo('scopes.scope.users'); + } + + /** + * Save a user in current scope. + * @param {UserModel} user + * @param {Event} e + */ + @action + async save(user) { + try { + await user.save(this.scopeAdapterOptions()); + this.refresh(); + this.notify.success(this.intl.t('notify.save-success')); + this.transitionTo('scopes.scope.users.user', user); + } catch (error) { + // TODO: replace with translated strings + this.notify.error(error.message, { closeAfter: null }); + } + } + + /** + * Delete user in current scope and redirect to index. + * @param {UserModel} user + */ + @action + async delete(user) { + try { + await user.destroyRecord(this.scopeAdapterOptions()); + this.refresh(); + this.transitionTo('scopes.scope.users'); + this.notify.success(this.intl.t('notify.delete-success')); + } catch (error) { + // TODO: replace with translated strings + this.notify.error(error.message, { closeAfter: null }); + } + } + + scopeAdapterOptions() { + const { id: scope_id } = this.modelFor('scopes.scope'); + const adapterOptions = { scopeID: scope_id }; + return { adapterOptions }; + } +} diff --git a/ui/core/app/routes/scopes/scope/users/index.js b/ui/core/app/routes/scopes/scope/users/index.js new file mode 100644 index 000000000..f59170106 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/users/index.js @@ -0,0 +1,3 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeUsersIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/users/new.js b/ui/core/app/routes/scopes/scope/users/new.js new file mode 100644 index 000000000..9b486a48b --- /dev/null +++ b/ui/core/app/routes/scopes/scope/users/new.js @@ -0,0 +1,13 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeUsersNewRoute extends Route { + // =methods + + /** + * Creates a new unsaved user. + * @return {UserModel} + */ + model() { + return this.store.createRecord('user'); + } +} diff --git a/ui/core/app/routes/scopes/scope/users/user.js b/ui/core/app/routes/scopes/scope/users/user.js new file mode 100644 index 000000000..f28ff4d56 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/users/user.js @@ -0,0 +1,17 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeUsersUserRoute extends Route { + // =methods + + /** + * Load a user in current scope. + * @param {object} params + * @param {string} params.user_id + * @return {UserModel} + */ + async model({ user_id }) { + const { id: scope_id } = this.modelFor('scopes.scope'); + const adapterOptions = { scopeID: scope_id }; + return this.store.findRecord('user', user_id, { adapterOptions }); + } +} diff --git a/ui/core/app/routes/scopes/scope/users/user/index.js b/ui/core/app/routes/scopes/scope/users/user/index.js new file mode 100644 index 000000000..fde042f35 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/users/user/index.js @@ -0,0 +1,3 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeUsersUserIndexRoute extends Route {} diff --git a/ui/core/app/templates/scopes/scope.hbs b/ui/core/app/templates/scopes/scope.hbs index 2d1a73607..ee969738f 100644 --- a/ui/core/app/templates/scopes/scope.hbs +++ b/ui/core/app/templates/scopes/scope.hbs @@ -8,8 +8,14 @@ + + + {{t "resources.users"}} + + + {{outlet "sidebar"}} - + {{!-- diff --git a/ui/core/app/templates/scopes/scope/users.hbs b/ui/core/app/templates/scopes/scope/users.hbs new file mode 100644 index 000000000..67ccbeb9e --- /dev/null +++ b/ui/core/app/templates/scopes/scope/users.hbs @@ -0,0 +1,3 @@ +{{title (t "resources.users")}} + +{{outlet}} diff --git a/ui/core/app/templates/scopes/scope/users/index.hbs b/ui/core/app/templates/scopes/scope/users/index.hbs new file mode 100644 index 000000000..1ee0f3ac2 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/users/index.hbs @@ -0,0 +1,63 @@ + + + + + + + +

{{t "resources.users"}}

+
+ + + {{#if @model}} + {{t 'titles.new'}} + {{/if}} + + + + + {{#if @model}} + + + + + {{t 'form.label.name'}} + {{t 'form.label.description'}} + + + + {{#each @model as |user|}} + + + + {{user.name}} + + + {{user.description}} + + {{/each}} + + + + {{else}} + + + + + {{t 'descriptions.users-welcome'}} + + + + {{t 'titles.new'}} + + + + + {{/if}} + + + +
diff --git a/ui/core/app/templates/scopes/scope/users/new.hbs b/ui/core/app/templates/scopes/scope/users/new.hbs new file mode 100644 index 000000000..08e72531c --- /dev/null +++ b/ui/core/app/templates/scopes/scope/users/new.hbs @@ -0,0 +1,21 @@ +{{title (t 'titles.new')}} + + + + + + + + +

{{t "titles.new"}}

+
+ + + + + +
diff --git a/ui/core/app/templates/scopes/scope/users/user.hbs b/ui/core/app/templates/scopes/scope/users/user.hbs new file mode 100644 index 000000000..d66e83390 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/users/user.hbs @@ -0,0 +1,3 @@ +{{title @model.displayName}} + +{{outlet}} diff --git a/ui/core/app/templates/scopes/scope/users/user/index.hbs b/ui/core/app/templates/scopes/scope/users/user/index.hbs new file mode 100644 index 000000000..d80978336 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/users/user/index.hbs @@ -0,0 +1,35 @@ + + + + + + + +

{{t "resources.user"}}

+
+ + + + + {{t 'titles.details'}} + + + + + + + + + {{t 'actions.delete'}} + + + +
diff --git a/ui/core/tests/acceptance/bread-crumbs-test.js b/ui/core/tests/acceptance/bread-crumbs-test.js index 7c33595e9..2575f1c75 100644 --- a/ui/core/tests/acceptance/bread-crumbs-test.js +++ b/ui/core/tests/acceptance/bread-crumbs-test.js @@ -55,109 +55,176 @@ module('Acceptance | breadcrumbs', function (hooks) { assert.expect(3); await visit(projectURL); assert.equal(currentURL(), projectURL, 'We begin on the expected page.'); - crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname; + crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href) + .pathname; assert.equal(crumbPath, projectURL, 'Last crumb has expected URL.'); await click(find('.rose-nav-breadcrumbs-link:first-child')); - assert.equal(currentURL(), projectsURL, 'After navigating via breadcrumbs, we are one level up.'); + assert.equal( + currentURL(), + projectsURL, + 'After navigating via breadcrumbs, we are one level up.' + ); }); test('can navigate via breadcrumbs to projects from new project', async function (assert) { assert.expect(3); await visit(newProjectURL); assert.equal(currentURL(), newProjectURL, 'We begin on the expected page.'); - crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname; + crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href) + .pathname; assert.equal(crumbPath, newProjectURL, 'Last crumb has expected URL.'); await click(find('.rose-nav-breadcrumbs-link:first-child')); - assert.equal(currentURL(), projectsURL, 'After navigating via breadcrumbs, we are one level up.'); + assert.equal( + currentURL(), + projectsURL, + 'After navigating via breadcrumbs, we are one level up.' + ); }); test('can navigate via breadcrumbs to project from host catalogs', async function (assert) { assert.expect(3); await visit(hostCatalogsURL); - assert.equal(currentURL(), hostCatalogsURL, 'We begin on the expected page.'); - crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname; + assert.equal( + currentURL(), + hostCatalogsURL, + 'We begin on the expected page.' + ); + crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href) + .pathname; assert.equal(crumbPath, hostCatalogsURL, 'Last crumb has expected URL.'); await click(findAll('.rose-nav-breadcrumbs-link')[1]); - assert.equal(currentURL(), projectURL, 'After navigating via breadcrumbs, we are one level up.'); + assert.equal( + currentURL(), + projectURL, + 'After navigating via breadcrumbs, we are one level up.' + ); }); test('can navigate via breadcrumbs to host catalogs from host catalog', async function (assert) { assert.expect(3); await visit(hostCatalogURL); - assert.equal(currentURL(), hostCatalogURL, 'We begin on the expected page.'); - crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname; + assert.equal( + currentURL(), + hostCatalogURL, + 'We begin on the expected page.' + ); + crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href) + .pathname; assert.equal(crumbPath, hostCatalogURL, 'Last crumb has expected URL.'); await click(findAll('.rose-nav-breadcrumbs-link')[2]); - assert.equal(currentURL(), hostCatalogsURL, 'After navigating via breadcrumbs, we are one level up.'); + assert.equal( + currentURL(), + hostCatalogsURL, + 'After navigating via breadcrumbs, we are one level up.' + ); }); test('can navigate via breadcrumbs to host catalogs from new host catalog', async function (assert) { assert.expect(3); await visit(newHostCatalogURL); - assert.equal(currentURL(), newHostCatalogURL, 'We begin on the expected page.'); - crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname; + assert.equal( + currentURL(), + newHostCatalogURL, + 'We begin on the expected page.' + ); + crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href) + .pathname; assert.equal(crumbPath, newHostCatalogURL, 'Last crumb has expected URL.'); await click(findAll('.rose-nav-breadcrumbs-link')[2]); - assert.equal(currentURL(), hostCatalogsURL, 'After navigating via breadcrumbs, we are one level up.'); + assert.equal( + currentURL(), + hostCatalogsURL, + 'After navigating via breadcrumbs, we are one level up.' + ); }); test('can navigate via breadcrumbs to roles from role', async function (assert) { assert.expect(3); await visit(roleURL); assert.equal(currentURL(), roleURL, 'We begin on the expected page.'); - crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname; + crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href) + .pathname; assert.equal(crumbPath, roleURL, 'Last crumb has expected URL.'); await click(find('.rose-nav-breadcrumbs-link:first-child')); - assert.equal(currentURL(), rolesURL, 'After navigating via breadcrumbs, we are one level up.'); + assert.equal( + currentURL(), + rolesURL, + 'After navigating via breadcrumbs, we are one level up.' + ); }); test('can navigate via breadcrumbs to roles from new role', async function (assert) { assert.expect(3); await visit(newRoleURL); assert.equal(currentURL(), newRoleURL, 'We begin on the expected page.'); - crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname; + crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href) + .pathname; assert.equal(crumbPath, newRoleURL, 'Last crumb has expected URL.'); await click(find('.rose-nav-breadcrumbs-link:first-child')); - assert.equal(currentURL(), rolesURL, 'After navigating via breadcrumbs, we are one level up.'); + assert.equal( + currentURL(), + rolesURL, + 'After navigating via breadcrumbs, we are one level up.' + ); }); test('can navigate via breadcrumbs to groups from group', async function (assert) { assert.expect(3); await visit(groupURL); assert.equal(currentURL(), groupURL, 'We begin on the expected page.'); - crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname; + crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href) + .pathname; assert.equal(crumbPath, groupURL, 'Last crumb has expected URL.'); await click(find('.rose-nav-breadcrumbs-link:first-child')); - assert.equal(currentURL(), groupsURL, 'After navigating via breadcrumbs, we are one level up.'); + assert.equal( + currentURL(), + groupsURL, + 'After navigating via breadcrumbs, we are one level up.' + ); }); test('can navigate via breadcrumbs to groups from new group', async function (assert) { assert.expect(3); await visit(newGroupURL); assert.equal(currentURL(), newGroupURL, 'We begin on the expected page.'); - crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname; + crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href) + .pathname; assert.equal(crumbPath, newGroupURL, 'Last crumb has expected URL.'); await click(find('.rose-nav-breadcrumbs-link:first-child')); - assert.equal(currentURL(), groupsURL, 'After navigating via breadcrumbs, we are one level up.'); + assert.equal( + currentURL(), + groupsURL, + 'After navigating via breadcrumbs, we are one level up.' + ); }); test('can navigate via breadcrumbs to users from user', async function (assert) { assert.expect(3); await visit(userURL); assert.equal(currentURL(), userURL, 'We begin on the expected page.'); - crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname; + crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href) + .pathname; assert.equal(crumbPath, userURL, 'Last crumb has expected URL.'); await click(find('.rose-nav-breadcrumbs-link:first-child')); - assert.equal(currentURL(), usersURL, 'After navigating via breadcrumbs, we are one level up.'); + assert.equal( + currentURL(), + usersURL, + 'After navigating via breadcrumbs, we are one level up.' + ); }); test('can navigate via breadcrumbs to users from new user', async function (assert) { assert.expect(3); await visit(newUserURL); assert.equal(currentURL(), newUserURL, 'We begin on th expected page.'); - crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname; + crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href) + .pathname; assert.equal(crumbPath, newUserURL, 'Last crumb has expected URL.'); await click(find('.rose-nav-breadcrumbs-link:first-child')); - assert.equal(currentURL(), usersURL, 'After navigating via breadcrumbs, we are one level up.'); + assert.equal( + currentURL(), + usersURL, + 'After navigating via breadcrumbs, we are one level up.' + ); }); }); diff --git a/ui/core/tests/acceptance/groups-test.js b/ui/core/tests/acceptance/groups-test.js index 7f3f2ec69..5564f9d62 100644 --- a/ui/core/tests/acceptance/groups-test.js +++ b/ui/core/tests/acceptance/groups-test.js @@ -5,8 +5,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; import a11yAudit from 'ember-a11y-testing/test-support/audit'; import { Response } from 'miragejs'; - -module('Acceptance | groups', function(hooks) { +module('Acceptance | groups', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); @@ -80,7 +79,7 @@ module('Acceptance | groups', function(hooks) { test('can save changes to an existing group', async function (assert) { assert.expect(2); - this.server.createList('group', 1, {name: 'Admin group'}); + this.server.createList('group', 1, { name: 'Admin group' }); await visit('/orgs/1/groups/1'); await fillIn('[name="name"]', 'Updated admin group'); await click('.rose-form-actions [type="submit"]'); @@ -90,14 +89,14 @@ module('Acceptance | groups', function(hooks) { test('can cancel changes to an existing group', async function (assert) { assert.expect(1); - this.server.createList('group', 1, {name: 'Admin group'}); + this.server.createList('group', 1, { name: 'Admin group' }); await visit('/orgs/1/groups/1'); await fillIn('[name="name"]', 'Updated admin group'); await click('.rose-form-actions [type="button"]'); assert.equal(find('[name="name"]').value, 'Admin group'); }); - test('can delete a group', async function(assert) { + test('can delete a group', async function (assert) { assert.expect(2); this.server.createList('group', 1); assert.equal(this.server.db.groups.length, 1); diff --git a/ui/core/tests/acceptance/host-catalogs-test.js b/ui/core/tests/acceptance/host-catalogs-test.js index 4be43309f..a2684e694 100644 --- a/ui/core/tests/acceptance/host-catalogs-test.js +++ b/ui/core/tests/acceptance/host-catalogs-test.js @@ -5,7 +5,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; import a11yAudit from 'ember-a11y-testing/test-support/audit'; import { Response } from 'miragejs'; -module('Acceptance | host catalogs', function(hooks) { +module('Acceptance | host catalogs', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); @@ -22,7 +22,7 @@ module('Acceptance | host catalogs', function(hooks) { assert.equal(currentURL(), '/orgs/1/projects/1/host-catalogs'); }); - test('can navigate to host catalog form', async function(assert) { + test('can navigate to host catalog form', async function (assert) { assert.expect(1); this.server.createList('project', 1); this.server.createList('host-catalog', 1); @@ -32,7 +32,7 @@ module('Acceptance | host catalogs', function(hooks) { assert.equal(currentURL(), '/orgs/1/projects/1/host-catalogs/1'); }); - test('can delete host catalog', async function(assert) { + test('can delete host catalog', async function (assert) { assert.expect(2); this.server.createList('project', 1); this.server.createList('host-catalog', 1); @@ -42,7 +42,7 @@ module('Acceptance | host catalogs', function(hooks) { assert.equal(this.server.db.hostCatalogs.length, 0); }); - test('can update host catalog and save changes', async function(assert) { + test('can update host catalog and save changes', async function (assert) { assert.expect(1); this.server.createList('project', 1); this.server.createList('host-catalog', 1); @@ -52,7 +52,7 @@ module('Acceptance | host catalogs', function(hooks) { assert.equal(this.server.db.hostCatalogs[0].name, 'Test Name'); }); - test('can update host catalog and cancel changes', async function(assert) { + test('can update host catalog and cancel changes', async function (assert) { assert.expect(1); this.server.createList('project', 1); this.server.createList('host-catalog', 1); @@ -62,7 +62,7 @@ module('Acceptance | host catalogs', function(hooks) { assert.notEqual(this.server.db.hostCatalogs[0].name, 'Test Name'); }); - test('can create host catalog and save changes', async function(assert) { + test('can create host catalog and save changes', async function (assert) { assert.expect(2); this.server.createList('project', 1); await visit('/orgs/1/projects/1/host-catalogs/new'); @@ -72,7 +72,7 @@ module('Acceptance | host catalogs', function(hooks) { assert.equal(currentURL(), '/orgs/1/projects/1/host-catalogs/1'); }); - test('can create host catalog and cancel changes', async function(assert) { + test('can create host catalog and cancel changes', async function (assert) { assert.expect(2); this.server.createList('project', 1); await visit('/orgs/1/projects/1/host-catalogs/new'); @@ -86,17 +86,20 @@ module('Acceptance | host catalogs', function(hooks) { assert.expect(1); this.server.createList('project', 1); this.server.createList('host-catalog', 1); - this.server.patch('/orgs/:org_id/projects/:project_id/host-catalogs/:id', () => { - return new Response( - 490, - {}, - { - status: 490, - code: 'error', - message: 'Oops.', - } - ); - }); + this.server.patch( + '/orgs/:org_id/projects/:project_id/host-catalogs/:id', + () => { + return new Response( + 490, + {}, + { + status: 490, + code: 'error', + message: 'Oops.', + } + ); + } + ); await visit('/orgs/1/projects/1/host-catalogs/1'); await fillIn('[name="name"]', 'random string'); await click('form [type="submit"]'); @@ -112,17 +115,20 @@ module('Acceptance | host catalogs', function(hooks) { assert.expect(1); this.server.createList('project', 1); this.server.createList('host-catalog', 1); - this.server.del('/orgs/:org_id/projects/:project_id/host-catalogs/:id', () => { - return new Response( - 490, - {}, - { - status: 490, - code: 'error', - message: 'Oops.', - } - ); - }); + this.server.del( + '/orgs/:org_id/projects/:project_id/host-catalogs/:id', + () => { + return new Response( + 490, + {}, + { + status: 490, + code: 'error', + message: 'Oops.', + } + ); + } + ); await visit('/orgs/1/projects/1/host-catalogs/1'); await click('.rose-button-warning'); await a11yAudit(); @@ -175,25 +181,28 @@ module('Acceptance | host catalogs', function(hooks) { assert.expect(2); this.server.createList('project', 1); this.server.createList('host-catalog', 1); - this.server.patch('/orgs/:org_id/projects/:project_id/host-catalogs/:id', () => { - return new Response( - 400, - {}, - { - status: 400, - code: 'invalid_argument', - message: 'The request was invalid.', - details: { - fields: [ - { - name: 'name', - message: 'Name is required.', - }, - ], - }, - } - ); - }); + this.server.patch( + '/orgs/:org_id/projects/:project_id/host-catalogs/:id', + () => { + return new Response( + 400, + {}, + { + status: 400, + code: 'invalid_argument', + message: 'The request was invalid.', + details: { + fields: [ + { + name: 'name', + message: 'Name is required.', + }, + ], + }, + } + ); + } + ); await visit('/orgs/1/projects/1/host-catalogs/1'); await fillIn('[name="name"]', 'random string'); await click('form [type="submit"]'); @@ -209,5 +218,4 @@ module('Acceptance | host catalogs', function(hooks) { 'Displays field-level errors.' ); }); - }); diff --git a/ui/core/tests/acceptance/projects-test.js b/ui/core/tests/acceptance/projects-test.js index 57ba7c17e..bfa87857c 100644 --- a/ui/core/tests/acceptance/projects-test.js +++ b/ui/core/tests/acceptance/projects-test.js @@ -20,9 +20,11 @@ module('Acceptance | projects', function (hooks) { let initialProjectScopesCount; hooks.beforeEach(function () { - org = this.server.create('scope', {type: 'org'}, 'withChildren'); - getProjectScopesCount = () => this.server.schema.scopes.where({type: 'project'}).length; - getFirstProjectScope = () => this.server.schema.scopes.where({type: 'project'}).models[0]; + org = this.server.create('scope', { type: 'org' }, 'withChildren'); + getProjectScopesCount = () => + this.server.schema.scopes.where({ type: 'project' }).length; + getFirstProjectScope = () => + this.server.schema.scopes.where({ type: 'project' }).models[0]; initialProjectScopesCount = getProjectScopesCount(); orgID = org.id; projectsURL = `/scopes/${orgID}/projects`; @@ -44,7 +46,11 @@ module('Acceptance | projects', function (hooks) { assert.notEqual(wrongProjectsURL, projectsURL); await visit(wrongProjectsURL); await a11yAudit(); - assert.equal(currentURL(), projectsURL, 'Wrong projects path was redirected to correct path.'); + assert.equal( + currentURL(), + projectsURL, + 'Wrong projects path was redirected to correct path.' + ); }); test('can create new projects', async function (assert) { @@ -119,7 +125,7 @@ module('Acceptance | projects', function (hooks) { assert.equal(find('[name="name"]').value, existingProject.name); }); - test('can delete project', async function(assert) { + test('can delete project', async function (assert) { assert.expect(1); await visit(existingProjectURL); await click('.rose-button-warning'); diff --git a/ui/core/tests/acceptance/roles-test.js b/ui/core/tests/acceptance/roles-test.js index 976ba47b7..038d367ae 100644 --- a/ui/core/tests/acceptance/roles-test.js +++ b/ui/core/tests/acceptance/roles-test.js @@ -79,7 +79,7 @@ module('Acceptance | roles', function (hooks) { test('can save changes to an existing role', async function (assert) { assert.expect(2); - this.server.createList('role', 1, {name: 'Admin role'}); + this.server.createList('role', 1, { name: 'Admin role' }); await visit('/orgs/1/roles/1'); await fillIn('[name="name"]', 'Updated admin role'); await click('.rose-form-actions [type="submit"]'); @@ -89,14 +89,14 @@ module('Acceptance | roles', function (hooks) { test('can cancel changes to an existing role', async function (assert) { assert.expect(1); - this.server.createList('role', 1, {name: 'Admin role'}); + this.server.createList('role', 1, { name: 'Admin role' }); await visit('/orgs/1/roles/1'); await fillIn('[name="name"]', 'Updated admin role'); await click('.rose-form-actions [type="button"]'); assert.equal(find('[name="name"]').value, 'Admin role'); }); - test('can delete a role', async function(assert) { + test('can delete a role', async function (assert) { assert.expect(2); this.server.createList('role', 1); assert.equal(this.server.db.roles.length, 1); diff --git a/ui/core/tests/acceptance/users-test.js b/ui/core/tests/acceptance/users-test.js index f1160c7f3..af68f19bc 100644 --- a/ui/core/tests/acceptance/users-test.js +++ b/ui/core/tests/acceptance/users-test.js @@ -5,7 +5,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; import a11yAudit from 'ember-a11y-testing/test-support/audit'; import { Response } from 'miragejs'; -module('Acceptance | users', function(hooks) { +module('Acceptance | users', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); @@ -80,7 +80,7 @@ module('Acceptance | users', function(hooks) { test('can save changes to an existing user', async function (assert) { assert.expect(2); - this.server.createList('user', 1, {name: 'Test User'}); + this.server.createList('user', 1, { name: 'Test User' }); await visit('/orgs/1/users/1'); await fillIn('[name="name"]', 'Updated user name'); await click('.rose-form-actions [type="submit"]'); @@ -90,14 +90,14 @@ module('Acceptance | users', function(hooks) { test('can cancel changes to an existing user', async function (assert) { assert.expect(1); - this.server.createList('user', 1, {name: 'Test User'}); + this.server.createList('user', 1, { name: 'Test User' }); await visit('/orgs/1/users/1'); await fillIn('[name="name"]', 'Unsaved user name'); await click('.rose-form-actions [type="button"]'); assert.equal(find('[name="name"]').value, 'Test User'); }); - test('can delete an user', async function(assert) { + test('can delete an user', async function (assert) { assert.expect(2); this.server.createList('user', 1); assert.equal(this.server.db.users.length, 1); diff --git a/ui/core/tests/integration/components/bread-crumbs-test.js b/ui/core/tests/integration/components/bread-crumbs-test.js index a6f3579c8..2e59085cb 100644 --- a/ui/core/tests/integration/components/bread-crumbs-test.js +++ b/ui/core/tests/integration/components/bread-crumbs-test.js @@ -3,11 +3,11 @@ import { setupRenderingTest } from 'ember-qunit'; import { render, find, findAll } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; -module('Integration | Component | bread-crumbs', function(hooks) { +module('Integration | Component | bread-crumbs', function (hooks) { setupRenderingTest(hooks); - test('it renders', async function(assert) { - this.set('breadCrumbs', [{label: 'Level 1'}]); + test('it renders', async function (assert) { + this.set('breadCrumbs', [{ label: 'Level 1' }]); await render(hbs``); // Default index route @@ -15,28 +15,34 @@ module('Integration | Component | bread-crumbs', function(hooks) { assert.equal(find('.rose-nav-breadcrumbs').textContent.trim(), 'Level 1'); }); - test('it renders with model', async function(assert) { + test('it renders with model', async function (assert) { let store = this.owner.lookup('service:store'); - let project = store.createRecord('project', {id: '1234'}); + let project = store.createRecord('project', { id: '1234' }); - this.set('breadCrumbs', [{ - label: 'Level 2', - path: 'orgs.org.projects.project', - model: project - }]); + this.set('breadCrumbs', [ + { + label: 'Level 2', + path: 'orgs.org.projects.project', + model: project, + }, + ]); await render(hbs``); assert.equal(find('.rose-nav-breadcrumbs').textContent.trim(), 'Level 2'); }); - test('it renders multiple breadCrumbs', async function(assert) { - this.set('breadCrumbs', [{ - label: 'Level 1' - },{ - label: 'Level 2' - }, { - label: 'Level 3' - }]); + test('it renders multiple breadCrumbs', async function (assert) { + this.set('breadCrumbs', [ + { + label: 'Level 1', + }, + { + label: 'Level 2', + }, + { + label: 'Level 3', + }, + ]); await render(hbs``); assert.equal(findAll('a').length, 3); diff --git a/ui/core/tests/integration/components/form/host-catalog-test.js b/ui/core/tests/integration/components/form/host-catalog-test.js index 0e3b51865..20dbd545f 100644 --- a/ui/core/tests/integration/components/form/host-catalog-test.js +++ b/ui/core/tests/integration/components/form/host-catalog-test.js @@ -3,10 +3,10 @@ import { setupRenderingTest } from 'ember-qunit'; import { render, find } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; -module('Integration | Component | form/host-catalog', function(hooks) { +module('Integration | Component | form/host-catalog', function (hooks) { setupRenderingTest(hooks); - test('it renders', async function(assert) { + test('it renders', async function (assert) { // Set any properties with this.set('myProperty', 'value'); // Handle any actions with this.set('myAction', function(val) { ... }); this.submit = () => {}; diff --git a/ui/core/tests/unit/controllers/orgs/org/groups-test.js b/ui/core/tests/unit/controllers/orgs/org/groups-test.js index 0ca58eed0..338abe601 100644 --- a/ui/core/tests/unit/controllers/orgs/org/groups-test.js +++ b/ui/core/tests/unit/controllers/orgs/org/groups-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | orgs/org/groups', function(hooks) { +module('Unit | Controller | orgs/org/groups', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:orgs/org/groups'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/orgs/org/groups/group-test.js b/ui/core/tests/unit/controllers/orgs/org/groups/group-test.js index 49cf5b3a6..c49531dfb 100644 --- a/ui/core/tests/unit/controllers/orgs/org/groups/group-test.js +++ b/ui/core/tests/unit/controllers/orgs/org/groups/group-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | orgs/org/groups/group', function(hooks) { +module('Unit | Controller | orgs/org/groups/group', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:orgs/org/groups/group'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/orgs/org/groups/new-test.js b/ui/core/tests/unit/controllers/orgs/org/groups/new-test.js index ef02542c9..a85f11078 100644 --- a/ui/core/tests/unit/controllers/orgs/org/groups/new-test.js +++ b/ui/core/tests/unit/controllers/orgs/org/groups/new-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | orgs/org/groups/new', function(hooks) { +module('Unit | Controller | orgs/org/groups/new', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:orgs/org/groups/new'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/orgs/org/projects-test.js b/ui/core/tests/unit/controllers/orgs/org/projects-test.js index 6176a173c..c4d200e50 100644 --- a/ui/core/tests/unit/controllers/orgs/org/projects-test.js +++ b/ui/core/tests/unit/controllers/orgs/org/projects-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | orgs/org/projects', function(hooks) { +module('Unit | Controller | orgs/org/projects', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:orgs/org/projects'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/orgs/org/projects/new-test.js b/ui/core/tests/unit/controllers/orgs/org/projects/new-test.js index 9e3731313..055c60a9f 100644 --- a/ui/core/tests/unit/controllers/orgs/org/projects/new-test.js +++ b/ui/core/tests/unit/controllers/orgs/org/projects/new-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | orgs/org/projects/new', function(hooks) { +module('Unit | Controller | orgs/org/projects/new', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:orgs/org/projects/new'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/orgs/org/projects/project-test.js b/ui/core/tests/unit/controllers/orgs/org/projects/project-test.js index 36a2c2482..067429ee5 100644 --- a/ui/core/tests/unit/controllers/orgs/org/projects/project-test.js +++ b/ui/core/tests/unit/controllers/orgs/org/projects/project-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | orgs/org/projects/project', function(hooks) { +module('Unit | Controller | orgs/org/projects/project', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:orgs/org/projects/project'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/orgs/org/projects/project/host-catalogs-test.js b/ui/core/tests/unit/controllers/orgs/org/projects/project/host-catalogs-test.js index 808f14138..6127a3173 100644 --- a/ui/core/tests/unit/controllers/orgs/org/projects/project/host-catalogs-test.js +++ b/ui/core/tests/unit/controllers/orgs/org/projects/project/host-catalogs-test.js @@ -1,12 +1,16 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | orgs/org/projects/project/host-catalogs', function(hooks) { +module('Unit | Controller | orgs/org/projects/project/host-catalogs', function ( + hooks +) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { - let controller = this.owner.lookup('controller:orgs/org/projects/project/host-catalogs'); + test('it exists', function (assert) { + let controller = this.owner.lookup( + 'controller:orgs/org/projects/project/host-catalogs' + ); assert.ok(controller); }); }); diff --git a/ui/core/tests/unit/controllers/orgs/org/projects/project/host-catalogs/host-catalog-test.js b/ui/core/tests/unit/controllers/orgs/org/projects/project/host-catalogs/host-catalog-test.js index 4efc4b85c..38b3a9c9d 100644 --- a/ui/core/tests/unit/controllers/orgs/org/projects/project/host-catalogs/host-catalog-test.js +++ b/ui/core/tests/unit/controllers/orgs/org/projects/project/host-catalogs/host-catalog-test.js @@ -1,12 +1,17 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | orgs/org/projects/project/host-catalogs/host-catalog', function(hooks) { - setupTest(hooks); +module( + 'Unit | Controller | orgs/org/projects/project/host-catalogs/host-catalog', + function (hooks) { + setupTest(hooks); - // Replace this with your real tests. - test('it exists', function(assert) { - let controller = this.owner.lookup('controller:orgs/org/projects/project/host-catalogs/host-catalog'); - assert.ok(controller); - }); -}); + // Replace this with your real tests. + test('it exists', function (assert) { + let controller = this.owner.lookup( + 'controller:orgs/org/projects/project/host-catalogs/host-catalog' + ); + assert.ok(controller); + }); + } +); diff --git a/ui/core/tests/unit/controllers/orgs/org/projects/project/host-catalogs/new-test.js b/ui/core/tests/unit/controllers/orgs/org/projects/project/host-catalogs/new-test.js index 1981e1857..ee0f326a1 100644 --- a/ui/core/tests/unit/controllers/orgs/org/projects/project/host-catalogs/new-test.js +++ b/ui/core/tests/unit/controllers/orgs/org/projects/project/host-catalogs/new-test.js @@ -1,12 +1,17 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | orgs/org/projects/project/host-catalogs/new', function(hooks) { - setupTest(hooks); +module( + 'Unit | Controller | orgs/org/projects/project/host-catalogs/new', + function (hooks) { + setupTest(hooks); - // Replace this with your real tests. - test('it exists', function(assert) { - let controller = this.owner.lookup('controller:orgs/org/projects/project/host-catalogs/new'); - assert.ok(controller); - }); -}); + // Replace this with your real tests. + test('it exists', function (assert) { + let controller = this.owner.lookup( + 'controller:orgs/org/projects/project/host-catalogs/new' + ); + assert.ok(controller); + }); + } +); diff --git a/ui/core/tests/unit/controllers/orgs/org/roles-test.js b/ui/core/tests/unit/controllers/orgs/org/roles-test.js index 816459cd3..12c57a108 100644 --- a/ui/core/tests/unit/controllers/orgs/org/roles-test.js +++ b/ui/core/tests/unit/controllers/orgs/org/roles-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | orgs/org/roles', function(hooks) { +module('Unit | Controller | orgs/org/roles', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:orgs/org/roles'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/orgs/org/roles/new-test.js b/ui/core/tests/unit/controllers/orgs/org/roles/new-test.js index 8d948ae06..c9e4cfcc8 100644 --- a/ui/core/tests/unit/controllers/orgs/org/roles/new-test.js +++ b/ui/core/tests/unit/controllers/orgs/org/roles/new-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | orgs/org/roles/new', function(hooks) { +module('Unit | Controller | orgs/org/roles/new', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:orgs/org/roles/new'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/orgs/org/roles/role-test.js b/ui/core/tests/unit/controllers/orgs/org/roles/role-test.js index cd56c941f..515ae8420 100644 --- a/ui/core/tests/unit/controllers/orgs/org/roles/role-test.js +++ b/ui/core/tests/unit/controllers/orgs/org/roles/role-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | orgs/org/roles/role', function(hooks) { +module('Unit | Controller | orgs/org/roles/role', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:orgs/org/roles/role'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/orgs/org/users-test.js b/ui/core/tests/unit/controllers/orgs/org/users-test.js index c5be2fb52..5f0c57d8c 100644 --- a/ui/core/tests/unit/controllers/orgs/org/users-test.js +++ b/ui/core/tests/unit/controllers/orgs/org/users-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | orgs/org/users', function(hooks) { +module('Unit | Controller | orgs/org/users', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:orgs/org/users'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/orgs/org/users/new-test.js b/ui/core/tests/unit/controllers/orgs/org/users/new-test.js index e6925b4d7..80a7e1890 100644 --- a/ui/core/tests/unit/controllers/orgs/org/users/new-test.js +++ b/ui/core/tests/unit/controllers/orgs/org/users/new-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | orgs/org/users/new', function(hooks) { +module('Unit | Controller | orgs/org/users/new', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:orgs/org/users/new'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/orgs/org/users/user-test.js b/ui/core/tests/unit/controllers/orgs/org/users/user-test.js index f35f620fa..e16d4ab6b 100644 --- a/ui/core/tests/unit/controllers/orgs/org/users/user-test.js +++ b/ui/core/tests/unit/controllers/orgs/org/users/user-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | orgs/org/users/user', function(hooks) { +module('Unit | Controller | orgs/org/users/user', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:orgs/org/users/user'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects-test.js index 21125f233..052687cd2 100644 --- a/ui/core/tests/unit/controllers/scopes/scope/projects-test.js +++ b/ui/core/tests/unit/controllers/scopes/scope/projects-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | scopes/scope/projects', function(hooks) { +module('Unit | Controller | scopes/scope/projects', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:scopes/scope/projects'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/new-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/new-test.js index eeb857274..8da2a6f6d 100644 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/new-test.js +++ b/ui/core/tests/unit/controllers/scopes/scope/projects/new-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | scopes/scope/projects/new', function(hooks) { +module('Unit | Controller | scopes/scope/projects/new', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:scopes/scope/projects/new'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project-test.js index 26a255430..ee20af93d 100644 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/project-test.js +++ b/ui/core/tests/unit/controllers/scopes/scope/projects/project-test.js @@ -1,12 +1,14 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | scopes/scope/projects/project', function(hooks) { +module('Unit | Controller | scopes/scope/projects/project', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { - let controller = this.owner.lookup('controller:scopes/scope/projects/project'); + test('it exists', function (assert) { + let controller = this.owner.lookup( + 'controller:scopes/scope/projects/project' + ); assert.ok(controller); }); }); diff --git a/ui/core/tests/unit/routes/orgs/org/groups-test.js b/ui/core/tests/unit/routes/orgs/org/groups-test.js index a56f69e76..465afedcd 100644 --- a/ui/core/tests/unit/routes/orgs/org/groups-test.js +++ b/ui/core/tests/unit/routes/orgs/org/groups-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/groups', function(hooks) { +module('Unit | Route | orgs/org/groups', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:orgs/org/groups'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/orgs/org/groups/group-test.js b/ui/core/tests/unit/routes/orgs/org/groups/group-test.js index cec8245a8..ca6107bc1 100644 --- a/ui/core/tests/unit/routes/orgs/org/groups/group-test.js +++ b/ui/core/tests/unit/routes/orgs/org/groups/group-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/groups/group', function(hooks) { +module('Unit | Route | orgs/org/groups/group', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:orgs/org/groups/group'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/orgs/org/groups/group/index-test.js b/ui/core/tests/unit/routes/orgs/org/groups/group/index-test.js index 2496b24bf..e0c5c06d4 100644 --- a/ui/core/tests/unit/routes/orgs/org/groups/group/index-test.js +++ b/ui/core/tests/unit/routes/orgs/org/groups/group/index-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/groups/group/index', function(hooks) { +module('Unit | Route | orgs/org/groups/group/index', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:orgs/org/groups/group/index'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/orgs/org/groups/index-test.js b/ui/core/tests/unit/routes/orgs/org/groups/index-test.js index c2f9135eb..60c10cfef 100644 --- a/ui/core/tests/unit/routes/orgs/org/groups/index-test.js +++ b/ui/core/tests/unit/routes/orgs/org/groups/index-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/groups/index', function(hooks) { +module('Unit | Route | orgs/org/groups/index', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:orgs/org/groups/index'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/orgs/org/groups/new-test.js b/ui/core/tests/unit/routes/orgs/org/groups/new-test.js index 09f10c831..e119c3d53 100644 --- a/ui/core/tests/unit/routes/orgs/org/groups/new-test.js +++ b/ui/core/tests/unit/routes/orgs/org/groups/new-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/groups/new', function(hooks) { +module('Unit | Route | orgs/org/groups/new', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:orgs/org/groups/new'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs-test.js b/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs-test.js index f7c144429..761c0bfa8 100644 --- a/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs-test.js +++ b/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs-test.js @@ -1,11 +1,15 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/projects/project/host-catalogs', function(hooks) { +module('Unit | Route | orgs/org/projects/project/host-catalogs', function ( + hooks +) { setupTest(hooks); - test('it exists', function(assert) { - let route = this.owner.lookup('route:orgs/org/projects/project/host-catalogs'); + test('it exists', function (assert) { + let route = this.owner.lookup( + 'route:orgs/org/projects/project/host-catalogs' + ); assert.ok(route); }); }); diff --git a/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs/host-catalog-test.js b/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs/host-catalog-test.js index 6313bc8f0..5dd167f8a 100644 --- a/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs/host-catalog-test.js +++ b/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs/host-catalog-test.js @@ -1,11 +1,16 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/projects/project/host-catalogs/host-catalog', function(hooks) { - setupTest(hooks); +module( + 'Unit | Route | orgs/org/projects/project/host-catalogs/host-catalog', + function (hooks) { + setupTest(hooks); - test('it exists', function(assert) { - let route = this.owner.lookup('route:orgs/org/projects/project/host-catalogs/host-catalog'); - assert.ok(route); - }); -}); + test('it exists', function (assert) { + let route = this.owner.lookup( + 'route:orgs/org/projects/project/host-catalogs/host-catalog' + ); + assert.ok(route); + }); + } +); diff --git a/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs/host-catalog/index-test.js b/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs/host-catalog/index-test.js index a19bd70e9..1472a5b92 100644 --- a/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs/host-catalog/index-test.js +++ b/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs/host-catalog/index-test.js @@ -1,11 +1,16 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/projects/project/host-catalogs/host-catalog/index', function(hooks) { - setupTest(hooks); +module( + 'Unit | Route | orgs/org/projects/project/host-catalogs/host-catalog/index', + function (hooks) { + setupTest(hooks); - test('it exists', function(assert) { - let route = this.owner.lookup('route:orgs/org/projects/project/host-catalogs/host-catalog/index'); - assert.ok(route); - }); -}); + test('it exists', function (assert) { + let route = this.owner.lookup( + 'route:orgs/org/projects/project/host-catalogs/host-catalog/index' + ); + assert.ok(route); + }); + } +); diff --git a/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs/index-test.js b/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs/index-test.js index d8a8d036e..0d7a5e317 100644 --- a/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs/index-test.js +++ b/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs/index-test.js @@ -1,11 +1,16 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/projects/project/host-catalogs/index', function(hooks) { - setupTest(hooks); +module( + 'Unit | Route | orgs/org/projects/project/host-catalogs/index', + function (hooks) { + setupTest(hooks); - test('it exists', function(assert) { - let route = this.owner.lookup('route:orgs/org/projects/project/host-catalogs/index'); - assert.ok(route); - }); -}); + test('it exists', function (assert) { + let route = this.owner.lookup( + 'route:orgs/org/projects/project/host-catalogs/index' + ); + assert.ok(route); + }); + } +); diff --git a/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs/new-test.js b/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs/new-test.js index 2529656b7..8b441cfd6 100644 --- a/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs/new-test.js +++ b/ui/core/tests/unit/routes/orgs/org/projects/project/host-catalogs/new-test.js @@ -1,11 +1,15 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/projects/project/host-catalogs/new', function(hooks) { +module('Unit | Route | orgs/org/projects/project/host-catalogs/new', function ( + hooks +) { setupTest(hooks); - test('it exists', function(assert) { - let route = this.owner.lookup('route:orgs/org/projects/project/host-catalogs/new'); + test('it exists', function (assert) { + let route = this.owner.lookup( + 'route:orgs/org/projects/project/host-catalogs/new' + ); assert.ok(route); }); }); diff --git a/ui/core/tests/unit/routes/orgs/org/projects/project/index-test.js b/ui/core/tests/unit/routes/orgs/org/projects/project/index-test.js index bc1d36103..08f446f6f 100644 --- a/ui/core/tests/unit/routes/orgs/org/projects/project/index-test.js +++ b/ui/core/tests/unit/routes/orgs/org/projects/project/index-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/projects/project/index', function(hooks) { +module('Unit | Route | orgs/org/projects/project/index', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:orgs/org/projects/project/index'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/orgs/org/roles-test.js b/ui/core/tests/unit/routes/orgs/org/roles-test.js index 38bc3acb2..7cd35dab6 100644 --- a/ui/core/tests/unit/routes/orgs/org/roles-test.js +++ b/ui/core/tests/unit/routes/orgs/org/roles-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/roles', function(hooks) { +module('Unit | Route | orgs/org/roles', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:orgs/org/roles'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/orgs/org/roles/index-test.js b/ui/core/tests/unit/routes/orgs/org/roles/index-test.js index 12f247adb..979d26062 100644 --- a/ui/core/tests/unit/routes/orgs/org/roles/index-test.js +++ b/ui/core/tests/unit/routes/orgs/org/roles/index-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/roles/index', function(hooks) { +module('Unit | Route | orgs/org/roles/index', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:orgs/org/roles/index'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/orgs/org/roles/new-test.js b/ui/core/tests/unit/routes/orgs/org/roles/new-test.js index d613eb34a..59e26a949 100644 --- a/ui/core/tests/unit/routes/orgs/org/roles/new-test.js +++ b/ui/core/tests/unit/routes/orgs/org/roles/new-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/roles/new', function(hooks) { +module('Unit | Route | orgs/org/roles/new', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:orgs/org/roles/new'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/orgs/org/roles/role-test.js b/ui/core/tests/unit/routes/orgs/org/roles/role-test.js index 149fd657e..207a79ea2 100644 --- a/ui/core/tests/unit/routes/orgs/org/roles/role-test.js +++ b/ui/core/tests/unit/routes/orgs/org/roles/role-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/roles/role', function(hooks) { +module('Unit | Route | orgs/org/roles/role', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:orgs/org/roles/role'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/orgs/org/users-test.js b/ui/core/tests/unit/routes/orgs/org/users-test.js index 93956225b..b4c420690 100644 --- a/ui/core/tests/unit/routes/orgs/org/users-test.js +++ b/ui/core/tests/unit/routes/orgs/org/users-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/users', function(hooks) { +module('Unit | Route | orgs/org/users', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:orgs/org/users'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/orgs/org/users/index-test.js b/ui/core/tests/unit/routes/orgs/org/users/index-test.js index cd215662e..21310f7a1 100644 --- a/ui/core/tests/unit/routes/orgs/org/users/index-test.js +++ b/ui/core/tests/unit/routes/orgs/org/users/index-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/users/index', function(hooks) { +module('Unit | Route | orgs/org/users/index', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:orgs/org/users/index'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/orgs/org/users/new-test.js b/ui/core/tests/unit/routes/orgs/org/users/new-test.js index 1aef05bab..395979cad 100644 --- a/ui/core/tests/unit/routes/orgs/org/users/new-test.js +++ b/ui/core/tests/unit/routes/orgs/org/users/new-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/users/new', function(hooks) { +module('Unit | Route | orgs/org/users/new', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:orgs/org/users/new'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/orgs/org/users/user-test.js b/ui/core/tests/unit/routes/orgs/org/users/user-test.js index 4bd6f26a2..48a657875 100644 --- a/ui/core/tests/unit/routes/orgs/org/users/user-test.js +++ b/ui/core/tests/unit/routes/orgs/org/users/user-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | orgs/org/users/user', function(hooks) { +module('Unit | Route | orgs/org/users/user', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:orgs/org/users/user'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/scopes-test.js b/ui/core/tests/unit/routes/scopes-test.js index 06a5af092..914469429 100644 --- a/ui/core/tests/unit/routes/scopes-test.js +++ b/ui/core/tests/unit/routes/scopes-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | scopes', function(hooks) { +module('Unit | Route | scopes', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:scopes'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/scopes/scope-test.js b/ui/core/tests/unit/routes/scopes/scope-test.js index 62c97d9f0..3cdcf409a 100644 --- a/ui/core/tests/unit/routes/scopes/scope-test.js +++ b/ui/core/tests/unit/routes/scopes/scope-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | scopes/scope', function(hooks) { +module('Unit | Route | scopes/scope', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:scopes/scope'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects-test.js b/ui/core/tests/unit/routes/scopes/scope/projects-test.js index 4a8dde55f..127213dac 100644 --- a/ui/core/tests/unit/routes/scopes/scope/projects-test.js +++ b/ui/core/tests/unit/routes/scopes/scope/projects-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | scopes/scope/projects', function(hooks) { +module('Unit | Route | scopes/scope/projects', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:scopes/scope/projects'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/index-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/index-test.js index 71c813a35..74a15f224 100644 --- a/ui/core/tests/unit/routes/scopes/scope/projects/index-test.js +++ b/ui/core/tests/unit/routes/scopes/scope/projects/index-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | scopes/scope/projects/index', function(hooks) { +module('Unit | Route | scopes/scope/projects/index', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:scopes/scope/projects/index'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/new-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/new-test.js index 6d22e1fa7..8c28e87b5 100644 --- a/ui/core/tests/unit/routes/scopes/scope/projects/new-test.js +++ b/ui/core/tests/unit/routes/scopes/scope/projects/new-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | scopes/scope/projects/new', function(hooks) { +module('Unit | Route | scopes/scope/projects/new', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:scopes/scope/projects/new'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project-test.js index 54555a07c..ed0ffe51a 100644 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project-test.js +++ b/ui/core/tests/unit/routes/scopes/scope/projects/project-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | scopes/scope/projects/project', function(hooks) { +module('Unit | Route | scopes/scope/projects/project', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:scopes/scope/projects/project'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/index-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/index-test.js index c81b2f5a7..f14370229 100644 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/index-test.js +++ b/ui/core/tests/unit/routes/scopes/scope/projects/project/index-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | scopes/scope/projects/project/index', function(hooks) { +module('Unit | Route | scopes/scope/projects/project/index', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:scopes/scope/projects/project/index'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/scopes/scope/users-test.js b/ui/core/tests/unit/routes/scopes/scope/users-test.js new file mode 100644 index 000000000..12f7813b1 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/users-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/users', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup('route:scopes/scope/users'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/users/index-test.js b/ui/core/tests/unit/routes/scopes/scope/users/index-test.js new file mode 100644 index 000000000..f2c453604 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/users/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/users/index', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup('route:scopes/scope/users/index'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/users/new-test.js b/ui/core/tests/unit/routes/scopes/scope/users/new-test.js new file mode 100644 index 000000000..147af3ba2 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/users/new-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/users/new', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup('route:scopes/scope/users/new'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/users/user-test.js b/ui/core/tests/unit/routes/scopes/scope/users/user-test.js new file mode 100644 index 000000000..69f34e847 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/users/user-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/users/user', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup('route:scopes/scope/users/user'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/users/user/index-test.js b/ui/core/tests/unit/routes/scopes/scope/users/user/index-test.js new file mode 100644 index 000000000..21302ee4b --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/users/user/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/users/user/index', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup('route:scopes/scope/users/user/index'); + assert.ok(route); + }); +}); From 79d024c07c8dacd92a5fda15b9bb1daecb95d445 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Mon, 27 Jul 2020 16:42:02 -0400 Subject: [PATCH 02/13] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Refactor=20group?= =?UTF-8?q?=20CRUD+L=20to=20/scopes/:scope=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/core/app/router.js | 4 ++ ui/core/app/routes/scopes/scope/groups.js | 72 +++++++++++++++++++ .../app/routes/scopes/scope/groups/group.js | 17 +++++ .../routes/scopes/scope/groups/group/index.js | 3 + .../app/routes/scopes/scope/groups/index.js | 3 + ui/core/app/routes/scopes/scope/groups/new.js | 13 ++++ ui/core/app/routes/scopes/scope/users.js | 4 +- ui/core/app/templates/scopes/scope.hbs | 3 + ui/core/app/templates/scopes/scope/groups.hbs | 3 + .../templates/scopes/scope/groups/group.hbs | 3 + .../scopes/scope/groups/group/index.hbs | 35 +++++++++ .../templates/scopes/scope/groups/index.hbs | 63 ++++++++++++++++ .../app/templates/scopes/scope/groups/new.hbs | 21 ++++++ .../unit/routes/scopes/scope/groups-test.js | 11 +++ .../routes/scopes/scope/groups/group-test.js | 11 +++ .../scopes/scope/groups/group/index-test.js | 11 +++ .../routes/scopes/scope/groups/index-test.js | 11 +++ .../routes/scopes/scope/groups/new-test.js | 11 +++ 18 files changed, 297 insertions(+), 2 deletions(-) create mode 100644 ui/core/app/routes/scopes/scope/groups.js create mode 100644 ui/core/app/routes/scopes/scope/groups/group.js create mode 100644 ui/core/app/routes/scopes/scope/groups/group/index.js create mode 100644 ui/core/app/routes/scopes/scope/groups/index.js create mode 100644 ui/core/app/routes/scopes/scope/groups/new.js create mode 100644 ui/core/app/templates/scopes/scope/groups.hbs create mode 100644 ui/core/app/templates/scopes/scope/groups/group.hbs create mode 100644 ui/core/app/templates/scopes/scope/groups/group/index.hbs create mode 100644 ui/core/app/templates/scopes/scope/groups/index.hbs create mode 100644 ui/core/app/templates/scopes/scope/groups/new.hbs create mode 100644 ui/core/tests/unit/routes/scopes/scope/groups-test.js create mode 100644 ui/core/tests/unit/routes/scopes/scope/groups/group-test.js create mode 100644 ui/core/tests/unit/routes/scopes/scope/groups/group/index-test.js create mode 100644 ui/core/tests/unit/routes/scopes/scope/groups/index-test.js create mode 100644 ui/core/tests/unit/routes/scopes/scope/groups/new-test.js diff --git a/ui/core/app/router.js b/ui/core/app/router.js index 1c3e3e78b..0e7e5f7f7 100644 --- a/ui/core/app/router.js +++ b/ui/core/app/router.js @@ -17,6 +17,10 @@ Router.map(function () { this.route('user', { path: ':user_id' }, function () {}); this.route('new'); }); + this.route('groups', function () { + this.route('group', { path: ':group_id' }, function () {}); + this.route('new'); + }); }); }); diff --git a/ui/core/app/routes/scopes/scope/groups.js b/ui/core/app/routes/scopes/scope/groups.js new file mode 100644 index 000000000..0344e53f1 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/groups.js @@ -0,0 +1,72 @@ +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; +import { action } from '@ember/object'; + +export default class ScopesScopeGroupsRoute extends Route { + // =services + + @service intl; + @service notify; + + // =methods + + /** + * Load all groups under current scope + * @return {Promise[GroupModel]} + */ + async model() { + return this.store.findAll('group', this.scopeAdapterOptions()); + } + + // =actions + /** + * Rollback changes on a group. + * @param {GroupModel} group + */ + @action + cancel(group) { + const { isNew } = group; + group.rollbackAttributes(); + if (isNew) this.transitionTo('scopes.scope.groups'); + } + + /** + * Save a group in current scope. + * @param {GroupModel} group + */ + @action + async save(group) { + try { + await group.save(this.scopeAdapterOptions()); + this.refresh(); + this.notify.success(this.intl.t('notify.save-success')); + this.transitionTo('scopes.scope.groups.group', group); + } catch (error) { + //TODO: replace with translated strings + this.notify.error(error.message, { closeAfter: null }); + } + } + + /** + * Delete a group in current scope and redirect to index + * @param {GroupModel} group + */ + @action + async delete(group) { + try { + await group.destroyRecord(this.scopeAdapterOptions()); + this.refresh(); + this.transitionTo('scopes.scope.groups'); + this.notify.success(this.intl.t('notify.group.delete-success')); + } catch (error) { + //TODO: replace with translated strings + this.notify.error(error.message, { closeAfter: null }); + } + } + + scopeAdapterOptions() { + const { id: scope_id } = this.modelFor('scopes.scope'); + const adapterOptions = { scopeID: scope_id }; + return { adapterOptions }; + } +} diff --git a/ui/core/app/routes/scopes/scope/groups/group.js b/ui/core/app/routes/scopes/scope/groups/group.js new file mode 100644 index 000000000..da536ed07 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/groups/group.js @@ -0,0 +1,17 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeGroupsGroupRoute extends Route { + // =methods + + /** + * Load a group in current scope. + * @param {object} params + * @param {string} params.group_id + * @return {groupModel} + */ + async model({ group_id }) { + const { id: scope_id } = this.modelFor('scopes.scope'); + const adapterOptions = { scopeID: scope_id }; + return this.store.findRecord('group', group_id, { adapterOptions }); + } +} diff --git a/ui/core/app/routes/scopes/scope/groups/group/index.js b/ui/core/app/routes/scopes/scope/groups/group/index.js new file mode 100644 index 000000000..90f0fb3a1 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/groups/group/index.js @@ -0,0 +1,3 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeGroupsGroupIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/groups/index.js b/ui/core/app/routes/scopes/scope/groups/index.js new file mode 100644 index 000000000..7d2a20fb0 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/groups/index.js @@ -0,0 +1,3 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeGroupsIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/groups/new.js b/ui/core/app/routes/scopes/scope/groups/new.js new file mode 100644 index 000000000..e33233f5f --- /dev/null +++ b/ui/core/app/routes/scopes/scope/groups/new.js @@ -0,0 +1,13 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeGroupsNewRoute extends Route { + // =methods + + /** + * Creates a new unsaved group. + * @return {GroupModel} + */ + model() { + return this.store.createRecord('group'); + } +} diff --git a/ui/core/app/routes/scopes/scope/users.js b/ui/core/app/routes/scopes/scope/users.js index 2720f56b1..bf0ba95c4 100644 --- a/ui/core/app/routes/scopes/scope/users.js +++ b/ui/core/app/routes/scopes/scope/users.js @@ -20,7 +20,7 @@ export default class ScopesScopeUsersRoute extends Route { // =actions /** - * Rollback changes on user. + * Rollback changes on an user. * @param {UserModel} user */ @action @@ -31,7 +31,7 @@ export default class ScopesScopeUsersRoute extends Route { } /** - * Save a user in current scope. + * Save an user in current scope. * @param {UserModel} user * @param {Event} e */ diff --git a/ui/core/app/templates/scopes/scope.hbs b/ui/core/app/templates/scopes/scope.hbs index ee969738f..f3199821b 100644 --- a/ui/core/app/templates/scopes/scope.hbs +++ b/ui/core/app/templates/scopes/scope.hbs @@ -12,6 +12,9 @@ {{t "resources.users"}} + + {{t "resources.groups"}} +
{{outlet "sidebar"}} diff --git a/ui/core/app/templates/scopes/scope/groups.hbs b/ui/core/app/templates/scopes/scope/groups.hbs new file mode 100644 index 000000000..c53da7f4b --- /dev/null +++ b/ui/core/app/templates/scopes/scope/groups.hbs @@ -0,0 +1,3 @@ +{{title (t "resources.groups")}} + +{{outlet}} diff --git a/ui/core/app/templates/scopes/scope/groups/group.hbs b/ui/core/app/templates/scopes/scope/groups/group.hbs new file mode 100644 index 000000000..d66e83390 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/groups/group.hbs @@ -0,0 +1,3 @@ +{{title @model.displayName}} + +{{outlet}} diff --git a/ui/core/app/templates/scopes/scope/groups/group/index.hbs b/ui/core/app/templates/scopes/scope/groups/group/index.hbs new file mode 100644 index 000000000..ac8915f59 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/groups/group/index.hbs @@ -0,0 +1,35 @@ + + + + + + + +

{{t "resources.group"}}

+
+ + + + + {{t 'titles.details'}} + + + + + + + + + {{t 'actions.delete'}} + + + +
diff --git a/ui/core/app/templates/scopes/scope/groups/index.hbs b/ui/core/app/templates/scopes/scope/groups/index.hbs new file mode 100644 index 000000000..cddaa478b --- /dev/null +++ b/ui/core/app/templates/scopes/scope/groups/index.hbs @@ -0,0 +1,63 @@ + + + + + + + +

{{t "resources.groups"}}

+
+ + + {{#if @model}} + {{t 'titles.new'}} + {{/if}} + + + + + {{#if @model}} + + + + + {{t 'form.label.name'}} + {{t 'form.label.description'}} + + + + {{#each @model as |group|}} + + + + {{group.name}} + + + {{group.description}} + + {{/each}} + + + + {{else}} + + + + + {{t 'descriptions.groups-welcome'}} + + + + {{t 'titles.new'}} + + + + + {{/if}} + + + +
diff --git a/ui/core/app/templates/scopes/scope/groups/new.hbs b/ui/core/app/templates/scopes/scope/groups/new.hbs new file mode 100644 index 000000000..b8f782b23 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/groups/new.hbs @@ -0,0 +1,21 @@ +{{title (t 'titles.new')}} + + + + + + + + +

{{t "titles.new"}}

+
+ + + + + +
diff --git a/ui/core/tests/unit/routes/scopes/scope/groups-test.js b/ui/core/tests/unit/routes/scopes/scope/groups-test.js new file mode 100644 index 000000000..879a3925b --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/groups-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/groups', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup('route:scopes/scope/groups'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/groups/group-test.js b/ui/core/tests/unit/routes/scopes/scope/groups/group-test.js new file mode 100644 index 000000000..8f8cc6713 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/groups/group-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/groups/group', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup('route:scopes/scope/groups/group'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/groups/group/index-test.js b/ui/core/tests/unit/routes/scopes/scope/groups/group/index-test.js new file mode 100644 index 000000000..3981831ad --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/groups/group/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/groups/group/index', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup('route:scopes/scope/groups/group/index'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/groups/index-test.js b/ui/core/tests/unit/routes/scopes/scope/groups/index-test.js new file mode 100644 index 000000000..f50de2922 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/groups/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/groups/index', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup('route:scopes/scope/groups/index'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/groups/new-test.js b/ui/core/tests/unit/routes/scopes/scope/groups/new-test.js new file mode 100644 index 000000000..6e689bdd3 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/groups/new-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/groups/new', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup('route:scopes/scope/groups/new'); + assert.ok(route); + }); +}); From 3ac5f766ff9e8ca040284e07a791e39a14d0277a Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Mon, 27 Jul 2020 16:51:41 -0400 Subject: [PATCH 03/13] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Refactor=20role?= =?UTF-8?q?=20CRUD+L=20under=20/scopes/:scope=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/core/app/router.js | 4 ++ ui/core/app/routes/scopes/scope/roles.js | 72 +++++++++++++++++++ .../app/routes/scopes/scope/roles/index.js | 3 + ui/core/app/routes/scopes/scope/roles/new.js | 13 ++++ ui/core/app/routes/scopes/scope/roles/role.js | 17 +++++ .../routes/scopes/scope/roles/role/index.js | 3 + ui/core/app/routes/scopes/scope/users.js | 2 +- ui/core/app/templates/scopes/scope.hbs | 3 + ui/core/app/templates/scopes/scope/roles.hbs | 3 + .../templates/scopes/scope/roles/index.hbs | 63 ++++++++++++++++ .../app/templates/scopes/scope/roles/new.hbs | 19 +++++ .../app/templates/scopes/scope/roles/role.hbs | 3 + .../scopes/scope/roles/role/index.hbs | 27 +++++++ .../unit/routes/scopes/scope/roles-test.js | 11 +++ .../routes/scopes/scope/roles/index-test.js | 11 +++ .../routes/scopes/scope/roles/new-test.js | 11 +++ .../routes/scopes/scope/roles/role-test.js | 11 +++ .../scopes/scope/roles/role/index-test.js | 11 +++ 18 files changed, 286 insertions(+), 1 deletion(-) create mode 100644 ui/core/app/routes/scopes/scope/roles.js create mode 100644 ui/core/app/routes/scopes/scope/roles/index.js create mode 100644 ui/core/app/routes/scopes/scope/roles/new.js create mode 100644 ui/core/app/routes/scopes/scope/roles/role.js create mode 100644 ui/core/app/routes/scopes/scope/roles/role/index.js create mode 100644 ui/core/app/templates/scopes/scope/roles.hbs create mode 100644 ui/core/app/templates/scopes/scope/roles/index.hbs create mode 100644 ui/core/app/templates/scopes/scope/roles/new.hbs create mode 100644 ui/core/app/templates/scopes/scope/roles/role.hbs create mode 100644 ui/core/app/templates/scopes/scope/roles/role/index.hbs create mode 100644 ui/core/tests/unit/routes/scopes/scope/roles-test.js create mode 100644 ui/core/tests/unit/routes/scopes/scope/roles/index-test.js create mode 100644 ui/core/tests/unit/routes/scopes/scope/roles/new-test.js create mode 100644 ui/core/tests/unit/routes/scopes/scope/roles/role-test.js create mode 100644 ui/core/tests/unit/routes/scopes/scope/roles/role/index-test.js diff --git a/ui/core/app/router.js b/ui/core/app/router.js index 0e7e5f7f7..accba55a0 100644 --- a/ui/core/app/router.js +++ b/ui/core/app/router.js @@ -21,6 +21,10 @@ Router.map(function () { this.route('group', { path: ':group_id' }, function () {}); this.route('new'); }); + this.route('roles', function () { + this.route('role', { path: ':role_id' }, function () {}); + this.route('new'); + }); }); }); diff --git a/ui/core/app/routes/scopes/scope/roles.js b/ui/core/app/routes/scopes/scope/roles.js new file mode 100644 index 000000000..fd451c719 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/roles.js @@ -0,0 +1,72 @@ +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; +import { action } from '@ember/object'; + +export default class ScopesScopeRolesRoute extends Route { + // =services + + @service intl; + @service notify; + + // =methods + + /** + * Load all roles under current scope. + * @return {Promise{[RoleModel]}} + */ + async model() { + return this.store.findAll('role', this.scopeAdapterOptions()); + } + + // =actions + /** + * Rollback changes on an role. + * @param {RoleModel} role + */ + @action + cancel(role) { + const { isNew } = role; + role.rollbackAttributes(); + if (isNew) this.transitionTo('scopes.scope.roles'); + } + + /** + * Save an role in current scope. + * @param {RoleModel} role + */ + @action + async save(role) { + try { + await role.save(this.scopeAdapterOptions()); + this.refresh(); + this.notify.success(this.intl.t('notify.save-success')); + this.transitionTo('scopes.scope.roles.role', role); + } catch (error) { + // TODO: replace with translated strings + this.notify.error(error.message, { closeAfter: null }); + } + } + + /** + * Delete role in current scope and redirect to index. + * @param {RoleModel} role + */ + @action + async delete(role) { + try { + await role.destroyRecord(this.scopeAdapterOptions()); + this.refresh(); + this.notify.success(this.intl.t('notify.role.delete-success')); + this.transitionTo('scopes.scope.roles'); + } catch (error) { + // TODO: replace with translated strings + this.notify.error(error.message, { closeAfter: null }); + } + } + + scopeAdapterOptions() { + const { id: scope_id } = this.modelFor('scopes.scope'); + const adapterOptions = { scopeID: scope_id }; + return { adapterOptions }; + } +} diff --git a/ui/core/app/routes/scopes/scope/roles/index.js b/ui/core/app/routes/scopes/scope/roles/index.js new file mode 100644 index 000000000..f2a8d7af1 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/roles/index.js @@ -0,0 +1,3 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeRolesIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/roles/new.js b/ui/core/app/routes/scopes/scope/roles/new.js new file mode 100644 index 000000000..f39f6e6c2 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/roles/new.js @@ -0,0 +1,13 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeRolesNewRoute extends Route { + // =methods + + /** + * Creates a new unsaved role. + * @return {RoleModel} + */ + model() { + return this.store.createRecord('role'); + } +} diff --git a/ui/core/app/routes/scopes/scope/roles/role.js b/ui/core/app/routes/scopes/scope/roles/role.js new file mode 100644 index 000000000..781bb4e47 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/roles/role.js @@ -0,0 +1,17 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeRolesRoleRoute extends Route { + // =methods + + /** + * Load a role in current scope. + * @param {object} params + * @param {string} params.role_id + * @return {RoleModel} + */ + async model({ role_id }) { + const { id: scope_id } = this.modelFor('scopes.scope'); + const adapterOptions = { scopeID: scope_id }; + return this.store.findRecord('role', role_id, { adapterOptions }); + } +} diff --git a/ui/core/app/routes/scopes/scope/roles/role/index.js b/ui/core/app/routes/scopes/scope/roles/role/index.js new file mode 100644 index 000000000..359e9c9f5 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/roles/role/index.js @@ -0,0 +1,3 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeRolesRoleIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/users.js b/ui/core/app/routes/scopes/scope/users.js index bf0ba95c4..8f4f65905 100644 --- a/ui/core/app/routes/scopes/scope/users.js +++ b/ui/core/app/routes/scopes/scope/users.js @@ -58,7 +58,7 @@ export default class ScopesScopeUsersRoute extends Route { await user.destroyRecord(this.scopeAdapterOptions()); this.refresh(); this.transitionTo('scopes.scope.users'); - this.notify.success(this.intl.t('notify.delete-success')); + this.notify.success(this.intl.t('notify.user.delete-success')); } catch (error) { // TODO: replace with translated strings this.notify.error(error.message, { closeAfter: null }); diff --git a/ui/core/app/templates/scopes/scope.hbs b/ui/core/app/templates/scopes/scope.hbs index f3199821b..55e35d7e0 100644 --- a/ui/core/app/templates/scopes/scope.hbs +++ b/ui/core/app/templates/scopes/scope.hbs @@ -15,6 +15,9 @@ {{t "resources.groups"}} + + {{t "resources.roles"}} + {{outlet "sidebar"}} diff --git a/ui/core/app/templates/scopes/scope/roles.hbs b/ui/core/app/templates/scopes/scope/roles.hbs new file mode 100644 index 000000000..6d511b7f7 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/roles.hbs @@ -0,0 +1,3 @@ +{{title (t "resources.roles")}} + +{{outlet}} diff --git a/ui/core/app/templates/scopes/scope/roles/index.hbs b/ui/core/app/templates/scopes/scope/roles/index.hbs new file mode 100644 index 000000000..e0e28cf9a --- /dev/null +++ b/ui/core/app/templates/scopes/scope/roles/index.hbs @@ -0,0 +1,63 @@ + + + + + + + +

{{t "resources.roles"}}

+
+ + + {{#if @model}} + {{t 'titles.new'}} + {{/if}} + + + + + {{#if @model}} + + + + + {{t 'form.label.name'}} + {{t 'form.label.description'}} + + + + {{#each @model as |role|}} + + + + {{role.displayName}} + + + {{role.description}} + + {{/each}} + + + + {{else}} + + + + + {{t 'descriptions.roles-welcome'}} + + + + {{t 'titles.new'}} + + + + + {{/if}} + + + +
diff --git a/ui/core/app/templates/scopes/scope/roles/new.hbs b/ui/core/app/templates/scopes/scope/roles/new.hbs new file mode 100644 index 000000000..efddd8fb9 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/roles/new.hbs @@ -0,0 +1,19 @@ +{{title (t 'titles.new')}} + + + + + + + +

{{t "titles.new"}}

+
+ + + + +
diff --git a/ui/core/app/templates/scopes/scope/roles/role.hbs b/ui/core/app/templates/scopes/scope/roles/role.hbs new file mode 100644 index 000000000..d66e83390 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/roles/role.hbs @@ -0,0 +1,3 @@ +{{title @model.displayName}} + +{{outlet}} diff --git a/ui/core/app/templates/scopes/scope/roles/role/index.hbs b/ui/core/app/templates/scopes/scope/roles/role/index.hbs new file mode 100644 index 000000000..1b35c1929 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/roles/role/index.hbs @@ -0,0 +1,27 @@ + + + + + + + +

{{t "resources.role"}}

+
+ + + + + + {{t 'actions.delete'}} + + + +
diff --git a/ui/core/tests/unit/routes/scopes/scope/roles-test.js b/ui/core/tests/unit/routes/scopes/scope/roles-test.js new file mode 100644 index 000000000..f2aa633ee --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/roles-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/roles', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup('route:scopes/scope/roles'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/roles/index-test.js b/ui/core/tests/unit/routes/scopes/scope/roles/index-test.js new file mode 100644 index 000000000..aad8dd94c --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/roles/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/roles/index', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup('route:scopes/scope/roles/index'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/roles/new-test.js b/ui/core/tests/unit/routes/scopes/scope/roles/new-test.js new file mode 100644 index 000000000..1ddf02ba6 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/roles/new-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/roles/new', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup('route:scopes/scope/roles/new'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/roles/role-test.js b/ui/core/tests/unit/routes/scopes/scope/roles/role-test.js new file mode 100644 index 000000000..41e292c3c --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/roles/role-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/roles/role', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup('route:scopes/scope/roles/role'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/roles/role/index-test.js b/ui/core/tests/unit/routes/scopes/scope/roles/role/index-test.js new file mode 100644 index 000000000..1a4aecbf1 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/roles/role/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/roles/role/index', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup('route:scopes/scope/roles/role/index'); + assert.ok(route); + }); +}); From d2a4cc3f551579b41561d84f88419f674f2e5e7a Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Mon, 27 Jul 2020 17:32:33 -0400 Subject: [PATCH 04/13] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Refactor=20IAM=20?= =?UTF-8?q?breadcrumbs=20under=20/scopes/:scope=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/core/app/controllers/scopes/scope/groups.js | 18 ++++++++++++++++++ .../controllers/scopes/scope/groups/group.js | 13 +++++++++++++ .../app/controllers/scopes/scope/groups/new.js | 18 ++++++++++++++++++ ui/core/app/controllers/scopes/scope/roles.js | 18 ++++++++++++++++++ .../app/controllers/scopes/scope/roles/new.js | 18 ++++++++++++++++++ .../app/controllers/scopes/scope/roles/role.js | 13 +++++++++++++ ui/core/app/controllers/scopes/scope/users.js | 18 ++++++++++++++++++ .../app/controllers/scopes/scope/users/new.js | 18 ++++++++++++++++++ .../app/controllers/scopes/scope/users/user.js | 13 +++++++++++++ ui/core/mirage/config.js | 2 +- .../controllers/scopes/scope/groups-test.js | 12 ++++++++++++ .../scopes/scope/groups/group-test.js | 12 ++++++++++++ .../scopes/scope/groups/new-test.js | 12 ++++++++++++ .../controllers/scopes/scope/roles-test.js | 12 ++++++++++++ .../controllers/scopes/scope/roles/new-test.js | 12 ++++++++++++ .../scopes/scope/roles/role-test.js | 12 ++++++++++++ .../controllers/scopes/scope/users-test.js | 12 ++++++++++++ .../controllers/scopes/scope/users/new-test.js | 12 ++++++++++++ .../scopes/scope/users/user-test.js | 12 ++++++++++++ 19 files changed, 256 insertions(+), 1 deletion(-) create mode 100644 ui/core/app/controllers/scopes/scope/groups.js create mode 100644 ui/core/app/controllers/scopes/scope/groups/group.js create mode 100644 ui/core/app/controllers/scopes/scope/groups/new.js create mode 100644 ui/core/app/controllers/scopes/scope/roles.js create mode 100644 ui/core/app/controllers/scopes/scope/roles/new.js create mode 100644 ui/core/app/controllers/scopes/scope/roles/role.js create mode 100644 ui/core/app/controllers/scopes/scope/users.js create mode 100644 ui/core/app/controllers/scopes/scope/users/new.js create mode 100644 ui/core/app/controllers/scopes/scope/users/user.js create mode 100644 ui/core/tests/unit/controllers/scopes/scope/groups-test.js create mode 100644 ui/core/tests/unit/controllers/scopes/scope/groups/group-test.js create mode 100644 ui/core/tests/unit/controllers/scopes/scope/groups/new-test.js create mode 100644 ui/core/tests/unit/controllers/scopes/scope/roles-test.js create mode 100644 ui/core/tests/unit/controllers/scopes/scope/roles/new-test.js create mode 100644 ui/core/tests/unit/controllers/scopes/scope/roles/role-test.js create mode 100644 ui/core/tests/unit/controllers/scopes/scope/users-test.js create mode 100644 ui/core/tests/unit/controllers/scopes/scope/users/new-test.js create mode 100644 ui/core/tests/unit/controllers/scopes/scope/users/user-test.js diff --git a/ui/core/app/controllers/scopes/scope/groups.js b/ui/core/app/controllers/scopes/scope/groups.js new file mode 100644 index 000000000..000d18739 --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/groups.js @@ -0,0 +1,18 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeGroupsController extends Controller { + // =services + + @service intl; + + // =attributes + + /** + * Translated groups breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.intl.t('resources.groups'); + } +} diff --git a/ui/core/app/controllers/scopes/scope/groups/group.js b/ui/core/app/controllers/scopes/scope/groups/group.js new file mode 100644 index 000000000..121559b29 --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/groups/group.js @@ -0,0 +1,13 @@ +import Controller from '@ember/controller'; + +export default class ScopesScopeGroupsGroupController extends Controller { + // =attributes + + /** + * A group breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.model.id; + } +} diff --git a/ui/core/app/controllers/scopes/scope/groups/new.js b/ui/core/app/controllers/scopes/scope/groups/new.js new file mode 100644 index 000000000..0de96d821 --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/groups/new.js @@ -0,0 +1,18 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeGroupsNewController extends Controller { + // =services + + @service intl; + + // =attributes + + /** + * Translated new group breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.intl.t('titles.new'); + } +} diff --git a/ui/core/app/controllers/scopes/scope/roles.js b/ui/core/app/controllers/scopes/scope/roles.js new file mode 100644 index 000000000..bbd84249e --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/roles.js @@ -0,0 +1,18 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeRolesController extends Controller { + // =services + + @service intl; + + // =attributes + + /** + * Translated roles breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.intl.t('resources.roles'); + } +} diff --git a/ui/core/app/controllers/scopes/scope/roles/new.js b/ui/core/app/controllers/scopes/scope/roles/new.js new file mode 100644 index 000000000..598ec9760 --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/roles/new.js @@ -0,0 +1,18 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeRolesNewController extends Controller { + // =services + + @service intl; + + // =attributes + + /** + * Translated new role breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.intl.t('titles.new'); + } +} diff --git a/ui/core/app/controllers/scopes/scope/roles/role.js b/ui/core/app/controllers/scopes/scope/roles/role.js new file mode 100644 index 000000000..f18b1df9a --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/roles/role.js @@ -0,0 +1,13 @@ +import Controller from '@ember/controller'; + +export default class ScopesScopeRolesRoleController extends Controller { + // =attributes + + /** + * A role breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.model.id; + } +} diff --git a/ui/core/app/controllers/scopes/scope/users.js b/ui/core/app/controllers/scopes/scope/users.js new file mode 100644 index 000000000..c88b342fc --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/users.js @@ -0,0 +1,18 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeUsersController extends Controller { + // =services + + @service intl; + + // =attributes + + /** + * Translated users breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.intl.t('resources.users'); + } +} diff --git a/ui/core/app/controllers/scopes/scope/users/new.js b/ui/core/app/controllers/scopes/scope/users/new.js new file mode 100644 index 000000000..91d3f0cb4 --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/users/new.js @@ -0,0 +1,18 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeUsersNewController extends Controller { + // =services + + @service intl; + + // =attributes + + /** + * Translated new user breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.intl.t('titles.new'); + } +} diff --git a/ui/core/app/controllers/scopes/scope/users/user.js b/ui/core/app/controllers/scopes/scope/users/user.js new file mode 100644 index 000000000..9f0456fa4 --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/users/user.js @@ -0,0 +1,13 @@ +import Controller from '@ember/controller'; + +export default class ScopesScopeUsersUserController extends Controller { + // =attributes + + /** + * An user breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.model.id; + } +} diff --git a/ui/core/mirage/config.js b/ui/core/mirage/config.js index ed6859c83..4d73b2f7c 100644 --- a/ui/core/mirage/config.js +++ b/ui/core/mirage/config.js @@ -69,7 +69,7 @@ export default function() { this.patch('/scopes/:scope_id/roles/:id'); this.del('/scopes/:scope_id/roles/:id'); - // group + // IAM: Groups this.get('/scopes/:scope_id/groups'); this.post('/scopes/:scope_id/groups'); this.get('/scopes/:scope_id/groups/:id'); diff --git a/ui/core/tests/unit/controllers/scopes/scope/groups-test.js b/ui/core/tests/unit/controllers/scopes/scope/groups-test.js new file mode 100644 index 000000000..a7baaa19e --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/groups-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/groups', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/groups'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/groups/group-test.js b/ui/core/tests/unit/controllers/scopes/scope/groups/group-test.js new file mode 100644 index 000000000..13d2aeb1d --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/groups/group-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/groups/group', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/groups/group'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/groups/new-test.js b/ui/core/tests/unit/controllers/scopes/scope/groups/new-test.js new file mode 100644 index 000000000..a9290297d --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/groups/new-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/groups/new', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/groups/new'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/roles-test.js b/ui/core/tests/unit/controllers/scopes/scope/roles-test.js new file mode 100644 index 000000000..23fd61372 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/roles-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/roles', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/roles'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/roles/new-test.js b/ui/core/tests/unit/controllers/scopes/scope/roles/new-test.js new file mode 100644 index 000000000..74245d386 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/roles/new-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/roles/new', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/roles/new'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/roles/role-test.js b/ui/core/tests/unit/controllers/scopes/scope/roles/role-test.js new file mode 100644 index 000000000..b6564723f --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/roles/role-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/roles/role', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/roles/role'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/users-test.js b/ui/core/tests/unit/controllers/scopes/scope/users-test.js new file mode 100644 index 000000000..0b5ab25d4 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/users-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/users', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/users'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/users/new-test.js b/ui/core/tests/unit/controllers/scopes/scope/users/new-test.js new file mode 100644 index 000000000..fd291f809 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/users/new-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/users/new', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/users/new'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/users/user-test.js b/ui/core/tests/unit/controllers/scopes/scope/users/user-test.js new file mode 100644 index 000000000..c4a2ef171 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/users/user-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/users/user', function(hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/users/user'); + assert.ok(controller); + }); +}); From f749a200e42096fe808b32c3abfcc88782c369fa Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Tue, 28 Jul 2020 12:10:22 -0400 Subject: [PATCH 05/13] =?UTF-8?q?test:=20=F0=9F=92=8D=20Update=20breadcrum?= =?UTF-8?q?bs=20and=20IAM=20acceptance=20tests=20under=20scope?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/core/tests/acceptance/bread-crumbs-test.js | 37 +++++++++----- ui/core/tests/acceptance/groups-test.js | 51 ++++++++++++------- ui/core/tests/acceptance/roles-test.js | 51 ++++++++++++------- ui/core/tests/acceptance/users-test.js | 51 ++++++++++++------- .../controllers/scopes/scope/groups-test.js | 4 +- .../scopes/scope/groups/group-test.js | 4 +- .../scopes/scope/groups/new-test.js | 4 +- .../controllers/scopes/scope/roles-test.js | 4 +- .../scopes/scope/roles/new-test.js | 4 +- .../scopes/scope/roles/role-test.js | 4 +- .../controllers/scopes/scope/users-test.js | 4 +- .../scopes/scope/users/new-test.js | 4 +- .../scopes/scope/users/user-test.js | 4 +- 13 files changed, 138 insertions(+), 88 deletions(-) diff --git a/ui/core/tests/acceptance/bread-crumbs-test.js b/ui/core/tests/acceptance/bread-crumbs-test.js index 2575f1c75..67288382c 100644 --- a/ui/core/tests/acceptance/bread-crumbs-test.js +++ b/ui/core/tests/acceptance/bread-crumbs-test.js @@ -7,7 +7,8 @@ module('Acceptance | breadcrumbs', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); - let org; + let orgScope; + let getProjectScope; let project; let hostCatalog; let user; @@ -22,33 +23,43 @@ module('Acceptance | breadcrumbs', function (hooks) { let crumbPath; hooks.beforeEach(function () { - org = this.server.create('org'); - project = this.server.create('project'); - user = this.server.create('user'); + orgScope = this.server.create( + 'scope', + { + type: 'org', + }, + 'withChildren' + ); - hostCatalog = this.server.create('host-catalog'); + getProjectScope = () => + this.server.schema.scopes.where({ type: 'project' }).models[0]; + + project = getProjectScope(); + user = this.server.create('user'); role = this.server.create('role'); group = this.server.create('group'); - projectsURL = `/orgs/${org.id}/projects`; + projectsURL = `/scopes/${orgScope.id}/projects`; newProjectURL = `${projectsURL}/new`; projectURL = `${projectsURL}/${project.id}`; - hostCatalogsURL = `${projectURL}/host-catalogs`; - newHostCatalogURL = `${hostCatalogsURL}/new`; - hostCatalogURL = `${hostCatalogsURL}/${hostCatalog.id}`; - - rolesURL = `/orgs/${org.id}/roles`; + rolesURL = `/scopes/${orgScope.id}/roles`; newRoleURL = `${rolesURL}/new`; roleURL = `${rolesURL}/${role.id}`; - groupsURL = `/orgs/${org.id}/groups`; + groupsURL = `/scopes/${orgScope.id}/groups`; newGroupURL = `${groupsURL}/new`; groupURL = `${groupsURL}/${group.id}`; - usersURL = `/orgs/${org.id}/users`; + usersURL = `/scopes/${orgScope.id}/users`; newUserURL = `${usersURL}/${user.id}`; userURL = `${usersURL}/new`; + + // TODO: Update hostcatalog to scopes + hostCatalog = this.server.create('host-catalog'); + hostCatalogsURL = `${projectURL}/host-catalogs`; + newHostCatalogURL = `${hostCatalogsURL}/new`; + hostCatalogURL = `${hostCatalogsURL}/${hostCatalog.id}`; }); test('can navigate via breadcrumbs to projects from project', async function (assert) { diff --git a/ui/core/tests/acceptance/groups-test.js b/ui/core/tests/acceptance/groups-test.js index 5564f9d62..2322f0882 100644 --- a/ui/core/tests/acceptance/groups-test.js +++ b/ui/core/tests/acceptance/groups-test.js @@ -9,24 +9,37 @@ module('Acceptance | groups', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); + let orgScope; + let groupsURL; + let newGroupURL; + hooks.beforeEach(function () { - this.server.create('org'); + orgScope = this.server.create( + 'scope', + { + type: 'org', + }, + 'withChildren' + ); + + groupsURL = `/scopes/${orgScope.id}/groups`; + newGroupURL = `${groupsURL}/new`; }); test('visiting groups', async function (assert) { assert.expect(1); - await visit('/orgs/1/groups'); + await visit(groupsURL); await a11yAudit(); - assert.equal(currentURL(), '/orgs/1/groups'); + assert.equal(currentURL(), groupsURL); }); test('can create new group', async function (assert) { assert.expect(4); assert.equal(this.server.db.groups.length, 0); - await visit('/orgs/1/groups/new'); + await visit(newGroupURL); await fillIn('[name="name"]', 'group name'); await click('[type="submit"]'); - assert.equal(currentURL(), '/orgs/1/groups/1'); + assert.equal(currentURL(), `${groupsURL}/1`); assert.equal(this.server.db.groups.length, 1); assert.equal(this.server.db.groups[0].name, 'group name'); }); @@ -34,16 +47,16 @@ module('Acceptance | groups', function (hooks) { test('can cancel new group creation', async function (assert) { assert.expect(3); assert.equal(this.server.db.groups.length, 0); - await visit('/orgs/1/groups/new'); + await visit(newGroupURL); await fillIn('[name="name"]', 'group name'); await click('.rose-form-actions [type="button"]'); - assert.equal(currentURL(), '/orgs/1/groups'); + assert.equal(currentURL(), groupsURL); assert.equal(this.server.db.groups.length, 0); }); test('saving a new group with invalid fields displays error messages', async function (assert) { assert.expect(2); - this.server.post('/orgs/:org_id/groups', () => { + this.server.post('/scopes/:scope_id/groups', () => { return new Response( 400, {}, @@ -62,7 +75,7 @@ module('Acceptance | groups', function (hooks) { } ); }); - await visit('/orgs/1/groups/new'); + await visit(newGroupURL); await fillIn('[name="name"]', 'group name'); await click('[type="submit"]'); assert.ok( @@ -80,17 +93,17 @@ module('Acceptance | groups', function (hooks) { test('can save changes to an existing group', async function (assert) { assert.expect(2); this.server.createList('group', 1, { name: 'Admin group' }); - await visit('/orgs/1/groups/1'); + await visit(`${groupsURL}/1`); await fillIn('[name="name"]', 'Updated admin group'); await click('.rose-form-actions [type="submit"]'); - assert.equal(currentURL(), '/orgs/1/groups/1'); + assert.equal(currentURL(), `${groupsURL}/1`); assert.equal(this.server.db.groups[0].name, 'Updated admin group'); }); test('can cancel changes to an existing group', async function (assert) { assert.expect(1); this.server.createList('group', 1, { name: 'Admin group' }); - await visit('/orgs/1/groups/1'); + await visit(`${groupsURL}/1`); await fillIn('[name="name"]', 'Updated admin group'); await click('.rose-form-actions [type="button"]'); assert.equal(find('[name="name"]').value, 'Admin group'); @@ -100,7 +113,7 @@ module('Acceptance | groups', function (hooks) { assert.expect(2); this.server.createList('group', 1); assert.equal(this.server.db.groups.length, 1); - await visit('/orgs/1/groups/1'); + await visit(`${groupsURL}/1`); await click('.rose-button-warning'); assert.equal(this.server.db.groups.length, 0); }); @@ -108,7 +121,7 @@ module('Acceptance | groups', function (hooks) { test('saving an existing group with invalid fields displays error messages', async function (assert) { assert.expect(2); this.server.createList('group', 1); - this.server.patch('/orgs/:org_id/groups/:id', () => { + this.server.patch('/scopes/:scope_id/groups/:id', () => { return new Response( 400, {}, @@ -127,7 +140,7 @@ module('Acceptance | groups', function (hooks) { } ); }); - await visit('/orgs/1/groups/1'); + await visit(`${groupsURL}/1`); await fillIn('[name="name"]', 'random string'); await click('[type="submit"]'); assert.ok( @@ -145,7 +158,7 @@ module('Acceptance | groups', function (hooks) { test('errors are displayed when save project fails', async function (assert) { assert.expect(1); this.server.createList('group', 1); - this.server.patch('/orgs/:org_id/groups/:id', () => { + this.server.patch('/scopes/:scope_id/groups/:id', () => { return new Response( 490, {}, @@ -156,7 +169,7 @@ module('Acceptance | groups', function (hooks) { } ); }); - await visit('/orgs/1/groups/1'); + await visit(`${groupsURL}/1`); await fillIn('[name="name"]', 'Role name'); await click('[type="submit"]'); assert.ok( @@ -169,7 +182,7 @@ module('Acceptance | groups', function (hooks) { test('errors are displayed when delete project fails', async function (assert) { assert.expect(1); this.server.createList('group', 1); - this.server.del('/orgs/:org_id/groups/:id', () => { + this.server.del('/scopes/:scope_id/groups/:id', () => { return new Response( 490, {}, @@ -180,7 +193,7 @@ module('Acceptance | groups', function (hooks) { } ); }); - await visit('/orgs/1/groups/1'); + await visit(`${groupsURL}/1`); await click('.rose-button-warning'); assert.ok( find('[role="alert"]').textContent.trim(), diff --git a/ui/core/tests/acceptance/roles-test.js b/ui/core/tests/acceptance/roles-test.js index 038d367ae..b745a0d28 100644 --- a/ui/core/tests/acceptance/roles-test.js +++ b/ui/core/tests/acceptance/roles-test.js @@ -9,24 +9,37 @@ module('Acceptance | roles', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); + let orgScope; + let rolesURL; + let newRoleURL; + hooks.beforeEach(function () { - this.server.create('org'); + orgScope = this.server.create( + 'scope', + { + type: 'org', + }, + 'withChildren' + ); + + rolesURL = `/scopes/${orgScope.id}/roles`; + newRoleURL = `${rolesURL}/new`; }); test('visiting roles', async function (assert) { assert.expect(1); - await visit('/orgs/1/roles'); + await visit(rolesURL); await a11yAudit(); - assert.equal(currentURL(), '/orgs/1/roles'); + assert.equal(currentURL(), rolesURL); }); test('can create new role', async function (assert) { assert.expect(4); assert.equal(this.server.db.roles.length, 0); - await visit('/orgs/1/roles/new'); + await visit(newRoleURL); await fillIn('[name="name"]', 'role name'); await click('[type="submit"]'); - assert.equal(currentURL(), '/orgs/1/roles/1'); + assert.equal(currentURL(), `${rolesURL}/1`); assert.equal(this.server.db.roles.length, 1); assert.equal(this.server.db.roles[0].name, 'role name'); }); @@ -34,16 +47,16 @@ module('Acceptance | roles', function (hooks) { test('can cancel new role creation', async function (assert) { assert.expect(3); assert.equal(this.server.db.roles.length, 0); - await visit('/orgs/1/roles/new'); + await visit(newRoleURL); await fillIn('[name="name"]', 'role name'); await click('.rose-form-actions [type="button"]'); - assert.equal(currentURL(), '/orgs/1/roles'); + assert.equal(currentURL(), rolesURL); assert.equal(this.server.db.roles.length, 0); }); test('saving a new role with invalid fields displays error messages', async function (assert) { assert.expect(2); - this.server.post('/orgs/:org_id/roles', () => { + this.server.post('/scopes/:scope_id/roles', () => { return new Response( 400, {}, @@ -62,7 +75,7 @@ module('Acceptance | roles', function (hooks) { } ); }); - await visit('/orgs/1/roles/new'); + await visit(newRoleURL); await fillIn('[name="name"]', 'role name'); await click('[type="submit"]'); assert.ok( @@ -80,17 +93,17 @@ module('Acceptance | roles', function (hooks) { test('can save changes to an existing role', async function (assert) { assert.expect(2); this.server.createList('role', 1, { name: 'Admin role' }); - await visit('/orgs/1/roles/1'); + await visit(`${rolesURL}/1`); await fillIn('[name="name"]', 'Updated admin role'); await click('.rose-form-actions [type="submit"]'); - assert.equal(currentURL(), '/orgs/1/roles/1'); + assert.equal(currentURL(), `${rolesURL}/1`); assert.equal(this.server.db.roles[0].name, 'Updated admin role'); }); test('can cancel changes to an existing role', async function (assert) { assert.expect(1); this.server.createList('role', 1, { name: 'Admin role' }); - await visit('/orgs/1/roles/1'); + await visit(`${rolesURL}/1`); await fillIn('[name="name"]', 'Updated admin role'); await click('.rose-form-actions [type="button"]'); assert.equal(find('[name="name"]').value, 'Admin role'); @@ -100,7 +113,7 @@ module('Acceptance | roles', function (hooks) { assert.expect(2); this.server.createList('role', 1); assert.equal(this.server.db.roles.length, 1); - await visit('/orgs/1/roles/1'); + await visit(`${rolesURL}/1`); await click('.rose-button-warning'); assert.equal(this.server.db.roles.length, 0); }); @@ -108,7 +121,7 @@ module('Acceptance | roles', function (hooks) { test('saving an existing role with invalid fields displays error messages', async function (assert) { assert.expect(2); this.server.createList('role', 1); - this.server.patch('/orgs/:org_id/roles/:id', () => { + this.server.patch('/scopes/:scope_id/roles/:id', () => { return new Response( 400, {}, @@ -127,7 +140,7 @@ module('Acceptance | roles', function (hooks) { } ); }); - await visit('/orgs/1/roles/1'); + await visit(`${rolesURL}/1`); await fillIn('[name="name"]', 'random string'); await click('[type="submit"]'); assert.ok( @@ -145,7 +158,7 @@ module('Acceptance | roles', function (hooks) { test('errors are displayed when save project fails', async function (assert) { assert.expect(1); this.server.createList('role', 1); - this.server.patch('/orgs/:org_id/roles/:id', () => { + this.server.patch('/scopes/:scope_id/roles/:id', () => { return new Response( 490, {}, @@ -156,7 +169,7 @@ module('Acceptance | roles', function (hooks) { } ); }); - await visit('/orgs/1/roles/1'); + await visit(`${rolesURL}/1`); await fillIn('[name="name"]', 'Role name'); await click('[type="submit"]'); assert.ok( @@ -169,7 +182,7 @@ module('Acceptance | roles', function (hooks) { test('errors are displayed when delete project fails', async function (assert) { assert.expect(1); this.server.createList('role', 1); - this.server.del('/orgs/:org_id/roles/:id', () => { + this.server.del('/scopes/:scope_id/roles/:id', () => { return new Response( 490, {}, @@ -180,7 +193,7 @@ module('Acceptance | roles', function (hooks) { } ); }); - await visit('/orgs/1/roles/1'); + await visit(`${rolesURL}/1`); await click('.rose-button-warning'); assert.ok( find('[role="alert"]').textContent.trim(), diff --git a/ui/core/tests/acceptance/users-test.js b/ui/core/tests/acceptance/users-test.js index af68f19bc..85b187d56 100644 --- a/ui/core/tests/acceptance/users-test.js +++ b/ui/core/tests/acceptance/users-test.js @@ -9,25 +9,38 @@ module('Acceptance | users', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); + let orgScope; + let usersURL; + let newUserURL; + hooks.beforeEach(function () { - this.server.create('org'); + orgScope = this.server.create( + 'scope', + { + type: 'org', + }, + 'withChildren' + ); + + usersURL = `/scopes/${orgScope.id}/users`; + newUserURL = `${usersURL}/new`; }); test('visiting users', async function (assert) { assert.expect(1); this.server.createList('user', 1); - await visit('/orgs/1/users'); + await visit(usersURL); await a11yAudit(); - assert.equal(currentURL(), '/orgs/1/users'); + assert.equal(currentURL(), usersURL); }); test('can create new users', async function (assert) { assert.expect(4); assert.equal(this.server.db.users.length, 0); - await visit('/orgs/1/users/new'); + await visit(newUserURL); await fillIn('[name="name"]', 'User name'); await click('[type="submit"]'); - assert.equal(currentURL(), '/orgs/1/users/1'); + assert.equal(currentURL(), `${usersURL}/1`); assert.equal(this.server.db.users.length, 1); assert.equal(this.server.db.users[0].name, 'User name'); }); @@ -35,16 +48,16 @@ module('Acceptance | users', function (hooks) { test('can cancel creation of a new user', async function (assert) { assert.expect(3); assert.equal(this.server.db.users.length, 0); - await visit('/orgs/1/users/new'); + await visit(newUserURL); await fillIn('[name="name"]', 'User name'); await click('.rose-form-actions [type="button"]'); - assert.equal(currentURL(), '/orgs/1/users'); + assert.equal(currentURL(), usersURL); assert.equal(this.server.db.users.length, 0); }); test('saving a new user with invalid fields displays error messages', async function (assert) { assert.expect(2); - this.server.post('/orgs/:org_id/users', () => { + this.server.post('scopes/:scope_id/users', () => { return new Response( 400, {}, @@ -63,7 +76,7 @@ module('Acceptance | users', function (hooks) { } ); }); - await visit('/orgs/1/users/new'); + await visit(newUserURL); await fillIn('[name="name"]', 'User name'); await click('[type="submit"]'); assert.ok( @@ -81,17 +94,17 @@ module('Acceptance | users', function (hooks) { test('can save changes to an existing user', async function (assert) { assert.expect(2); this.server.createList('user', 1, { name: 'Test User' }); - await visit('/orgs/1/users/1'); + await visit(`${usersURL}/1`); await fillIn('[name="name"]', 'Updated user name'); await click('.rose-form-actions [type="submit"]'); - assert.equal(currentURL(), '/orgs/1/users/1'); + assert.equal(currentURL(), `${usersURL}/1`); assert.equal(this.server.db.users[0].name, 'Updated user name'); }); test('can cancel changes to an existing user', async function (assert) { assert.expect(1); this.server.createList('user', 1, { name: 'Test User' }); - await visit('/orgs/1/users/1'); + await visit(`${usersURL}/1`); await fillIn('[name="name"]', 'Unsaved user name'); await click('.rose-form-actions [type="button"]'); assert.equal(find('[name="name"]').value, 'Test User'); @@ -101,7 +114,7 @@ module('Acceptance | users', function (hooks) { assert.expect(2); this.server.createList('user', 1); assert.equal(this.server.db.users.length, 1); - await visit('/orgs/1/users/1'); + await visit(`${usersURL}/1`); await click('.rose-button-warning'); assert.equal(this.server.db.users.length, 0); }); @@ -109,7 +122,7 @@ module('Acceptance | users', function (hooks) { test('saving an existing user with invalid fields displays error messages', async function (assert) { assert.expect(2); this.server.createList('user', 1); - this.server.patch('/orgs/:org_id/users/:id', () => { + this.server.patch('/scopes/:scope_id/users/:id', () => { return new Response( 400, {}, @@ -128,7 +141,7 @@ module('Acceptance | users', function (hooks) { } ); }); - await visit('/orgs/1/users/1'); + await visit(`${usersURL}/1`); await fillIn('[name="name"]', 'User name'); await click('[type="submit"]'); assert.ok( @@ -146,7 +159,7 @@ module('Acceptance | users', function (hooks) { test('errors are displayed when saving user fails', async function (assert) { assert.expect(1); this.server.createList('user', 1); - this.server.patch('/orgs/:org_id/users/:id', () => { + this.server.patch('/scopes/:scope_id/users/:id', () => { return new Response( 490, {}, @@ -157,7 +170,7 @@ module('Acceptance | users', function (hooks) { } ); }); - await visit('/orgs/1/users/1'); + await visit(`${usersURL}/1`); await fillIn('[name="name"]', 'User name'); await click('[type="submit"]'); assert.ok( @@ -170,7 +183,7 @@ module('Acceptance | users', function (hooks) { test('errors are displayed when user deletion fails', async function (assert) { assert.expect(1); this.server.createList('user', 1); - this.server.del('/orgs/:org_id/users/:id', () => { + this.server.del('/scopes/:scope_id/users/:id', () => { return new Response( 490, {}, @@ -181,7 +194,7 @@ module('Acceptance | users', function (hooks) { } ); }); - await visit('/orgs/1/users/1'); + await visit(`${usersURL}/1`); await click('.rose-button-warning'); assert.ok( find('[role="alert"]').textContent.trim(), diff --git a/ui/core/tests/unit/controllers/scopes/scope/groups-test.js b/ui/core/tests/unit/controllers/scopes/scope/groups-test.js index a7baaa19e..4f1a10f19 100644 --- a/ui/core/tests/unit/controllers/scopes/scope/groups-test.js +++ b/ui/core/tests/unit/controllers/scopes/scope/groups-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | scopes/scope/groups', function(hooks) { +module('Unit | Controller | scopes/scope/groups', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:scopes/scope/groups'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/scopes/scope/groups/group-test.js b/ui/core/tests/unit/controllers/scopes/scope/groups/group-test.js index 13d2aeb1d..bb3e8b7cc 100644 --- a/ui/core/tests/unit/controllers/scopes/scope/groups/group-test.js +++ b/ui/core/tests/unit/controllers/scopes/scope/groups/group-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | scopes/scope/groups/group', function(hooks) { +module('Unit | Controller | scopes/scope/groups/group', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:scopes/scope/groups/group'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/scopes/scope/groups/new-test.js b/ui/core/tests/unit/controllers/scopes/scope/groups/new-test.js index a9290297d..56eaa6c76 100644 --- a/ui/core/tests/unit/controllers/scopes/scope/groups/new-test.js +++ b/ui/core/tests/unit/controllers/scopes/scope/groups/new-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | scopes/scope/groups/new', function(hooks) { +module('Unit | Controller | scopes/scope/groups/new', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:scopes/scope/groups/new'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/scopes/scope/roles-test.js b/ui/core/tests/unit/controllers/scopes/scope/roles-test.js index 23fd61372..1567c0d37 100644 --- a/ui/core/tests/unit/controllers/scopes/scope/roles-test.js +++ b/ui/core/tests/unit/controllers/scopes/scope/roles-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | scopes/scope/roles', function(hooks) { +module('Unit | Controller | scopes/scope/roles', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:scopes/scope/roles'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/scopes/scope/roles/new-test.js b/ui/core/tests/unit/controllers/scopes/scope/roles/new-test.js index 74245d386..ee2595d36 100644 --- a/ui/core/tests/unit/controllers/scopes/scope/roles/new-test.js +++ b/ui/core/tests/unit/controllers/scopes/scope/roles/new-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | scopes/scope/roles/new', function(hooks) { +module('Unit | Controller | scopes/scope/roles/new', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:scopes/scope/roles/new'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/scopes/scope/roles/role-test.js b/ui/core/tests/unit/controllers/scopes/scope/roles/role-test.js index b6564723f..4edaa508f 100644 --- a/ui/core/tests/unit/controllers/scopes/scope/roles/role-test.js +++ b/ui/core/tests/unit/controllers/scopes/scope/roles/role-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | scopes/scope/roles/role', function(hooks) { +module('Unit | Controller | scopes/scope/roles/role', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:scopes/scope/roles/role'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/scopes/scope/users-test.js b/ui/core/tests/unit/controllers/scopes/scope/users-test.js index 0b5ab25d4..25ced1669 100644 --- a/ui/core/tests/unit/controllers/scopes/scope/users-test.js +++ b/ui/core/tests/unit/controllers/scopes/scope/users-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | scopes/scope/users', function(hooks) { +module('Unit | Controller | scopes/scope/users', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:scopes/scope/users'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/scopes/scope/users/new-test.js b/ui/core/tests/unit/controllers/scopes/scope/users/new-test.js index fd291f809..440b4523c 100644 --- a/ui/core/tests/unit/controllers/scopes/scope/users/new-test.js +++ b/ui/core/tests/unit/controllers/scopes/scope/users/new-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | scopes/scope/users/new', function(hooks) { +module('Unit | Controller | scopes/scope/users/new', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:scopes/scope/users/new'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/scopes/scope/users/user-test.js b/ui/core/tests/unit/controllers/scopes/scope/users/user-test.js index c4a2ef171..17d292de0 100644 --- a/ui/core/tests/unit/controllers/scopes/scope/users/user-test.js +++ b/ui/core/tests/unit/controllers/scopes/scope/users/user-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | scopes/scope/users/user', function(hooks) { +module('Unit | Controller | scopes/scope/users/user', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:scopes/scope/users/user'); assert.ok(controller); }); From 5bcbdafd82eb3a37bce84cd5467a27a191f0aa51 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Tue, 28 Jul 2020 16:55:40 -0400 Subject: [PATCH 06/13] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Update=20IAM=20br?= =?UTF-8?q?eadcrumbs=20to=20displayname=20instead=20of=20id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/core/app/controllers/scopes/scope/groups/group.js | 2 +- ui/core/app/controllers/scopes/scope/roles/role.js | 2 +- ui/core/app/controllers/scopes/scope/users/user.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/core/app/controllers/scopes/scope/groups/group.js b/ui/core/app/controllers/scopes/scope/groups/group.js index 121559b29..dcd1e5296 100644 --- a/ui/core/app/controllers/scopes/scope/groups/group.js +++ b/ui/core/app/controllers/scopes/scope/groups/group.js @@ -8,6 +8,6 @@ export default class ScopesScopeGroupsGroupController extends Controller { * @type {string} */ get breadCrumb() { - return this.model.id; + return this.model.displayName; } } diff --git a/ui/core/app/controllers/scopes/scope/roles/role.js b/ui/core/app/controllers/scopes/scope/roles/role.js index f18b1df9a..39ba35717 100644 --- a/ui/core/app/controllers/scopes/scope/roles/role.js +++ b/ui/core/app/controllers/scopes/scope/roles/role.js @@ -8,6 +8,6 @@ export default class ScopesScopeRolesRoleController extends Controller { * @type {string} */ get breadCrumb() { - return this.model.id; + return this.model.displayName; } } diff --git a/ui/core/app/controllers/scopes/scope/users/user.js b/ui/core/app/controllers/scopes/scope/users/user.js index 9f0456fa4..6f7d42c7a 100644 --- a/ui/core/app/controllers/scopes/scope/users/user.js +++ b/ui/core/app/controllers/scopes/scope/users/user.js @@ -8,6 +8,6 @@ export default class ScopesScopeUsersUserController extends Controller { * @type {string} */ get breadCrumb() { - return this.model.id; + return this.model.displayName; } } From a62630f57277ae4dbdd1baf88e6c13bab43fa8bd Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Tue, 28 Jul 2020 17:09:29 -0400 Subject: [PATCH 07/13] =?UTF-8?q?docs:=20=E2=9C=8F=EF=B8=8F=20Update=20cre?= =?UTF-8?q?ate,=20save,=20and=20delete=20i18n=20notify=20strings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In addition, notify on create, save, and delete before route changes for consistency --- ui/core/app/routes/scopes/scope/groups.js | 7 +++++-- ui/core/app/routes/scopes/scope/projects.js | 10 ++++++---- ui/core/app/routes/scopes/scope/roles.js | 7 +++++-- ui/core/app/routes/scopes/scope/users.js | 7 +++++-- ui/core/translations/en-us.yaml | 13 +++---------- 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/ui/core/app/routes/scopes/scope/groups.js b/ui/core/app/routes/scopes/scope/groups.js index 0344e53f1..8c872a9c2 100644 --- a/ui/core/app/routes/scopes/scope/groups.js +++ b/ui/core/app/routes/scopes/scope/groups.js @@ -36,10 +36,13 @@ export default class ScopesScopeGroupsRoute extends Route { */ @action async save(group) { + const { isNew } = group; try { await group.save(this.scopeAdapterOptions()); this.refresh(); - this.notify.success(this.intl.t('notify.save-success')); + this.notify.success(this.intl.t( + isNew ? 'notify.create-success' : 'notify.save-success' + )); this.transitionTo('scopes.scope.groups.group', group); } catch (error) { //TODO: replace with translated strings @@ -56,8 +59,8 @@ export default class ScopesScopeGroupsRoute extends Route { try { await group.destroyRecord(this.scopeAdapterOptions()); this.refresh(); + this.notify.success(this.intl.t('notify.delete-success')); this.transitionTo('scopes.scope.groups'); - this.notify.success(this.intl.t('notify.group.delete-success')); } catch (error) { //TODO: replace with translated strings this.notify.error(error.message, { closeAfter: null }); diff --git a/ui/core/app/routes/scopes/scope/projects.js b/ui/core/app/routes/scopes/scope/projects.js index 775dc5ad6..09a305150 100644 --- a/ui/core/app/routes/scopes/scope/projects.js +++ b/ui/core/app/routes/scopes/scope/projects.js @@ -5,6 +5,7 @@ import { action } from '@ember/object'; export default class ScopesScopeProjectsRoute extends Route { // =services + @service intl; @service notify; // =methods @@ -52,11 +53,13 @@ export default class ScopesScopeProjectsRoute extends Route { */ @action async save(project) { + const { isNew } = project; try { await project.save(); this.refresh(); - // TODO: replace with translated strings - this.notify.success('Save succeeded.'); + this.notify.success(this.intl.t( + isNew ? 'notify.create-success' : 'notify.save-success' + )); this.transitionTo('scopes.scope.projects.project', project); } catch (error) { // TODO: replace with translated strings @@ -73,9 +76,8 @@ export default class ScopesScopeProjectsRoute extends Route { try { await project.destroyRecord(); this.refresh(); + this.notify.success('notify.delete-success'); this.transitionTo('scopes.scope.projects'); - // TODO: replace with translated strings - this.notify.success('Deleted project succesfully.'); } catch (error) { // TODO: replace with translated strings this.notify.error(error.message, { closeAfter: null }); diff --git a/ui/core/app/routes/scopes/scope/roles.js b/ui/core/app/routes/scopes/scope/roles.js index fd451c719..5b6b45106 100644 --- a/ui/core/app/routes/scopes/scope/roles.js +++ b/ui/core/app/routes/scopes/scope/roles.js @@ -36,10 +36,13 @@ export default class ScopesScopeRolesRoute extends Route { */ @action async save(role) { + const { isNew } = role; try { await role.save(this.scopeAdapterOptions()); this.refresh(); - this.notify.success(this.intl.t('notify.save-success')); + this.notify.success(this.intl.t( + isNew ? 'notify.create-success' : 'notify.save-success' + )); this.transitionTo('scopes.scope.roles.role', role); } catch (error) { // TODO: replace with translated strings @@ -56,7 +59,7 @@ export default class ScopesScopeRolesRoute extends Route { try { await role.destroyRecord(this.scopeAdapterOptions()); this.refresh(); - this.notify.success(this.intl.t('notify.role.delete-success')); + this.notify.success(this.intl.t('notify.delete-success')); this.transitionTo('scopes.scope.roles'); } catch (error) { // TODO: replace with translated strings diff --git a/ui/core/app/routes/scopes/scope/users.js b/ui/core/app/routes/scopes/scope/users.js index 8f4f65905..e70c25f2f 100644 --- a/ui/core/app/routes/scopes/scope/users.js +++ b/ui/core/app/routes/scopes/scope/users.js @@ -37,10 +37,13 @@ export default class ScopesScopeUsersRoute extends Route { */ @action async save(user) { + const { isNew } = user; try { await user.save(this.scopeAdapterOptions()); this.refresh(); - this.notify.success(this.intl.t('notify.save-success')); + this.notify.success(this.intl.t( + isNew ? 'notify.create-success' : 'notify.save-success' + )); this.transitionTo('scopes.scope.users.user', user); } catch (error) { // TODO: replace with translated strings @@ -57,8 +60,8 @@ export default class ScopesScopeUsersRoute extends Route { try { await user.destroyRecord(this.scopeAdapterOptions()); this.refresh(); + this.notify.success(this.intl.t('notify.delete-success')); this.transitionTo('scopes.scope.users'); - this.notify.success(this.intl.t('notify.user.delete-success')); } catch (error) { // TODO: replace with translated strings this.notify.error(error.message, { closeAfter: null }); diff --git a/ui/core/translations/en-us.yaml b/ui/core/translations/en-us.yaml index e770de25c..22e522072 100644 --- a/ui/core/translations/en-us.yaml +++ b/ui/core/translations/en-us.yaml @@ -60,16 +60,9 @@ errors: server-error: We ran into a problem and could not continue. You can ask your administrator or try again later. unknown-error: Please contact your administrator or try again later. notify: - save-success: Save succeeded. - user: - create-success: User created succesfully. - delete-success: Deleted user successfully. - role: - create-success: Role created succesfully. - delete-success: Deleted role successfully. - group: - create-success: Group created succesfully. - delete-success: Deleted group successfully. + create-success: Created succesfully. + save-success: Saved succesfully. + delete-success: Deleted successfully. dev: default-org: Default Org menu-item: Menu item From f3e5978e2b780cc31d52bcdbd755d1589da08d4e Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Tue, 28 Jul 2020 17:56:49 -0400 Subject: [PATCH 08/13] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Update=20IAM=20sc?= =?UTF-8?q?ope=20adapteroptions=20for=20find,=20save,=20&=20del?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/core/app/routes/scopes/scope/groups.js | 7 +++---- ui/core/app/routes/scopes/scope/groups/group.js | 5 ++--- ui/core/app/routes/scopes/scope/groups/new.js | 3 ++- ui/core/app/routes/scopes/scope/roles.js | 7 +++---- ui/core/app/routes/scopes/scope/roles/new.js | 3 ++- ui/core/app/routes/scopes/scope/roles/role.js | 5 ++--- ui/core/app/routes/scopes/scope/users.js | 7 +++---- ui/core/app/routes/scopes/scope/users/new.js | 3 ++- ui/core/app/routes/scopes/scope/users/user.js | 5 ++--- 9 files changed, 21 insertions(+), 24 deletions(-) diff --git a/ui/core/app/routes/scopes/scope/groups.js b/ui/core/app/routes/scopes/scope/groups.js index 8c872a9c2..94441ca1e 100644 --- a/ui/core/app/routes/scopes/scope/groups.js +++ b/ui/core/app/routes/scopes/scope/groups.js @@ -38,7 +38,7 @@ export default class ScopesScopeGroupsRoute extends Route { async save(group) { const { isNew } = group; try { - await group.save(this.scopeAdapterOptions()); + await group.save(); this.refresh(); this.notify.success(this.intl.t( isNew ? 'notify.create-success' : 'notify.save-success' @@ -68,8 +68,7 @@ export default class ScopesScopeGroupsRoute extends Route { } scopeAdapterOptions() { - const { id: scope_id } = this.modelFor('scopes.scope'); - const adapterOptions = { scopeID: scope_id }; - return { adapterOptions }; + const { id: scopeID } = this.modelFor('scopes.scope'); + return { adapterOptions: { scopeID } }; } } diff --git a/ui/core/app/routes/scopes/scope/groups/group.js b/ui/core/app/routes/scopes/scope/groups/group.js index da536ed07..ce0585e8d 100644 --- a/ui/core/app/routes/scopes/scope/groups/group.js +++ b/ui/core/app/routes/scopes/scope/groups/group.js @@ -10,8 +10,7 @@ export default class ScopesScopeGroupsGroupRoute extends Route { * @return {groupModel} */ async model({ group_id }) { - const { id: scope_id } = this.modelFor('scopes.scope'); - const adapterOptions = { scopeID: scope_id }; - return this.store.findRecord('group', group_id, { adapterOptions }); + const { id: scopeID } = this.modelFor('scopes.scope'); + return this.store.findRecord('group', group_id, { adapterOptions: { scopeID } }); } } diff --git a/ui/core/app/routes/scopes/scope/groups/new.js b/ui/core/app/routes/scopes/scope/groups/new.js index e33233f5f..3326dc7e4 100644 --- a/ui/core/app/routes/scopes/scope/groups/new.js +++ b/ui/core/app/routes/scopes/scope/groups/new.js @@ -8,6 +8,7 @@ export default class ScopesScopeGroupsNewRoute extends Route { * @return {GroupModel} */ model() { - return this.store.createRecord('group'); + const { id: scopeID } = this.modelFor('scopes.scope'); + return this.store.createRecord('group', { scopeID }); } } diff --git a/ui/core/app/routes/scopes/scope/roles.js b/ui/core/app/routes/scopes/scope/roles.js index 5b6b45106..a4d9d2c5b 100644 --- a/ui/core/app/routes/scopes/scope/roles.js +++ b/ui/core/app/routes/scopes/scope/roles.js @@ -38,7 +38,7 @@ export default class ScopesScopeRolesRoute extends Route { async save(role) { const { isNew } = role; try { - await role.save(this.scopeAdapterOptions()); + await role.save(); this.refresh(); this.notify.success(this.intl.t( isNew ? 'notify.create-success' : 'notify.save-success' @@ -68,8 +68,7 @@ export default class ScopesScopeRolesRoute extends Route { } scopeAdapterOptions() { - const { id: scope_id } = this.modelFor('scopes.scope'); - const adapterOptions = { scopeID: scope_id }; - return { adapterOptions }; + const { id: scopeID } = this.modelFor('scopes.scope'); + return { adapterOptions: { scopeID } }; } } diff --git a/ui/core/app/routes/scopes/scope/roles/new.js b/ui/core/app/routes/scopes/scope/roles/new.js index f39f6e6c2..edc239e21 100644 --- a/ui/core/app/routes/scopes/scope/roles/new.js +++ b/ui/core/app/routes/scopes/scope/roles/new.js @@ -8,6 +8,7 @@ export default class ScopesScopeRolesNewRoute extends Route { * @return {RoleModel} */ model() { - return this.store.createRecord('role'); + const { id: scopeID } = this.modelFor('scopes.scope'); + return this.store.createRecord('role', { scopeID }); } } diff --git a/ui/core/app/routes/scopes/scope/roles/role.js b/ui/core/app/routes/scopes/scope/roles/role.js index 781bb4e47..98cbffcd0 100644 --- a/ui/core/app/routes/scopes/scope/roles/role.js +++ b/ui/core/app/routes/scopes/scope/roles/role.js @@ -10,8 +10,7 @@ export default class ScopesScopeRolesRoleRoute extends Route { * @return {RoleModel} */ async model({ role_id }) { - const { id: scope_id } = this.modelFor('scopes.scope'); - const adapterOptions = { scopeID: scope_id }; - return this.store.findRecord('role', role_id, { adapterOptions }); + const { id: scopeID } = this.modelFor('scopes.scope'); + return this.store.findRecord('role', role_id, { adapterOptions: { scopeID } }); } } diff --git a/ui/core/app/routes/scopes/scope/users.js b/ui/core/app/routes/scopes/scope/users.js index e70c25f2f..8beb4f146 100644 --- a/ui/core/app/routes/scopes/scope/users.js +++ b/ui/core/app/routes/scopes/scope/users.js @@ -39,7 +39,7 @@ export default class ScopesScopeUsersRoute extends Route { async save(user) { const { isNew } = user; try { - await user.save(this.scopeAdapterOptions()); + await user.save(); this.refresh(); this.notify.success(this.intl.t( isNew ? 'notify.create-success' : 'notify.save-success' @@ -69,8 +69,7 @@ export default class ScopesScopeUsersRoute extends Route { } scopeAdapterOptions() { - const { id: scope_id } = this.modelFor('scopes.scope'); - const adapterOptions = { scopeID: scope_id }; - return { adapterOptions }; + const { id: scopeID } = this.modelFor('scopes.scope'); + return { adapterOptions: { scopeID } }; } } diff --git a/ui/core/app/routes/scopes/scope/users/new.js b/ui/core/app/routes/scopes/scope/users/new.js index 9b486a48b..25c4a0b52 100644 --- a/ui/core/app/routes/scopes/scope/users/new.js +++ b/ui/core/app/routes/scopes/scope/users/new.js @@ -8,6 +8,7 @@ export default class ScopesScopeUsersNewRoute extends Route { * @return {UserModel} */ model() { - return this.store.createRecord('user'); + const { id: scopeID } = this.modelFor('scopes.scope'); + return this.store.createRecord('user', { scopeID }); } } diff --git a/ui/core/app/routes/scopes/scope/users/user.js b/ui/core/app/routes/scopes/scope/users/user.js index f28ff4d56..b2bcc0911 100644 --- a/ui/core/app/routes/scopes/scope/users/user.js +++ b/ui/core/app/routes/scopes/scope/users/user.js @@ -10,8 +10,7 @@ export default class ScopesScopeUsersUserRoute extends Route { * @return {UserModel} */ async model({ user_id }) { - const { id: scope_id } = this.modelFor('scopes.scope'); - const adapterOptions = { scopeID: scope_id }; - return this.store.findRecord('user', user_id, { adapterOptions }); + const { id: scopeID } = this.modelFor('scopes.scope'); + return this.store.findRecord('user', user_id, { adapterOptions: { scopeID } }); } } From aa5bfb71555e97ce513f0ceb990b6825044d9a77 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 29 Jul 2020 14:30:19 -0400 Subject: [PATCH 09/13] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Update=20IAM=20cr?= =?UTF-8?q?eation=20to=20use=20scopeModel=20and=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/core/app/routes/scopes/scope/groups.js | 10 +++------- ui/core/app/routes/scopes/scope/groups/new.js | 4 ++-- ui/core/app/routes/scopes/scope/roles.js | 10 +++------- ui/core/app/routes/scopes/scope/roles/new.js | 4 ++-- ui/core/app/routes/scopes/scope/users.js | 10 +++------- ui/core/app/routes/scopes/scope/users/new.js | 4 ++-- 6 files changed, 15 insertions(+), 27 deletions(-) diff --git a/ui/core/app/routes/scopes/scope/groups.js b/ui/core/app/routes/scopes/scope/groups.js index 94441ca1e..ea24aa58e 100644 --- a/ui/core/app/routes/scopes/scope/groups.js +++ b/ui/core/app/routes/scopes/scope/groups.js @@ -15,7 +15,8 @@ export default class ScopesScopeGroupsRoute extends Route { * @return {Promise[GroupModel]} */ async model() { - return this.store.findAll('group', this.scopeAdapterOptions()); + const { id: scopeID } = this.modelFor('scopes.scope'); + return this.store.findAll('group', { adapterOptions: { scopeID } }); } // =actions @@ -57,7 +58,7 @@ export default class ScopesScopeGroupsRoute extends Route { @action async delete(group) { try { - await group.destroyRecord(this.scopeAdapterOptions()); + await group.destroyRecord(); this.refresh(); this.notify.success(this.intl.t('notify.delete-success')); this.transitionTo('scopes.scope.groups'); @@ -66,9 +67,4 @@ export default class ScopesScopeGroupsRoute extends Route { this.notify.error(error.message, { closeAfter: null }); } } - - scopeAdapterOptions() { - const { id: scopeID } = this.modelFor('scopes.scope'); - return { adapterOptions: { scopeID } }; - } } diff --git a/ui/core/app/routes/scopes/scope/groups/new.js b/ui/core/app/routes/scopes/scope/groups/new.js index 3326dc7e4..fe281afb2 100644 --- a/ui/core/app/routes/scopes/scope/groups/new.js +++ b/ui/core/app/routes/scopes/scope/groups/new.js @@ -8,7 +8,7 @@ export default class ScopesScopeGroupsNewRoute extends Route { * @return {GroupModel} */ model() { - const { id: scopeID } = this.modelFor('scopes.scope'); - return this.store.createRecord('group', { scopeID }); + const scopeModel = this.modelFor('scopes.scope'); + return this.store.createRecord('group', { type: 'group', scopeModel }); } } diff --git a/ui/core/app/routes/scopes/scope/roles.js b/ui/core/app/routes/scopes/scope/roles.js index a4d9d2c5b..f5e27a9f5 100644 --- a/ui/core/app/routes/scopes/scope/roles.js +++ b/ui/core/app/routes/scopes/scope/roles.js @@ -15,7 +15,8 @@ export default class ScopesScopeRolesRoute extends Route { * @return {Promise{[RoleModel]}} */ async model() { - return this.store.findAll('role', this.scopeAdapterOptions()); + const { id: scopeID } = this.modelFor('scopes.scope'); + return this.store.findAll('role', { adapterOptions: { scopeID } }); } // =actions @@ -57,7 +58,7 @@ export default class ScopesScopeRolesRoute extends Route { @action async delete(role) { try { - await role.destroyRecord(this.scopeAdapterOptions()); + await role.destroyRecord(); this.refresh(); this.notify.success(this.intl.t('notify.delete-success')); this.transitionTo('scopes.scope.roles'); @@ -66,9 +67,4 @@ export default class ScopesScopeRolesRoute extends Route { this.notify.error(error.message, { closeAfter: null }); } } - - scopeAdapterOptions() { - const { id: scopeID } = this.modelFor('scopes.scope'); - return { adapterOptions: { scopeID } }; - } } diff --git a/ui/core/app/routes/scopes/scope/roles/new.js b/ui/core/app/routes/scopes/scope/roles/new.js index edc239e21..bcde1bb0f 100644 --- a/ui/core/app/routes/scopes/scope/roles/new.js +++ b/ui/core/app/routes/scopes/scope/roles/new.js @@ -8,7 +8,7 @@ export default class ScopesScopeRolesNewRoute extends Route { * @return {RoleModel} */ model() { - const { id: scopeID } = this.modelFor('scopes.scope'); - return this.store.createRecord('role', { scopeID }); + const scopeModel = this.modelFor('scopes.scope'); + return this.store.createRecord('role', { type: 'role', scopeModel }); } } diff --git a/ui/core/app/routes/scopes/scope/users.js b/ui/core/app/routes/scopes/scope/users.js index 8beb4f146..6519086fd 100644 --- a/ui/core/app/routes/scopes/scope/users.js +++ b/ui/core/app/routes/scopes/scope/users.js @@ -15,7 +15,8 @@ export default class ScopesScopeUsersRoute extends Route { * @return {Promise{[UserModel]}} */ async model() { - return this.store.findAll('user', this.scopeAdapterOptions()); + const { id: scopeID } = this.modelFor('scopes.scope'); + return this.store.findAll('user', { adapterOptions: { scopeID } }); } // =actions @@ -58,7 +59,7 @@ export default class ScopesScopeUsersRoute extends Route { @action async delete(user) { try { - await user.destroyRecord(this.scopeAdapterOptions()); + await user.destroyRecord(); this.refresh(); this.notify.success(this.intl.t('notify.delete-success')); this.transitionTo('scopes.scope.users'); @@ -67,9 +68,4 @@ export default class ScopesScopeUsersRoute extends Route { this.notify.error(error.message, { closeAfter: null }); } } - - scopeAdapterOptions() { - const { id: scopeID } = this.modelFor('scopes.scope'); - return { adapterOptions: { scopeID } }; - } } diff --git a/ui/core/app/routes/scopes/scope/users/new.js b/ui/core/app/routes/scopes/scope/users/new.js index 25c4a0b52..89cca81d9 100644 --- a/ui/core/app/routes/scopes/scope/users/new.js +++ b/ui/core/app/routes/scopes/scope/users/new.js @@ -8,7 +8,7 @@ export default class ScopesScopeUsersNewRoute extends Route { * @return {UserModel} */ model() { - const { id: scopeID } = this.modelFor('scopes.scope'); - return this.store.createRecord('user', { scopeID }); + const scopeModel = this.modelFor('scopes.scope'); + return this.store.createRecord('user', { type: 'user', scopeModel }); } } From bb30bb4b5f3576d95f36f659b89a5a315145be18 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 29 Jul 2020 15:16:11 -0400 Subject: [PATCH 10/13] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Assign=20scope=20?= =?UTF-8?q?to=20IAM=20mirage=20resources?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/core/mirage/scenarios/default.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/core/mirage/scenarios/default.js b/ui/core/mirage/scenarios/default.js index 1bbae80d5..5d7b72800 100644 --- a/ui/core/mirage/scenarios/default.js +++ b/ui/core/mirage/scenarios/default.js @@ -29,12 +29,12 @@ export default function(server) { server.createList('auth-method', 3, { scope }); // User - server.createList('user', 5); + server.createList('user', 5, { scope }); // Role - server.createList('role', 5); + server.createList('role', 5, { scope }); // Groups - server.createList('group', 5); + server.createList('group', 5, { scope }); // Other resources From c9fa433663cb9aa3ba16c6d8c8e3b4ccc20cad4b Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 29 Jul 2020 15:43:09 -0400 Subject: [PATCH 11/13] =?UTF-8?q?test:=20=F0=9F=92=8D=20Refactor=20IAM=20a?= =?UTF-8?q?cceptance=20tests=20to=20use=20predefined=20ids?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/core/tests/acceptance/groups-test.js | 66 +++++++++++++++--------- ui/core/tests/acceptance/roles-test.js | 66 +++++++++++++++--------- ui/core/tests/acceptance/users-test.js | 67 +++++++++++++++---------- 3 files changed, 123 insertions(+), 76 deletions(-) diff --git a/ui/core/tests/acceptance/groups-test.js b/ui/core/tests/acceptance/groups-test.js index 2322f0882..778a71969 100644 --- a/ui/core/tests/acceptance/groups-test.js +++ b/ui/core/tests/acceptance/groups-test.js @@ -4,6 +4,12 @@ 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 { Response } from 'miragejs'; +import { + authenticateSession, + // These are left here intentionally for future reference. + //currentSession, + //invalidateSession, +} from 'ember-simple-auth/test-support'; module('Acceptance | groups', function (hooks) { setupApplicationTest(hooks); @@ -11,6 +17,7 @@ module('Acceptance | groups', function (hooks) { let orgScope; let groupsURL; + let groupURL; let newGroupURL; hooks.beforeEach(function () { @@ -22,8 +29,18 @@ module('Acceptance | groups', function (hooks) { 'withChildren' ); + const group = this.server.create('group', { + scope: { + id: orgScope.id, + type: orgScope.type + } + }); + groupsURL = `/scopes/${orgScope.id}/groups`; + groupURL = `${groupsURL}/${group.id}`; newGroupURL = `${groupsURL}/new`; + + authenticateSession({}); }); test('visiting groups', async function (assert) { @@ -33,25 +50,30 @@ module('Acceptance | groups', function (hooks) { assert.equal(currentURL(), groupsURL); }); + test('visiting a group', async function(assert) { + assert.expect(1); + await visit(newGroupURL); + await a11yAudit(); + assert.equal(currentURL(), newGroupURL); + }); + test('can create new group', async function (assert) { - assert.expect(4); - assert.equal(this.server.db.groups.length, 0); + assert.expect(1); + const groupsCount = this.server.db.groups.length; await visit(newGroupURL); await fillIn('[name="name"]', 'group name'); await click('[type="submit"]'); - assert.equal(currentURL(), `${groupsURL}/1`); - assert.equal(this.server.db.groups.length, 1); - assert.equal(this.server.db.groups[0].name, 'group name'); + assert.equal(this.server.db.groups.length, groupsCount + 1); }); test('can cancel new group creation', async function (assert) { - assert.expect(3); - assert.equal(this.server.db.groups.length, 0); + assert.expect(2); + const groupsCount = this.server.db.groups.length; await visit(newGroupURL); await fillIn('[name="name"]', 'group name'); await click('.rose-form-actions [type="button"]'); assert.equal(currentURL(), groupsURL); - assert.equal(this.server.db.groups.length, 0); + assert.equal(this.server.db.groups.length, groupsCount); }); test('saving a new group with invalid fields displays error messages', async function (assert) { @@ -92,35 +114,31 @@ module('Acceptance | groups', function (hooks) { test('can save changes to an existing group', async function (assert) { assert.expect(2); - this.server.createList('group', 1, { name: 'Admin group' }); - await visit(`${groupsURL}/1`); + await visit(groupURL); await fillIn('[name="name"]', 'Updated admin group'); await click('.rose-form-actions [type="submit"]'); - assert.equal(currentURL(), `${groupsURL}/1`); + assert.equal(currentURL(), groupURL); assert.equal(this.server.db.groups[0].name, 'Updated admin group'); }); test('can cancel changes to an existing group', async function (assert) { assert.expect(1); - this.server.createList('group', 1, { name: 'Admin group' }); - await visit(`${groupsURL}/1`); + await visit(groupURL); await fillIn('[name="name"]', 'Updated admin group'); await click('.rose-form-actions [type="button"]'); - assert.equal(find('[name="name"]').value, 'Admin group'); + assert.notEqual(find('[name="name"]').value, 'Updated admin group'); }); test('can delete a group', async function (assert) { - assert.expect(2); - this.server.createList('group', 1); - assert.equal(this.server.db.groups.length, 1); - await visit(`${groupsURL}/1`); + assert.expect(1); + const groupsCount = this.server.db.groups.length; + await visit(groupURL); await click('.rose-button-warning'); - assert.equal(this.server.db.groups.length, 0); + assert.equal(this.server.db.groups.length, groupsCount - 1); }); test('saving an existing group with invalid fields displays error messages', async function (assert) { assert.expect(2); - this.server.createList('group', 1); this.server.patch('/scopes/:scope_id/groups/:id', () => { return new Response( 400, @@ -140,7 +158,7 @@ module('Acceptance | groups', function (hooks) { } ); }); - await visit(`${groupsURL}/1`); + await visit(groupURL); await fillIn('[name="name"]', 'random string'); await click('[type="submit"]'); assert.ok( @@ -157,7 +175,6 @@ module('Acceptance | groups', function (hooks) { test('errors are displayed when save project fails', async function (assert) { assert.expect(1); - this.server.createList('group', 1); this.server.patch('/scopes/:scope_id/groups/:id', () => { return new Response( 490, @@ -169,7 +186,7 @@ module('Acceptance | groups', function (hooks) { } ); }); - await visit(`${groupsURL}/1`); + await visit(groupURL); await fillIn('[name="name"]', 'Role name'); await click('[type="submit"]'); assert.ok( @@ -181,7 +198,6 @@ module('Acceptance | groups', function (hooks) { test('errors are displayed when delete project fails', async function (assert) { assert.expect(1); - this.server.createList('group', 1); this.server.del('/scopes/:scope_id/groups/:id', () => { return new Response( 490, @@ -193,7 +209,7 @@ module('Acceptance | groups', function (hooks) { } ); }); - await visit(`${groupsURL}/1`); + await visit(groupURL); await click('.rose-button-warning'); assert.ok( find('[role="alert"]').textContent.trim(), diff --git a/ui/core/tests/acceptance/roles-test.js b/ui/core/tests/acceptance/roles-test.js index b745a0d28..ba8c85ed3 100644 --- a/ui/core/tests/acceptance/roles-test.js +++ b/ui/core/tests/acceptance/roles-test.js @@ -4,6 +4,12 @@ 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 { Response } from 'miragejs'; +import { + authenticateSession, + // These are left here intentionally for future reference. + //currentSession, + //invalidateSession, +} from 'ember-simple-auth/test-support'; module('Acceptance | roles', function (hooks) { setupApplicationTest(hooks); @@ -11,6 +17,7 @@ module('Acceptance | roles', function (hooks) { let orgScope; let rolesURL; + let roleURL; let newRoleURL; hooks.beforeEach(function () { @@ -22,8 +29,18 @@ module('Acceptance | roles', function (hooks) { 'withChildren' ); + const role = this.server.create('role', { + scope: { + id: orgScope.id, + type: orgScope.type + } + }) + rolesURL = `/scopes/${orgScope.id}/roles`; + roleURL = `${rolesURL}/${role.id}`; newRoleURL = `${rolesURL}/new`; + + authenticateSession({}); }); test('visiting roles', async function (assert) { @@ -33,25 +50,30 @@ module('Acceptance | roles', function (hooks) { assert.equal(currentURL(), rolesURL); }); + test('visiting a role', async function(assert) { + assert.expect(1); + await visit(newRoleURL); + await a11yAudit(); + assert.equal(currentURL(), newRoleURL); + }); + test('can create new role', async function (assert) { - assert.expect(4); - assert.equal(this.server.db.roles.length, 0); + assert.expect(1); + const rolesCount = this.server.db.roles.length; await visit(newRoleURL); await fillIn('[name="name"]', 'role name'); await click('[type="submit"]'); - assert.equal(currentURL(), `${rolesURL}/1`); - assert.equal(this.server.db.roles.length, 1); - assert.equal(this.server.db.roles[0].name, 'role name'); + assert.equal(this.server.db.roles.length, rolesCount + 1); }); test('can cancel new role creation', async function (assert) { - assert.expect(3); - assert.equal(this.server.db.roles.length, 0); + assert.expect(2); + const rolesCount = this.server.db.roles.length; await visit(newRoleURL); await fillIn('[name="name"]', 'role name'); await click('.rose-form-actions [type="button"]'); assert.equal(currentURL(), rolesURL); - assert.equal(this.server.db.roles.length, 0); + assert.equal(this.server.db.roles.length, rolesCount); }); test('saving a new role with invalid fields displays error messages', async function (assert) { @@ -92,35 +114,31 @@ module('Acceptance | roles', function (hooks) { test('can save changes to an existing role', async function (assert) { assert.expect(2); - this.server.createList('role', 1, { name: 'Admin role' }); - await visit(`${rolesURL}/1`); + await visit(roleURL); await fillIn('[name="name"]', 'Updated admin role'); await click('.rose-form-actions [type="submit"]'); - assert.equal(currentURL(), `${rolesURL}/1`); + assert.equal(currentURL(), roleURL); assert.equal(this.server.db.roles[0].name, 'Updated admin role'); }); test('can cancel changes to an existing role', async function (assert) { assert.expect(1); - this.server.createList('role', 1, { name: 'Admin role' }); - await visit(`${rolesURL}/1`); + await visit(roleURL); await fillIn('[name="name"]', 'Updated admin role'); await click('.rose-form-actions [type="button"]'); - assert.equal(find('[name="name"]').value, 'Admin role'); + assert.notEqual(find('[name="name"]').value, 'Updated admin role'); }); test('can delete a role', async function (assert) { - assert.expect(2); - this.server.createList('role', 1); - assert.equal(this.server.db.roles.length, 1); - await visit(`${rolesURL}/1`); + assert.expect(1); + const rolesCount = this.server.db.roles.length; + await visit(roleURL); await click('.rose-button-warning'); - assert.equal(this.server.db.roles.length, 0); + assert.equal(this.server.db.roles.length, rolesCount - 1); }); test('saving an existing role with invalid fields displays error messages', async function (assert) { assert.expect(2); - this.server.createList('role', 1); this.server.patch('/scopes/:scope_id/roles/:id', () => { return new Response( 400, @@ -140,7 +158,7 @@ module('Acceptance | roles', function (hooks) { } ); }); - await visit(`${rolesURL}/1`); + await visit(roleURL); await fillIn('[name="name"]', 'random string'); await click('[type="submit"]'); assert.ok( @@ -157,7 +175,6 @@ module('Acceptance | roles', function (hooks) { test('errors are displayed when save project fails', async function (assert) { assert.expect(1); - this.server.createList('role', 1); this.server.patch('/scopes/:scope_id/roles/:id', () => { return new Response( 490, @@ -169,7 +186,7 @@ module('Acceptance | roles', function (hooks) { } ); }); - await visit(`${rolesURL}/1`); + await visit(roleURL); await fillIn('[name="name"]', 'Role name'); await click('[type="submit"]'); assert.ok( @@ -181,7 +198,6 @@ module('Acceptance | roles', function (hooks) { test('errors are displayed when delete project fails', async function (assert) { assert.expect(1); - this.server.createList('role', 1); this.server.del('/scopes/:scope_id/roles/:id', () => { return new Response( 490, @@ -193,7 +209,7 @@ module('Acceptance | roles', function (hooks) { } ); }); - await visit(`${rolesURL}/1`); + await visit(roleURL); await click('.rose-button-warning'); assert.ok( find('[role="alert"]').textContent.trim(), diff --git a/ui/core/tests/acceptance/users-test.js b/ui/core/tests/acceptance/users-test.js index 85b187d56..eac32425c 100644 --- a/ui/core/tests/acceptance/users-test.js +++ b/ui/core/tests/acceptance/users-test.js @@ -4,6 +4,12 @@ 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 { Response } from 'miragejs'; +import { + authenticateSession, + // These are left here intentionally for future reference. + //currentSession, + //invalidateSession, +} from 'ember-simple-auth/test-support'; module('Acceptance | users', function (hooks) { setupApplicationTest(hooks); @@ -11,6 +17,7 @@ module('Acceptance | users', function (hooks) { let orgScope; let usersURL; + let userURL; let newUserURL; hooks.beforeEach(function () { @@ -22,37 +29,51 @@ module('Acceptance | users', function (hooks) { 'withChildren' ); + const user = this.server.create('user', { + scope: { + id: orgScope.id, + type: orgScope.type + } + }); + usersURL = `/scopes/${orgScope.id}/users`; + userURL = `${usersURL}/${user.id}`; newUserURL = `${usersURL}/new`; + + authenticateSession({}); }); test('visiting users', async function (assert) { assert.expect(1); - this.server.createList('user', 1); await visit(usersURL); await a11yAudit(); assert.equal(currentURL(), usersURL); }); + test('visiting a user', async function(assert) { + assert.expect(1); + await visit(newUserURL); + await a11yAudit(); + assert.equal(currentURL(), newUserURL); + }); + test('can create new users', async function (assert) { - assert.expect(4); - assert.equal(this.server.db.users.length, 0); + assert.expect(1); + const usersCount = this.server.db.users.length; await visit(newUserURL); await fillIn('[name="name"]', 'User name'); await click('[type="submit"]'); - assert.equal(currentURL(), `${usersURL}/1`); - assert.equal(this.server.db.users.length, 1); - assert.equal(this.server.db.users[0].name, 'User name'); + assert.equal(this.server.db.users.length, usersCount + 1); }); test('can cancel creation of a new user', async function (assert) { - assert.expect(3); - assert.equal(this.server.db.users.length, 0); + assert.expect(2); + const usersCount = this.server.db.users.length; await visit(newUserURL); await fillIn('[name="name"]', 'User name'); await click('.rose-form-actions [type="button"]'); assert.equal(currentURL(), usersURL); - assert.equal(this.server.db.users.length, 0); + assert.equal(this.server.db.users.length, usersCount); }); test('saving a new user with invalid fields displays error messages', async function (assert) { @@ -93,35 +114,31 @@ module('Acceptance | users', function (hooks) { test('can save changes to an existing user', async function (assert) { assert.expect(2); - this.server.createList('user', 1, { name: 'Test User' }); - await visit(`${usersURL}/1`); + await visit(userURL); await fillIn('[name="name"]', 'Updated user name'); await click('.rose-form-actions [type="submit"]'); - assert.equal(currentURL(), `${usersURL}/1`); + assert.equal(currentURL(), userURL); assert.equal(this.server.db.users[0].name, 'Updated user name'); }); test('can cancel changes to an existing user', async function (assert) { assert.expect(1); - this.server.createList('user', 1, { name: 'Test User' }); - await visit(`${usersURL}/1`); + await visit(userURL); await fillIn('[name="name"]', 'Unsaved user name'); await click('.rose-form-actions [type="button"]'); - assert.equal(find('[name="name"]').value, 'Test User'); + assert.notEqual(find('[name="name"]').value, 'Unsaved user name'); }); test('can delete an user', async function (assert) { - assert.expect(2); - this.server.createList('user', 1); - assert.equal(this.server.db.users.length, 1); - await visit(`${usersURL}/1`); + assert.expect(1); + const usersCount = this.server.db.users.length; + await visit(userURL); await click('.rose-button-warning'); - assert.equal(this.server.db.users.length, 0); + assert.equal(this.server.db.users.length, usersCount - 1); }); test('saving an existing user with invalid fields displays error messages', async function (assert) { assert.expect(2); - this.server.createList('user', 1); this.server.patch('/scopes/:scope_id/users/:id', () => { return new Response( 400, @@ -141,7 +158,7 @@ module('Acceptance | users', function (hooks) { } ); }); - await visit(`${usersURL}/1`); + await visit(userURL); await fillIn('[name="name"]', 'User name'); await click('[type="submit"]'); assert.ok( @@ -158,7 +175,6 @@ module('Acceptance | users', function (hooks) { test('errors are displayed when saving user fails', async function (assert) { assert.expect(1); - this.server.createList('user', 1); this.server.patch('/scopes/:scope_id/users/:id', () => { return new Response( 490, @@ -170,7 +186,7 @@ module('Acceptance | users', function (hooks) { } ); }); - await visit(`${usersURL}/1`); + await visit(userURL); await fillIn('[name="name"]', 'User name'); await click('[type="submit"]'); assert.ok( @@ -182,7 +198,6 @@ module('Acceptance | users', function (hooks) { test('errors are displayed when user deletion fails', async function (assert) { assert.expect(1); - this.server.createList('user', 1); this.server.del('/scopes/:scope_id/users/:id', () => { return new Response( 490, @@ -194,7 +209,7 @@ module('Acceptance | users', function (hooks) { } ); }); - await visit(`${usersURL}/1`); + await visit(userURL); await click('.rose-button-warning'); assert.ok( find('[role="alert"]').textContent.trim(), From 656e11bb527d55720f0d1c9f9cb43ba9904655d7 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 29 Jul 2020 15:47:23 -0400 Subject: [PATCH 12/13] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20"yarn=20format?= =?UTF-8?q?"=20touched=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/core/app/authenticators/password.js | 4 +-- ui/core/app/controllers/application.js | 2 -- ui/core/app/controllers/scopes/scope.js | 2 -- ui/core/app/router.js | 4 +-- ui/core/app/routes/application.js | 1 - ui/core/app/routes/index.js | 2 -- ui/core/app/routes/scopes.js | 4 +-- ui/core/app/routes/scopes/index.js | 8 ++--- ui/core/app/routes/scopes/scope.js | 13 ++++---- .../app/routes/scopes/scope/authenticate.js | 2 -- .../routes/scopes/scope/authenticate/index.js | 2 -- .../scopes/scope/authenticate/method.js | 2 -- ui/core/app/routes/scopes/scope/groups.js | 6 ++-- .../app/routes/scopes/scope/groups/group.js | 4 ++- ui/core/app/routes/scopes/scope/index.js | 2 -- ui/core/app/routes/scopes/scope/projects.js | 6 ++-- ui/core/app/routes/scopes/scope/roles.js | 6 ++-- ui/core/app/routes/scopes/scope/roles/role.js | 4 ++- ui/core/app/routes/scopes/scope/users.js | 6 ++-- ui/core/app/routes/scopes/scope/users/user.js | 4 ++- ui/core/app/session-stores/application.js | 2 -- .../tests/acceptance/authentication-test.js | 31 ++++++++++--------- ui/core/tests/acceptance/groups-test.js | 6 ++-- ui/core/tests/acceptance/roles-test.js | 8 ++--- ui/core/tests/acceptance/users-test.js | 6 ++-- .../unit/controllers/application-test.js | 4 +-- .../unit/controllers/scopes/scope-test.js | 4 +-- ui/core/tests/unit/routes/index-test.js | 4 +-- .../tests/unit/routes/scopes/index-test.js | 4 +-- .../routes/scopes/scope/authenticate-test.js | 4 +-- .../scopes/scope/authenticate/index-test.js | 4 +-- .../scopes/scope/authenticate/method-test.js | 4 +-- .../unit/routes/scopes/scope/index-test.js | 4 +-- 33 files changed, 78 insertions(+), 91 deletions(-) diff --git a/ui/core/app/authenticators/password.js b/ui/core/app/authenticators/password.js index 41e75d078..a70c89ac7 100644 --- a/ui/core/app/authenticators/password.js +++ b/ui/core/app/authenticators/password.js @@ -7,7 +7,6 @@ import { inject as service } from '@ember/service'; * endpoint, while deauthentication occurs on a scope endpoint. */ export default class PasswordAuthenticator extends BasePasswordAuthenticator { - // =services @service store; @@ -24,7 +23,7 @@ export default class PasswordAuthenticator extends BasePasswordAuthenticator { */ buildAuthEndpointURL({ scope: { id: scopeID }, - authMethod: { id: authMethodID } + authMethod: { id: authMethodID }, }) { const adapter = this.store.adapterFor('application'); const options = { adapterOptions: { scopeID, method: 'authenticate' } }; @@ -43,5 +42,4 @@ export default class PasswordAuthenticator extends BasePasswordAuthenticator { const options = { adapterOptions: { method: 'deauthenticate' } }; return adapter.buildURL('scope', scopeID, options, 'findRecord'); } - } diff --git a/ui/core/app/controllers/application.js b/ui/core/app/controllers/application.js index 3fd811d62..565eb7d7a 100644 --- a/ui/core/app/controllers/application.js +++ b/ui/core/app/controllers/application.js @@ -2,9 +2,7 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; export default class ApplicationController extends Controller { - // =services @service session; - } diff --git a/ui/core/app/controllers/scopes/scope.js b/ui/core/app/controllers/scopes/scope.js index 5bc636752..de850e223 100644 --- a/ui/core/app/controllers/scopes/scope.js +++ b/ui/core/app/controllers/scopes/scope.js @@ -2,9 +2,7 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; export default class ScopesScopeController extends Controller { - // =services @service session; - } diff --git a/ui/core/app/router.js b/ui/core/app/router.js index 7bac5667e..a00ddbad3 100644 --- a/ui/core/app/router.js +++ b/ui/core/app/router.js @@ -9,8 +9,8 @@ export default class Router extends EmberRouter { Router.map(function () { this.route('scopes', function () { this.route('scope', { path: ':scope_id' }, function () { - this.route('authenticate', function() { - this.route('method', { path: ':auth_method_id'}); + this.route('authenticate', function () { + this.route('method', { path: ':auth_method_id' }); }); this.route('projects', function () { this.route('project', { path: ':project_id' }, function () {}); diff --git a/ui/core/app/routes/application.js b/ui/core/app/routes/application.js index 024a0b887..e67f524e1 100644 --- a/ui/core/app/routes/application.js +++ b/ui/core/app/routes/application.js @@ -12,7 +12,6 @@ import { later } from '@ember/runloop'; export default class ApplicationRoute extends Route.extend( ApplicationRouteMixin ) { - // =services @service session; diff --git a/ui/core/app/routes/index.js b/ui/core/app/routes/index.js index 4ec1a62b0..c8728d037 100644 --- a/ui/core/app/routes/index.js +++ b/ui/core/app/routes/index.js @@ -1,7 +1,6 @@ import Route from '@ember/routing/route'; export default class IndexRoute extends Route { - // =methods /** @@ -10,5 +9,4 @@ export default class IndexRoute extends Route { redirect() { this.transitionTo('scopes'); } - } diff --git a/ui/core/app/routes/scopes.js b/ui/core/app/routes/scopes.js index 86a9452fd..337b319c9 100644 --- a/ui/core/app/routes/scopes.js +++ b/ui/core/app/routes/scopes.js @@ -2,7 +2,6 @@ import Route from '@ember/routing/route'; import { A } from '@ember/array'; export default class ScopesRoute extends Route { - // =methods /** @@ -20,5 +19,4 @@ export default class ScopesRoute extends Route { // expected to default to the global scope, thus returning org scopes. return this.store.findAll('scope').catch(() => A([])); } - -} \ No newline at end of file +} diff --git a/ui/core/app/routes/scopes/index.js b/ui/core/app/routes/scopes/index.js index 06a263171..562a27a15 100644 --- a/ui/core/app/routes/scopes/index.js +++ b/ui/core/app/routes/scopes/index.js @@ -3,7 +3,6 @@ import { inject as service } from '@ember/service'; import { get } from '@ember/object'; export default class ScopesIndexRoute extends Route { - // =services @service session; @@ -17,13 +16,14 @@ export default class ScopesIndexRoute extends Route { * @param {?ScopeModel} model.firstObject */ redirect({ firstObject }) { - const authenticatedScopeID = - get(this.session, 'data.authenticated.scope.id'); + const authenticatedScopeID = get( + this.session, + 'data.authenticated.scope.id' + ); if (authenticatedScopeID) { this.transitionTo('scopes.scope', authenticatedScopeID); } else if (firstObject) { this.transitionTo('scopes.scope', firstObject.id); } } - } diff --git a/ui/core/app/routes/scopes/scope.js b/ui/core/app/routes/scopes/scope.js index e9f2c191c..2707a238b 100644 --- a/ui/core/app/routes/scopes/scope.js +++ b/ui/core/app/routes/scopes/scope.js @@ -14,12 +14,11 @@ export default class ScopesScopeRoute extends Route { * @return {Promise{ScopeModel}} */ model({ scope_id: id }) { - return this.store.findRecord('scope', id) - .catch(() => { - const maybeExistingScope = this.store.peekRecord('scope', id); - // TODO it's unclear if creating a temporary unsaved scope is reliable - // we may need to revert to a POJO. - return maybeExistingScope || this.store.createRecord('scope', { id }); - }); + return this.store.findRecord('scope', id).catch(() => { + const maybeExistingScope = this.store.peekRecord('scope', id); + // TODO it's unclear if creating a temporary unsaved scope is reliable + // we may need to revert to a POJO. + return maybeExistingScope || this.store.createRecord('scope', { id }); + }); } } diff --git a/ui/core/app/routes/scopes/scope/authenticate.js b/ui/core/app/routes/scopes/scope/authenticate.js index 93f565baa..d7dae560d 100644 --- a/ui/core/app/routes/scopes/scope/authenticate.js +++ b/ui/core/app/routes/scopes/scope/authenticate.js @@ -3,7 +3,6 @@ import { inject as service } from '@ember/service'; import { hash } from 'rsvp'; export default class ScopesScopeAuthenticateRoute extends Route { - // =services @service session; @@ -41,5 +40,4 @@ export default class ScopesScopeAuthenticateRoute extends Route { this.transitionTo(this.routeIfAlreadyAuthenticated); } } - } diff --git a/ui/core/app/routes/scopes/scope/authenticate/index.js b/ui/core/app/routes/scopes/scope/authenticate/index.js index 5ee523b46..9d6ce9d61 100644 --- a/ui/core/app/routes/scopes/scope/authenticate/index.js +++ b/ui/core/app/routes/scopes/scope/authenticate/index.js @@ -1,7 +1,6 @@ import Route from '@ember/routing/route'; export default class ScopesScopeAuthenticateIndexRoute extends Route { - // =methods /** @@ -16,5 +15,4 @@ export default class ScopesScopeAuthenticateIndexRoute extends Route { this.transitionTo('scopes.scope.authenticate.method', firstAuthMethod); } } - } diff --git a/ui/core/app/routes/scopes/scope/authenticate/method.js b/ui/core/app/routes/scopes/scope/authenticate/method.js index b52406722..5208b152d 100644 --- a/ui/core/app/routes/scopes/scope/authenticate/method.js +++ b/ui/core/app/routes/scopes/scope/authenticate/method.js @@ -3,7 +3,6 @@ import { inject as service } from '@ember/service'; import { action } from '@ember/object'; export default class ScopesScopeAuthenticateMethodRoute extends Route { - // =services @service session; @@ -62,5 +61,4 @@ export default class ScopesScopeAuthenticateMethodRoute extends Route { this.notify.error(errorMessage, { closeAfter: null }); } } - } diff --git a/ui/core/app/routes/scopes/scope/groups.js b/ui/core/app/routes/scopes/scope/groups.js index ea24aa58e..7eed4406e 100644 --- a/ui/core/app/routes/scopes/scope/groups.js +++ b/ui/core/app/routes/scopes/scope/groups.js @@ -41,9 +41,9 @@ export default class ScopesScopeGroupsRoute extends Route { try { await group.save(); this.refresh(); - this.notify.success(this.intl.t( - isNew ? 'notify.create-success' : 'notify.save-success' - )); + this.notify.success( + this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success') + ); this.transitionTo('scopes.scope.groups.group', group); } catch (error) { //TODO: replace with translated strings diff --git a/ui/core/app/routes/scopes/scope/groups/group.js b/ui/core/app/routes/scopes/scope/groups/group.js index ce0585e8d..6231ab13f 100644 --- a/ui/core/app/routes/scopes/scope/groups/group.js +++ b/ui/core/app/routes/scopes/scope/groups/group.js @@ -11,6 +11,8 @@ export default class ScopesScopeGroupsGroupRoute extends Route { */ async model({ group_id }) { const { id: scopeID } = this.modelFor('scopes.scope'); - return this.store.findRecord('group', group_id, { adapterOptions: { scopeID } }); + return this.store.findRecord('group', group_id, { + adapterOptions: { scopeID }, + }); } } diff --git a/ui/core/app/routes/scopes/scope/index.js b/ui/core/app/routes/scopes/scope/index.js index 0215ea9da..36261b82d 100644 --- a/ui/core/app/routes/scopes/scope/index.js +++ b/ui/core/app/routes/scopes/scope/index.js @@ -1,7 +1,6 @@ import Route from '@ember/routing/route'; export default class ScopesScopeIndexRoute extends Route { - // =methods /** @@ -10,5 +9,4 @@ export default class ScopesScopeIndexRoute extends Route { redirect() { this.transitionTo('scopes.scope.authenticate'); } - } diff --git a/ui/core/app/routes/scopes/scope/projects.js b/ui/core/app/routes/scopes/scope/projects.js index 2e5835d63..8d9ef9c00 100644 --- a/ui/core/app/routes/scopes/scope/projects.js +++ b/ui/core/app/routes/scopes/scope/projects.js @@ -65,9 +65,9 @@ export default class ScopesScopeProjectsRoute extends Route { try { await project.save(); this.refresh(); - this.notify.success(this.intl.t( - isNew ? 'notify.create-success' : 'notify.save-success' - )); + this.notify.success( + this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success') + ); this.transitionTo('scopes.scope.projects.project', project); } catch (error) { // TODO: replace with translated strings diff --git a/ui/core/app/routes/scopes/scope/roles.js b/ui/core/app/routes/scopes/scope/roles.js index f5e27a9f5..84cf2ae0f 100644 --- a/ui/core/app/routes/scopes/scope/roles.js +++ b/ui/core/app/routes/scopes/scope/roles.js @@ -41,9 +41,9 @@ export default class ScopesScopeRolesRoute extends Route { try { await role.save(); this.refresh(); - this.notify.success(this.intl.t( - isNew ? 'notify.create-success' : 'notify.save-success' - )); + this.notify.success( + this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success') + ); this.transitionTo('scopes.scope.roles.role', role); } catch (error) { // TODO: replace with translated strings diff --git a/ui/core/app/routes/scopes/scope/roles/role.js b/ui/core/app/routes/scopes/scope/roles/role.js index 98cbffcd0..7fb8d3db7 100644 --- a/ui/core/app/routes/scopes/scope/roles/role.js +++ b/ui/core/app/routes/scopes/scope/roles/role.js @@ -11,6 +11,8 @@ export default class ScopesScopeRolesRoleRoute extends Route { */ async model({ role_id }) { const { id: scopeID } = this.modelFor('scopes.scope'); - return this.store.findRecord('role', role_id, { adapterOptions: { scopeID } }); + return this.store.findRecord('role', role_id, { + adapterOptions: { scopeID }, + }); } } diff --git a/ui/core/app/routes/scopes/scope/users.js b/ui/core/app/routes/scopes/scope/users.js index 6519086fd..f1982b769 100644 --- a/ui/core/app/routes/scopes/scope/users.js +++ b/ui/core/app/routes/scopes/scope/users.js @@ -42,9 +42,9 @@ export default class ScopesScopeUsersRoute extends Route { try { await user.save(); this.refresh(); - this.notify.success(this.intl.t( - isNew ? 'notify.create-success' : 'notify.save-success' - )); + this.notify.success( + this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success') + ); this.transitionTo('scopes.scope.users.user', user); } catch (error) { // TODO: replace with translated strings diff --git a/ui/core/app/routes/scopes/scope/users/user.js b/ui/core/app/routes/scopes/scope/users/user.js index b2bcc0911..ffbf19e7e 100644 --- a/ui/core/app/routes/scopes/scope/users/user.js +++ b/ui/core/app/routes/scopes/scope/users/user.js @@ -11,6 +11,8 @@ export default class ScopesScopeUsersUserRoute extends Route { */ async model({ user_id }) { const { id: scopeID } = this.modelFor('scopes.scope'); - return this.store.findRecord('user', user_id, { adapterOptions: { scopeID } }); + return this.store.findRecord('user', user_id, { + adapterOptions: { scopeID }, + }); } } diff --git a/ui/core/app/session-stores/application.js b/ui/core/app/session-stores/application.js index 80d0603db..48b3bc4be 100644 --- a/ui/core/app/session-stores/application.js +++ b/ui/core/app/session-stores/application.js @@ -4,7 +4,6 @@ import { get } from '@ember/object'; //import config from '../config/environment'; export default class ApplicationSessionStore extends LocalStorageSessionStore { - @service store; /** @@ -41,7 +40,6 @@ export default class ApplicationSessionStore extends LocalStorageSessionStore { const authenticated = get(sessionData, 'authenticated'); if (scope && authenticated) authenticated.scope = scope; } - } // import CookieSessionStore from 'auth/session-stores/cookie'; diff --git a/ui/core/tests/acceptance/authentication-test.js b/ui/core/tests/acceptance/authentication-test.js index f6fa1c8ab..3481337bb 100644 --- a/ui/core/tests/acceptance/authentication-test.js +++ b/ui/core/tests/acceptance/authentication-test.js @@ -9,7 +9,7 @@ import { invalidateSession, } from 'ember-simple-auth/test-support'; -module('Acceptance | authentication', function(hooks) { +module('Acceptance | authentication', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); @@ -30,10 +30,14 @@ module('Acceptance | authentication', function(hooks) { invalidateSession(); indexURL = '/'; globalScope = this.server.create('scope', { id: 'global' }); - orgScope = this.server.create('scope', { - type: 'org', - scope: { id: globalScope.id, type: globalScope.type } - }, 'withChildren'); + orgScope = this.server.create( + 'scope', + { + type: 'org', + scope: { id: globalScope.id, type: globalScope.type }, + }, + 'withChildren' + ); scope = { id: orgScope.id, type: orgScope.type }; authMethod = this.server.create('auth-method', { scope }); orgScopeID = orgScope.id; @@ -45,14 +49,14 @@ module('Acceptance | authentication', function(hooks) { projectsURL = `/scopes/${orgScopeID}/projects`; }); - test('visiting auth methods authenticate route redirects to first auth method', async function(assert) { + test('visiting auth methods authenticate route redirects to first auth method', async function (assert) { assert.expect(1); await visit(authenticateURL); await a11yAudit(); assert.equal(currentURL(), authMethodAuthenticateURL); }); - test('visiting any authentication parent route while unauthenticated redirects to first authenticate method', async function(assert) { + test('visiting any authentication parent route while unauthenticated redirects to first authenticate method', async function (assert) { assert.expect(3); await visit(indexURL); assert.equal(currentURL(), authMethodAuthenticateURL); @@ -61,21 +65,21 @@ module('Acceptance | authentication', function(hooks) { assert.notOk(currentSession().isAuthenticated); }); - test('visiting projects while unauthenticated redirects to first authenticate method', async function(assert) { + test('visiting projects while unauthenticated redirects to first authenticate method', async function (assert) { assert.expect(2); await visit(projectsURL); assert.equal(currentURL(), authMethodAuthenticateURL); assert.notOk(currentSession().isAuthenticated); }); - test('visiting auth method authenticate route', async function(assert) { + test('visiting auth method authenticate route', async function (assert) { assert.expect(1); await visit(authMethodAuthenticateURL); await a11yAudit(); assert.equal(currentURL(), authMethodAuthenticateURL); }); - test('visiting any authentication parent route while already authenticated redirects to projects', async function(assert) { + test('visiting any authentication parent route while already authenticated redirects to projects', async function (assert) { assert.expect(6); authenticateSession({ scope }); await visit(indexURL); @@ -91,7 +95,7 @@ module('Acceptance | authentication', function(hooks) { assert.ok(currentSession().isAuthenticated); }); - test('failed authentication shows a notification message', async function(assert) { + test('failed authentication shows a notification message', async function (assert) { assert.expect(3); await visit(authMethodAuthenticateURL); assert.notOk(currentSession().isAuthenticated); @@ -101,7 +105,7 @@ module('Acceptance | authentication', function(hooks) { assert.notOk(currentSession().isAuthenticated); }); - test('successful authentication redirects to projects', async function(assert) { + test('successful authentication redirects to projects', async function (assert) { assert.expect(4); await visit(authMethodAuthenticateURL); assert.notOk(currentSession().isAuthenticated); @@ -113,7 +117,7 @@ module('Acceptance | authentication', function(hooks) { assert.ok(currentSession().isAuthenticated); }); - test('deauthentication redirects to first authenticate method', async function(assert) { + test('deauthentication redirects to first authenticate method', async function (assert) { assert.expect(3); await visit(authMethodAuthenticateURL); await fillIn('[name="identification"]', 'test'); @@ -124,5 +128,4 @@ module('Acceptance | authentication', function(hooks) { assert.notOk(currentSession().isAuthenticated); assert.equal(currentURL(), authMethodAuthenticateURL); }); - }); diff --git a/ui/core/tests/acceptance/groups-test.js b/ui/core/tests/acceptance/groups-test.js index 778a71969..b619d09ce 100644 --- a/ui/core/tests/acceptance/groups-test.js +++ b/ui/core/tests/acceptance/groups-test.js @@ -32,8 +32,8 @@ module('Acceptance | groups', function (hooks) { const group = this.server.create('group', { scope: { id: orgScope.id, - type: orgScope.type - } + type: orgScope.type, + }, }); groupsURL = `/scopes/${orgScope.id}/groups`; @@ -50,7 +50,7 @@ module('Acceptance | groups', function (hooks) { assert.equal(currentURL(), groupsURL); }); - test('visiting a group', async function(assert) { + test('visiting a group', async function (assert) { assert.expect(1); await visit(newGroupURL); await a11yAudit(); diff --git a/ui/core/tests/acceptance/roles-test.js b/ui/core/tests/acceptance/roles-test.js index ba8c85ed3..dd8483574 100644 --- a/ui/core/tests/acceptance/roles-test.js +++ b/ui/core/tests/acceptance/roles-test.js @@ -32,9 +32,9 @@ module('Acceptance | roles', function (hooks) { const role = this.server.create('role', { scope: { id: orgScope.id, - type: orgScope.type - } - }) + type: orgScope.type, + }, + }); rolesURL = `/scopes/${orgScope.id}/roles`; roleURL = `${rolesURL}/${role.id}`; @@ -50,7 +50,7 @@ module('Acceptance | roles', function (hooks) { assert.equal(currentURL(), rolesURL); }); - test('visiting a role', async function(assert) { + test('visiting a role', async function (assert) { assert.expect(1); await visit(newRoleURL); await a11yAudit(); diff --git a/ui/core/tests/acceptance/users-test.js b/ui/core/tests/acceptance/users-test.js index eac32425c..31fa5c98e 100644 --- a/ui/core/tests/acceptance/users-test.js +++ b/ui/core/tests/acceptance/users-test.js @@ -32,8 +32,8 @@ module('Acceptance | users', function (hooks) { const user = this.server.create('user', { scope: { id: orgScope.id, - type: orgScope.type - } + type: orgScope.type, + }, }); usersURL = `/scopes/${orgScope.id}/users`; @@ -50,7 +50,7 @@ module('Acceptance | users', function (hooks) { assert.equal(currentURL(), usersURL); }); - test('visiting a user', async function(assert) { + test('visiting a user', async function (assert) { assert.expect(1); await visit(newUserURL); await a11yAudit(); diff --git a/ui/core/tests/unit/controllers/application-test.js b/ui/core/tests/unit/controllers/application-test.js index 93d19cebe..eb120e471 100644 --- a/ui/core/tests/unit/controllers/application-test.js +++ b/ui/core/tests/unit/controllers/application-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | application', function(hooks) { +module('Unit | Controller | application', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:application'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/controllers/scopes/scope-test.js b/ui/core/tests/unit/controllers/scopes/scope-test.js index ec2c389bb..1ac27e62b 100644 --- a/ui/core/tests/unit/controllers/scopes/scope-test.js +++ b/ui/core/tests/unit/controllers/scopes/scope-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | scopes/scope', function(hooks) { +module('Unit | Controller | scopes/scope', function (hooks) { setupTest(hooks); // Replace this with your real tests. - test('it exists', function(assert) { + test('it exists', function (assert) { let controller = this.owner.lookup('controller:scopes/scope'); assert.ok(controller); }); diff --git a/ui/core/tests/unit/routes/index-test.js b/ui/core/tests/unit/routes/index-test.js index eaaac17bc..01131fb9a 100644 --- a/ui/core/tests/unit/routes/index-test.js +++ b/ui/core/tests/unit/routes/index-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | index', function(hooks) { +module('Unit | Route | index', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:index'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/scopes/index-test.js b/ui/core/tests/unit/routes/scopes/index-test.js index c2fb98357..22a5c073a 100644 --- a/ui/core/tests/unit/routes/scopes/index-test.js +++ b/ui/core/tests/unit/routes/scopes/index-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | scopes/index', function(hooks) { +module('Unit | Route | scopes/index', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:scopes/index'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/scopes/scope/authenticate-test.js b/ui/core/tests/unit/routes/scopes/scope/authenticate-test.js index 2ee818453..5a1db715d 100644 --- a/ui/core/tests/unit/routes/scopes/scope/authenticate-test.js +++ b/ui/core/tests/unit/routes/scopes/scope/authenticate-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | scopes/scope/authenticate', function(hooks) { +module('Unit | Route | scopes/scope/authenticate', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:scopes/scope/authenticate'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/scopes/scope/authenticate/index-test.js b/ui/core/tests/unit/routes/scopes/scope/authenticate/index-test.js index 88d5a1121..d9e86f2da 100644 --- a/ui/core/tests/unit/routes/scopes/scope/authenticate/index-test.js +++ b/ui/core/tests/unit/routes/scopes/scope/authenticate/index-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | scopes/scope/authenticate/index', function(hooks) { +module('Unit | Route | scopes/scope/authenticate/index', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:scopes/scope/authenticate/index'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/scopes/scope/authenticate/method-test.js b/ui/core/tests/unit/routes/scopes/scope/authenticate/method-test.js index 5aed2aefe..f077f994b 100644 --- a/ui/core/tests/unit/routes/scopes/scope/authenticate/method-test.js +++ b/ui/core/tests/unit/routes/scopes/scope/authenticate/method-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | scopes/scope/authenticate/method', function(hooks) { +module('Unit | Route | scopes/scope/authenticate/method', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:scopes/scope/authenticate/method'); assert.ok(route); }); diff --git a/ui/core/tests/unit/routes/scopes/scope/index-test.js b/ui/core/tests/unit/routes/scopes/scope/index-test.js index ba0a5bdba..c623e801b 100644 --- a/ui/core/tests/unit/routes/scopes/scope/index-test.js +++ b/ui/core/tests/unit/routes/scopes/scope/index-test.js @@ -1,10 +1,10 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | scopes/scope/index', function(hooks) { +module('Unit | Route | scopes/scope/index', function (hooks) { setupTest(hooks); - test('it exists', function(assert) { + test('it exists', function (assert) { let route = this.owner.lookup('route:scopes/scope/index'); assert.ok(route); }); From b8c2770745a03cc1de624308b0456930e5cd52b7 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Thu, 30 Jul 2020 11:32:34 -0400 Subject: [PATCH 13/13] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Do=20not=20set=20?= =?UTF-8?q?"type"=20for=20IAM=20when=20using=20scopeModel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/core/app/routes/scopes/scope/groups/new.js | 2 +- ui/core/app/routes/scopes/scope/roles/new.js | 2 +- ui/core/app/routes/scopes/scope/users/new.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/core/app/routes/scopes/scope/groups/new.js b/ui/core/app/routes/scopes/scope/groups/new.js index fe281afb2..baf98da65 100644 --- a/ui/core/app/routes/scopes/scope/groups/new.js +++ b/ui/core/app/routes/scopes/scope/groups/new.js @@ -9,6 +9,6 @@ export default class ScopesScopeGroupsNewRoute extends Route { */ model() { const scopeModel = this.modelFor('scopes.scope'); - return this.store.createRecord('group', { type: 'group', scopeModel }); + return this.store.createRecord('group', { scopeModel }); } } diff --git a/ui/core/app/routes/scopes/scope/roles/new.js b/ui/core/app/routes/scopes/scope/roles/new.js index bcde1bb0f..6b5e27688 100644 --- a/ui/core/app/routes/scopes/scope/roles/new.js +++ b/ui/core/app/routes/scopes/scope/roles/new.js @@ -9,6 +9,6 @@ export default class ScopesScopeRolesNewRoute extends Route { */ model() { const scopeModel = this.modelFor('scopes.scope'); - return this.store.createRecord('role', { type: 'role', scopeModel }); + return this.store.createRecord('role', { scopeModel }); } } diff --git a/ui/core/app/routes/scopes/scope/users/new.js b/ui/core/app/routes/scopes/scope/users/new.js index 89cca81d9..469680a4e 100644 --- a/ui/core/app/routes/scopes/scope/users/new.js +++ b/ui/core/app/routes/scopes/scope/users/new.js @@ -9,6 +9,6 @@ export default class ScopesScopeUsersNewRoute extends Route { */ model() { const scopeModel = this.modelFor('scopes.scope'); - return this.store.createRecord('user', { type: 'user', scopeModel }); + return this.store.createRecord('user', { scopeModel }); } }