diff --git a/ui/core/app/components/bread-crumbs.hbs b/ui/core/app/components/bread-crumbs.hbs index f969028c6..3c30c0e0c 100644 --- a/ui/core/app/components/bread-crumbs.hbs +++ b/ui/core/app/components/bread-crumbs.hbs @@ -1,15 +1,37 @@ -{{#if this.breadCrumbs}} - - {{#each this.breadCrumbs as |crumb|}} - {{#if crumb.model}} - - {{crumb.label}} + + + {{#if this.scope.org}} + {{#unless this.scope.org.isGlobal}} + {{#if this.session.data.authenticated.isGlobal}} + + {{t "resources.org.title_plural"}} - {{else}} - - {{crumb.label}} + + {{this.scope.org.displayName}} {{/if}} - {{/each}} - -{{/if}} + {{/unless}} + {{/if}} + + {{#if this.scope.project}} + + {{t "resources.project.title_plural"}} + + + {{this.scope.project.displayName}} + + {{/if}} + + {{#each this.breadCrumbs as |crumb|}} + {{#if crumb.model}} + + {{crumb.label}} + + {{else}} + + {{crumb.label}} + + {{/if}} + {{/each}} + + diff --git a/ui/core/app/components/bread-crumbs.js b/ui/core/app/components/bread-crumbs.js new file mode 100644 index 000000000..38482914d --- /dev/null +++ b/ui/core/app/components/bread-crumbs.js @@ -0,0 +1,11 @@ +import BreadCrumbsComponent from 'ember-breadcrumbs/components/bread-crumbs'; +import { inject as service } from '@ember/service'; + +export default class crumbs extends BreadCrumbsComponent { + + // =services + + @service session; + @service scope; + +} diff --git a/ui/core/app/components/form/host-set/add-hosts/index.hbs b/ui/core/app/components/form/host-set/add-hosts/index.hbs index 0ff9064ee..1d467c2ef 100644 --- a/ui/core/app/components/form/host-set/add-hosts/index.hbs +++ b/ui/core/app/components/form/host-set/add-hosts/index.hbs @@ -47,7 +47,7 @@ {{t "resources.host-set.host.messages.add-none.description"}} - + {{t "actions.back"}} diff --git a/ui/core/app/components/form/host-set/create-host/index.hbs b/ui/core/app/components/form/host-set/create-host/index.hbs deleted file mode 100644 index e12cabec9..000000000 --- a/ui/core/app/components/form/host-set/create-host/index.hbs +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - {{#if @model.host.errors.name}} - - {{#each @model.host.errors.name as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - {{#if @model.host.errors.description}} - - {{#each @model.host.errors.description as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - {{#if @model.host.errors.name}} - - {{#each @model.host.errors.name as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - - diff --git a/ui/core/app/components/form/project/index.hbs b/ui/core/app/components/form/project/index.hbs deleted file mode 100644 index 0e024b1fb..000000000 --- a/ui/core/app/components/form/project/index.hbs +++ /dev/null @@ -1,53 +0,0 @@ - - - - {{#if @model.errors.name}} - - {{#each @model.errors.name as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - {{#if @model.errors.description}} - - {{#each @model.errors.description as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - - diff --git a/ui/core/app/components/form/org/index.hbs b/ui/core/app/components/form/scope/index.hbs similarity index 100% rename from ui/core/app/components/form/org/index.hbs rename to ui/core/app/components/form/scope/index.hbs diff --git a/ui/core/app/components/form/target/add-host-sets/index.hbs b/ui/core/app/components/form/target/add-host-sets/index.hbs index 545f45f91..372c52f69 100644 --- a/ui/core/app/components/form/target/add-host-sets/index.hbs +++ b/ui/core/app/components/form/target/add-host-sets/index.hbs @@ -51,7 +51,7 @@ {{t "resources.target.host-set.messages.none.description"}} - + {{t "actions.back"}} diff --git a/ui/core/app/controllers/scopes/scope/auth-methods/auth-method/accounts/account/set-password.js b/ui/core/app/controllers/scopes/scope/auth-methods/auth-method/accounts/account/set-password.js new file mode 100644 index 000000000..b4fb1d989 --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/auth-methods/auth-method/accounts/account/set-password.js @@ -0,0 +1,18 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountSetPasswordController extends Controller { + // =services + + @service intl; + + // =attributes + + /** + * Translated users breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.intl.t('actions.set-password'); + } +} diff --git a/ui/core/app/controllers/scopes/scope/orgs.js b/ui/core/app/controllers/scopes/scope/groups/group/members.js similarity index 53% rename from ui/core/app/controllers/scopes/scope/orgs.js rename to ui/core/app/controllers/scopes/scope/groups/group/members.js index d52189e5f..59af4a9e2 100644 --- a/ui/core/app/controllers/scopes/scope/orgs.js +++ b/ui/core/app/controllers/scopes/scope/groups/group/members.js @@ -1,7 +1,7 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; -export default class ScopesScopeOrgsController extends Controller { +export default class ScopesScopeGroupsGroupMembersController extends Controller { // =services @service intl; @@ -9,9 +9,10 @@ export default class ScopesScopeOrgsController extends Controller { // =attributes /** + * Translated users breadcrumb * @type {string} */ get breadCrumb() { - return this.intl.t('resources.org.title_plural'); + return this.intl.t('resources.group.messages.members.title'); } } diff --git a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs.js b/ui/core/app/controllers/scopes/scope/host-catalogs.js similarity index 71% rename from ui/core/app/controllers/scopes/scope/projects/project/host-catalogs.js rename to ui/core/app/controllers/scopes/scope/host-catalogs.js index 5e90268a0..542fc1ba4 100644 --- a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs.js +++ b/ui/core/app/controllers/scopes/scope/host-catalogs.js @@ -1,7 +1,7 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; -export default class ScopesScopeProjectsProjectHostCatalogsController extends Controller { +export default class ScopesScopeHostCatalogsController extends Controller { // =services @service intl; @@ -9,6 +9,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsController extends Co // =attributes /** + * Translated roles breadcrumb * @type {string} */ get breadCrumb() { diff --git a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog.js b/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog.js similarity index 58% rename from ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog.js rename to ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog.js index 333fbfe1a..3fc3cbe18 100644 --- a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog.js +++ b/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog.js @@ -1,9 +1,10 @@ import Controller from '@ember/controller'; -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogController extends Controller { +export default class ScopesScopeHostCatalogsHostCatalogController extends Controller { // =attributes /** + * A role breadcrumb * @type {string} */ get breadCrumb() { diff --git a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets.js b/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets.js similarity index 66% rename from ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets.js rename to ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets.js index 2ec9620d3..bb139e823 100644 --- a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets.js +++ b/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets.js @@ -1,7 +1,7 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsController extends Controller { +export default class ScopesScopeHostCatalogsHostCatalogHostSetsController extends Controller { // =services @service intl; @@ -9,7 +9,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsCo // =attributes /** - * Host sets breadcrumb + * Translated roles breadcrumb * @type {string} */ get breadCrumb() { diff --git a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host.js b/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set.js similarity index 54% rename from ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host.js rename to ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set.js index fc59d096c..b4a591507 100644 --- a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host.js +++ b/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set.js @@ -1,10 +1,10 @@ import Controller from '@ember/controller'; -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsHostController extends Controller { +export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetController extends Controller { // =attributes /** - * Host breadcrumb + * A role breadcrumb * @type {string} */ get breadCrumb() { diff --git a/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts.js b/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts.js new file mode 100644 index 000000000..aa59cb3e1 --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts.js @@ -0,0 +1,18 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetAddHostsController extends Controller { + // =services + + @service intl; + + // =attributes + + /** + * Translated roles breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.intl.t('resources.host-set.actions.add-hosts'); + } +} diff --git a/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host.js b/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host.js new file mode 100644 index 000000000..209919d33 --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host.js @@ -0,0 +1,18 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetCreateAndAddHostController extends Controller { + // =services + + @service intl; + + // =attributes + + /** + * Translated roles breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.intl.t('resources.host-set.actions.create-and-add-host'); + } +} diff --git a/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts.js b/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts.js new file mode 100644 index 000000000..60464a8cd --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts.js @@ -0,0 +1,18 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetHostsController extends Controller { + // =services + + @service intl; + + // =attributes + + /** + * Translated roles breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.intl.t('resources.host.title_plural'); + } +} diff --git a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/hosts.js b/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/hosts.js similarity index 67% rename from ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/hosts.js rename to ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/hosts.js index 589649129..437f35159 100644 --- a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/hosts.js +++ b/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/hosts.js @@ -1,7 +1,7 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsController extends Controller { +export default class ScopesScopeHostCatalogsHostCatalogHostsController extends Controller { // =services @service intl; @@ -9,7 +9,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsContr // =attributes /** - * Hosts breadcrumb + * Translated roles breadcrumb * @type {string} */ get breadCrumb() { diff --git a/ui/core/app/controllers/scopes/scope/projects/project/targets/target.js b/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/hosts/host.js similarity index 56% rename from ui/core/app/controllers/scopes/scope/projects/project/targets/target.js rename to ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/hosts/host.js index 4cad64e2b..4986888a0 100644 --- a/ui/core/app/controllers/scopes/scope/projects/project/targets/target.js +++ b/ui/core/app/controllers/scopes/scope/host-catalogs/host-catalog/hosts/host.js @@ -1,10 +1,10 @@ import Controller from '@ember/controller'; -export default class ScopesScopeProjectsProjectTargetsTargetController extends Controller { +export default class ScopesScopeHostCatalogsHostCatalogHostsHostController extends Controller { // =attributes /** - * A target breadcrumb + * A role breadcrumb * @type {string} */ get breadCrumb() { diff --git a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.js b/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.js deleted file mode 100644 index 8e59a9fa9..000000000 --- a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.js +++ /dev/null @@ -1,13 +0,0 @@ -import Controller from '@ember/controller'; - -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetController extends Controller { - // =attributes - - /** - * Host set breadcrumb - * @type {string} - */ - get breadCrumb() { - return this.model.displayName; - } -} diff --git a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host.js b/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host.js deleted file mode 100644 index e5ff5fa35..000000000 --- a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host.js +++ /dev/null @@ -1,18 +0,0 @@ -import Controller from '@ember/controller'; -import { inject as service } from '@ember/service'; - -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetCreateHostController extends Controller { - // =services - - @service intl; - - // =attributes - - /** - * Translated new host set breadcrumb - * @type {string} - */ - get breadCrumb() { - return this.intl.t('resources.host-set.actions.create-host'); - } -} diff --git a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.js b/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.js deleted file mode 100644 index 8a0383067..000000000 --- a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.js +++ /dev/null @@ -1,18 +0,0 @@ -import Controller from '@ember/controller'; -import { inject as service } from '@ember/service'; - -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsNewController extends Controller { - // =services - - @service intl; - - // =attributes - - /** - * Translated new host set breadcrumb - * @type {string} - */ - get breadCrumb() { - return this.intl.t('titles.new'); - } -} diff --git a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new.js b/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new.js deleted file mode 100644 index 420a7f671..000000000 --- a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new.js +++ /dev/null @@ -1,18 +0,0 @@ -import Controller from '@ember/controller'; -import { inject as service } from '@ember/service'; - -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsNewController extends Controller { - // =services - - @service intl; - - // =attributes - - /** - * Translated new host breadcrumb - * @type {string} - */ - get breadCrumb() { - return this.intl.t('titles.new'); - } -} diff --git a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/new.js b/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/new.js deleted file mode 100644 index 040876e4f..000000000 --- a/ui/core/app/controllers/scopes/scope/projects/project/host-catalogs/new.js +++ /dev/null @@ -1,18 +0,0 @@ -import Controller from '@ember/controller'; -import { inject as service } from '@ember/service'; - -export default class ScopesScopeProjectsProjectHostCatalogsNewController 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/projects/project/targets/new.js b/ui/core/app/controllers/scopes/scope/projects/project/targets/new.js deleted file mode 100644 index 588dca4b6..000000000 --- a/ui/core/app/controllers/scopes/scope/projects/project/targets/new.js +++ /dev/null @@ -1,18 +0,0 @@ -import Controller from '@ember/controller'; -import { inject as service } from '@ember/service'; - -export default class ScopesScopeProjectsProjectTargetsNewController extends Controller { - // =services - - @service intl; - - // =attributes - - /** - * Translated new target breadcrumb - * @type {string} - */ - get breadCrumb() { - return this.intl.t('titles.new'); - } -} diff --git a/ui/core/app/controllers/scopes/scope/projects/new.js b/ui/core/app/controllers/scopes/scope/roles/role/grants.js similarity index 54% rename from ui/core/app/controllers/scopes/scope/projects/new.js rename to ui/core/app/controllers/scopes/scope/roles/role/grants.js index d1f87399f..a8cb2149f 100644 --- a/ui/core/app/controllers/scopes/scope/projects/new.js +++ b/ui/core/app/controllers/scopes/scope/roles/role/grants.js @@ -1,7 +1,7 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; -export default class ScopesScopeProjectsNewController extends Controller { +export default class ScopesScopeRolesRoleGrantsController extends Controller { // =services @service intl; @@ -9,9 +9,10 @@ export default class ScopesScopeProjectsNewController extends Controller { // =attributes /** + * Translated users breadcrumb * @type {string} */ get breadCrumb() { - return this.intl.t('titles.new'); + return this.intl.t('resources.role.grant.title_plural'); } } diff --git a/ui/core/app/controllers/scopes/scope/orgs/new.js b/ui/core/app/controllers/scopes/scope/roles/role/principals.js similarity index 53% rename from ui/core/app/controllers/scopes/scope/orgs/new.js rename to ui/core/app/controllers/scopes/scope/roles/role/principals.js index d41b81a96..a81e0eb4d 100644 --- a/ui/core/app/controllers/scopes/scope/orgs/new.js +++ b/ui/core/app/controllers/scopes/scope/roles/role/principals.js @@ -1,7 +1,7 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; -export default class ScopesScopeOrgsNewController extends Controller { +export default class ScopesScopeRolesRolePrincipalsController extends Controller { // =services @service intl; @@ -9,9 +9,10 @@ export default class ScopesScopeOrgsNewController extends Controller { // =attributes /** + * Translated users breadcrumb * @type {string} */ get breadCrumb() { - return this.intl.t('titles.new'); + return this.intl.t('resources.role.principal.title_plural'); } } diff --git a/ui/core/app/controllers/scopes/scope/scopes.js b/ui/core/app/controllers/scopes/scope/scopes.js new file mode 100644 index 000000000..05060ebd8 --- /dev/null +++ b/ui/core/app/controllers/scopes/scope/scopes.js @@ -0,0 +1,27 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; +import { computed } from '@ember/object'; + +export default class ScopesScopeScopesController extends Controller { + // =services + + @service intl; + + // =attributes + + /** + * @type {string} + */ + @computed('model.currentScope.{isGlobal,isOrg}') + get breadCrumb() { + if (this.model.currentScope.isGlobal) { + return this.intl.t('resources.org.title_plural'); + } + /* istanbul ignore else */ + if (this.model.currentScope.isOrg) { + return this.intl.t('resources.project.title_plural'); + } + /* istanbul ignore next */ + return null; + } +} diff --git a/ui/core/app/controllers/scopes/scope/projects/project/sessions.js b/ui/core/app/controllers/scopes/scope/sessions.js similarity index 71% rename from ui/core/app/controllers/scopes/scope/projects/project/sessions.js rename to ui/core/app/controllers/scopes/scope/sessions.js index 4c49105c6..470bc46a3 100644 --- a/ui/core/app/controllers/scopes/scope/projects/project/sessions.js +++ b/ui/core/app/controllers/scopes/scope/sessions.js @@ -1,8 +1,7 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; -export default class ScopesScopeProjectsProjectSessionsController extends Controller { - +export default class ScopesScopeSessionsController extends Controller { // =services @service intl; @@ -10,10 +9,10 @@ export default class ScopesScopeProjectsProjectSessionsController extends Contro // =attributes /** + * Translated roles breadcrumb * @type {string} */ get breadCrumb() { return this.intl.t('resources.session.title_plural'); } - } diff --git a/ui/core/app/controllers/scopes/scope/projects/project/targets.js b/ui/core/app/controllers/scopes/scope/targets.js similarity index 70% rename from ui/core/app/controllers/scopes/scope/projects/project/targets.js rename to ui/core/app/controllers/scopes/scope/targets.js index 9c51e3de1..e5fd8cd14 100644 --- a/ui/core/app/controllers/scopes/scope/projects/project/targets.js +++ b/ui/core/app/controllers/scopes/scope/targets.js @@ -1,7 +1,7 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; -export default class ScopesScopeProjectsProjectTargetsController extends Controller { +export default class ScopesScopeTargetsController extends Controller { // =services @service intl; @@ -9,7 +9,7 @@ export default class ScopesScopeProjectsProjectTargetsController extends Control // =attributes /** - * Targets breadcrumb + * Translated roles breadcrumb * @type {string} */ get breadCrumb() { diff --git a/ui/core/app/controllers/scopes/scope/projects/project.js b/ui/core/app/controllers/scopes/scope/targets/target.js similarity index 60% rename from ui/core/app/controllers/scopes/scope/projects/project.js rename to ui/core/app/controllers/scopes/scope/targets/target.js index 8d1219267..efef4904b 100644 --- a/ui/core/app/controllers/scopes/scope/projects/project.js +++ b/ui/core/app/controllers/scopes/scope/targets/target.js @@ -1,9 +1,10 @@ import Controller from '@ember/controller'; -export default class ScopesScopeProjectsProjectController extends Controller { +export default class ScopesScopeTargetsTargetController extends Controller { // =attributes /** + * An user breadcrumb * @type {string} */ get breadCrumb() { diff --git a/ui/core/app/controllers/scopes/scope/projects/project/targets/target/add-host-sets.js b/ui/core/app/controllers/scopes/scope/targets/target/add-host-sets.js similarity index 69% rename from ui/core/app/controllers/scopes/scope/projects/project/targets/target/add-host-sets.js rename to ui/core/app/controllers/scopes/scope/targets/target/add-host-sets.js index 8a4cb606e..6700b582d 100644 --- a/ui/core/app/controllers/scopes/scope/projects/project/targets/target/add-host-sets.js +++ b/ui/core/app/controllers/scopes/scope/targets/target/add-host-sets.js @@ -1,7 +1,7 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; -export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsController extends Controller { +export default class ScopesScopeTargetsTargetAddHostSetsController extends Controller { // =services @service intl; @@ -9,6 +9,7 @@ export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsControlle // =attributes /** + * Translated roles breadcrumb * @type {string} */ get breadCrumb() { diff --git a/ui/core/app/controllers/scopes/scope/projects/project/targets/target/host-sets.js b/ui/core/app/controllers/scopes/scope/targets/target/host-sets.js similarity index 67% rename from ui/core/app/controllers/scopes/scope/projects/project/targets/target/host-sets.js rename to ui/core/app/controllers/scopes/scope/targets/target/host-sets.js index 92a90208b..930b1e083 100644 --- a/ui/core/app/controllers/scopes/scope/projects/project/targets/target/host-sets.js +++ b/ui/core/app/controllers/scopes/scope/targets/target/host-sets.js @@ -1,7 +1,7 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; -export default class ScopesScopeProjectsProjectTargetsTargetHostSetsController extends Controller { +export default class ScopesScopeTargetsTargetHostSetsController extends Controller { // =services @service intl; @@ -9,7 +9,7 @@ export default class ScopesScopeProjectsProjectTargetsTargetHostSetsController e // =attributes /** - * Host sets breadcrumb + * Translated roles breadcrumb * @type {string} */ get breadCrumb() { diff --git a/ui/core/app/controllers/scopes/scope/projects.js b/ui/core/app/controllers/scopes/scope/users/user/accounts.js similarity index 54% rename from ui/core/app/controllers/scopes/scope/projects.js rename to ui/core/app/controllers/scopes/scope/users/user/accounts.js index fb93923df..37756e46d 100644 --- a/ui/core/app/controllers/scopes/scope/projects.js +++ b/ui/core/app/controllers/scopes/scope/users/user/accounts.js @@ -1,7 +1,7 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; -export default class ScopesScopeProjectsController extends Controller { +export default class ScopesScopeUsersUserAccountsController extends Controller { // =services @service intl; @@ -9,9 +9,10 @@ export default class ScopesScopeProjectsController extends Controller { // =attributes /** + * Translated users breadcrumb * @type {string} */ get breadCrumb() { - return this.intl.t('resources.project.title_plural'); + return this.intl.t('resources.account.title_plural'); } } diff --git a/ui/core/app/router.js b/ui/core/app/router.js index 192b9d8c5..30e882b22 100644 --- a/ui/core/app/router.js +++ b/ui/core/app/router.js @@ -13,50 +13,9 @@ Router.map(function () { this.route('method', { path: ':auth_method_id' }); }); - this.route('orgs', function () { - this.route('new'); - }); - - this.route('projects', function () { - this.route('project', { path: ':project_id' }, function () { - this.route('host-catalogs', function () { - this.route('new'); - this.route( - 'host-catalog', - { path: ':host_catalog_id' }, - function () { - this.route('host-sets', function () { - this.route('host-set', { path: ':host_set_id' }, function () { - this.route('hosts'); - this.route('add-hosts'); - this.route('create-host'); - }); - this.route('new'); - }); - this.route('hosts', function () { - this.route('host', { path: ':host_id' }, function () {}); - this.route('new'); - }); - } - ); - }); - this.route('targets', function () { - this.route('target', { path: ':target_id' }, function () { - this.route('host-sets', function () { - this.route( - 'host-set', - { path: ':host_set_id' }, - function () {} - ); - }); - this.route('add-host-sets'); - }); - this.route('new'); - }); - this.route('sessions', function() {}); - }); - this.route('new'); - }); + this.route('scopes', function() {}); + this.route('edit'); + this.route('new'); this.route('users', function () { this.route('user', { path: ':user_id' }, function () { @@ -94,6 +53,34 @@ Router.map(function () { }); this.route('new'); }); + + this.route('sessions', function() {}); + + this.route('targets', function() { + this.route('target', { path: ':target_id' }, function() { + this.route('host-sets', function() {}); + this.route('add-host-sets'); + }); + this.route('new'); + }); + + this.route('host-catalogs', function() { + this.route('new'); + this.route('host-catalog', { path: ':host_catalog_id' }, function() { + this.route('hosts', function() { + this.route('new'); + this.route('host', { path: ':host_id' }, function() {}); + }); + this.route('host-sets', function() { + this.route('new'); + this.route('host-set', { path: ':host_set_id' }, function() { + this.route('hosts'); + this.route('add-hosts'); + this.route('create-and-add-host'); + }); + }); + }); + }); }); }); diff --git a/ui/core/app/routes/scopes/scope.js b/ui/core/app/routes/scopes/scope.js index 7af8591f0..9b6720dbd 100644 --- a/ui/core/app/routes/scopes/scope.js +++ b/ui/core/app/routes/scopes/scope.js @@ -1,10 +1,17 @@ import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; +import { A } from '@ember/array'; +import { action } from '@ember/object'; +import loading from 'ember-loading/decorator'; +import { confirm } from '../../decorators/confirm'; +import { notifySuccess, notifyError } from '../../decorators/notify'; export default class ScopesScopeRoute extends Route { // =services @service intl; + @service session; + @service scope; // =methods @@ -25,6 +32,7 @@ export default class ScopesScopeRoute extends Route { return this.store.findRecord('scope', id).catch(() => { const maybeExistingScope = this.store.peekRecord('scope', id); const scopeOptions = { id, type }; + /* istanbul ignore else */ if (type === 'global') { scopeOptions.name = this.intl.t('titles.global'); } @@ -35,14 +43,39 @@ export default class ScopesScopeRoute extends Route { } /** - * Adds the set of all org scopes to the controller, which is used by the - * scope navigation template. + * Load all scopes within the current scope context. Always attempt to load + * org scopes. Only attempt to load project scopes if the current scope is + * a project. These are used for scope navigation. + */ + async afterModel(model) { + // First, load orgs and, if necessary, projects + let orgs, projects; + orgs = await this.store.query('scope', { scope_id: 'global' }) + .catch(() => A([])); + if (model.isProject) { + projects = await this.store.query('scope', { scope_id: model.scopeID }); + } + // Then pull out the "selected" scopes, if relevant + let selectedOrg, selectedProject; + if (model.isGlobal || model.isOrg) selectedOrg = model; + if (model.isProject) { + selectedProject = model; + selectedOrg = this.store.peekRecord('scope', model.scopeID); + } + // Update the scope service with the current scope(s); + this.scope.org = selectedOrg; + this.scope.project = selectedProject; + this.scopes = { orgs, projects, selectedOrg, selectedProject }; + } + + /** + * Adds the scopes hash to the controller context (see `afterModel`). * @param {Controller} controller */ setupController(controller) { super.setupController(...arguments); - const orgScopes = this.modelFor('scopes').filterBy('isOrg', true); - controller.setProperties({ orgScopes }); + const scopes = this.scopes; + controller.setProperties({ scopes }); } /** @@ -51,19 +84,56 @@ export default class ScopesScopeRoute extends Route { * @param {object} controller * @param {object} model */ - renderTemplate(controller, model) { + renderTemplate() { super.renderTemplate(...arguments); - this.render('scopes/scope/-header-nav', { into: 'application', outlet: 'header-nav', - model: model, - }); - - this.render('scopes/scope/-sidebar', { - into: 'scopes/scope', - outlet: 'sidebar', - model: model, }); } + + // =actions + + /** + * Rollback changes on scope. + * @param {Model} scope + */ + @action + cancel(scope) { + const { isNew } = scope; + scope.rollbackAttributes(); + if (isNew) this.transitionTo('scopes.scope'); + } + + /** + * Handle save scope. + * @param {Model} scope + * @param {Event} e + */ + @action + @loading + @notifyError(({ message }) => message) + @notifySuccess(({ isNew }) => isNew ? 'notifications.create-success' : 'notifications.save-success') + async save(scope) { + const { isNew } = scope; + await scope.save(); + await this.transitionTo('scopes.scope.edit', scope); + if (isNew) this.refresh(); + } + + /** + * Deletes the scope and redirects to index. + * @param {Model} scope + */ + @action + @loading + @confirm('questions.delete-confirm') + @notifyError(({ message }) => message, { catch: true }) + @notifySuccess('notifications.delete-success') + async delete(scope) { + const { scopeID } = scope; + await scope.destroyRecord(); + await this.replaceWith('scopes.scope.scopes', scopeID); + //this.refresh(); + } } diff --git a/ui/core/app/routes/scopes/scope/authenticate.js b/ui/core/app/routes/scopes/scope/authenticate.js index 883bbb704..1c49215a8 100644 --- a/ui/core/app/routes/scopes/scope/authenticate.js +++ b/ui/core/app/routes/scopes/scope/authenticate.js @@ -10,14 +10,7 @@ export default class ScopesScopeAuthenticateRoute extends Route { // =methods beforeModel() { - if (this.session.isAuthenticated) { - const scope = this.modelFor('scopes.scope'); - if (scope.isGlobal) { - this.transitionTo('scopes.scope.orgs'); - } else { - this.transitionTo('scopes.scope.projects'); - } - } + if (this.session.isAuthenticated) this.transitionTo('scopes.scope.index'); } /** @@ -29,7 +22,7 @@ export default class ScopesScopeAuthenticateRoute extends Route { const { id: scope_id } = this.modelFor('scopes.scope'); return hash({ scope: this.modelFor('scopes.scope'), - scopes: this.modelFor('scopes'), + scopes: this.modelFor('scopes').filter(scope => scope.isOrg), authMethods: this.store.query('auth-method', { scope_id }), // for integration testing: diff --git a/ui/core/app/routes/scopes/scope/authenticate/method.js b/ui/core/app/routes/scopes/scope/authenticate/method.js index 891fbea04..7f9f87856 100644 --- a/ui/core/app/routes/scopes/scope/authenticate/method.js +++ b/ui/core/app/routes/scopes/scope/authenticate/method.js @@ -53,11 +53,7 @@ export default class ScopesScopeAuthenticateMethodRoute extends Route { requestCookies, { scope, authMethod } ); - if (scope.isGlobal) { - this.transitionTo('scopes.scope.orgs'); - } else { - this.transitionTo('scopes.scope.projects'); - } + this.transitionTo('index'); } catch (e) { const errorMessage = this.intl.t('errors.authentication-failed.title'); this.notify.error(errorMessage, { closeAfter: null }); diff --git a/ui/core/app/routes/scopes/scope/edit.js b/ui/core/app/routes/scopes/scope/edit.js new file mode 100644 index 000000000..a7b74c5ef --- /dev/null +++ b/ui/core/app/routes/scopes/scope/edit.js @@ -0,0 +1,18 @@ +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeEditRoute extends Route { + + // =services + + @service session; + + // =methods + + /** + * If arriving here unauthenticated, redirect to index for further processing. + */ + beforeModel() { + if (!this.session.isAuthenticated) this.transitionTo('index'); + } +} diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs.js b/ui/core/app/routes/scopes/scope/host-catalogs.js similarity index 67% rename from ui/core/app/routes/scopes/scope/projects/project/host-catalogs.js rename to ui/core/app/routes/scopes/scope/host-catalogs.js index ab01b5b7e..5c082051c 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs.js +++ b/ui/core/app/routes/scopes/scope/host-catalogs.js @@ -2,37 +2,45 @@ import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import loading from 'ember-loading/decorator'; -import { confirm } from '../../../../../decorators/confirm'; -import { notifySuccess, notifyError } from '../../../../../decorators/notify'; +import { confirm } from '../../../decorators/confirm'; +import { notifySuccess, notifyError } from '../../../decorators/notify'; -export default class ScopesScopeProjectsProjectHostCatalogsRoute extends Route { +export default class ScopesScopeHostCatalogsRoute extends Route { // =services @service intl; @service notify; + @service session; // =methods + /** + * If arriving here unauthenticated, redirect to index for further processing. + */ + beforeModel() { + if (!this.session.isAuthenticated) this.transitionTo('index'); + } + /** * Loads all host catalogs under the current scope. * @return {Promise{[HostCatalogModel]}} */ async model() { - const { id: scope_id } = this.modelFor('scopes.scope.projects.project'); + const { id: scope_id } = this.modelFor('scopes.scope'); return this.store.query('host-catalog', { scope_id }); } // =actions /** - * Rollback changes on project. + * Rollback changes on host catalog. * @param {HostCatalogModel} hostCatalog */ @action cancel(hostCatalog) { const { isNew } = hostCatalog; hostCatalog.rollbackAttributes(); - if (isNew) this.transitionTo('scopes.scope.projects.project.host-catalogs'); + if (isNew) this.transitionTo('scopes.scope.host-catalogs'); } /** @@ -47,7 +55,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsRoute extends Route { async save(hostCatalog) { await hostCatalog.save(); await this.transitionTo( - 'scopes.scope.projects.project.host-catalogs.host-catalog', + 'scopes.scope.host-catalogs.host-catalog', hostCatalog ); this.refresh(); @@ -64,7 +72,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsRoute extends Route { @notifySuccess('notifications.delete-success') async delete(hostCatalog) { await hostCatalog.destroyRecord(); - await this.replaceWith('scopes.scope.projects.project.host-catalogs'); + await this.replaceWith('scopes.scope.host-catalogs'); this.refresh(); } } diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog.js b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog.js similarity index 58% rename from ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog.js rename to ui/core/app/routes/scopes/scope/host-catalogs/host-catalog.js index 71fbe290b..98f8c40b4 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog.js +++ b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog.js @@ -1,6 +1,6 @@ import Route from '@ember/routing/route'; -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogRoute extends Route { +export default class ScopesScopeHostCatalogsHostCatalogRoute extends Route { // =methods /** @@ -14,7 +14,8 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogRoute exte } /** - * Renders the host-catalog specific templates for header, navigation, and actions page sections. + * Renders the host-catalog specific templates for header, navigation, + * and actions page sections. * @override * @param {object} controller * @param {object} model @@ -23,27 +24,27 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogRoute exte super.renderTemplate(...arguments); this.render( - 'scopes/scope/projects/project/host-catalogs/host-catalog/-header', + 'scopes/scope/host-catalogs/host-catalog/-header', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'header', model: model, } ); this.render( - 'scopes/scope/projects/project/host-catalogs/host-catalog/-navigation', + 'scopes/scope/host-catalogs/host-catalog/-navigation', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'navigation', model: model, } ); this.render( - 'scopes/scope/projects/project/host-catalogs/host-catalog/-actions', + 'scopes/scope/host-catalogs/host-catalog/-actions', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'actions', model: model, } diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets.js b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets.js similarity index 73% rename from ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets.js rename to ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets.js index 380250c3e..e3cbc969c 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets.js +++ b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets.js @@ -2,10 +2,10 @@ import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import loading from 'ember-loading/decorator'; -import { confirm } from '../../../../../../../decorators/confirm'; -import { notifySuccess, notifyError } from '../../../../../../../decorators/notify'; +import { confirm } from '../../../../../decorators/confirm'; +import { notifySuccess, notifyError } from '../../../../../decorators/notify'; -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRoute extends Route { +export default class ScopesScopeHostCatalogsHostCatalogHostSetsRoute extends Route { // =services @service intl; @@ -19,7 +19,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo */ model() { const { id: host_catalog_id } = this.modelFor( - 'scopes.scope.projects.project.host-catalogs.host-catalog' + 'scopes.scope.host-catalogs.host-catalog' ); return this.store.query('host-set', { host_catalog_id }); } @@ -36,7 +36,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo hostSet.rollbackAttributes(); if (isNew) this.transitionTo( - 'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets' + 'scopes.scope.host-catalogs.host-catalog.host-sets' ); } @@ -52,7 +52,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo async save(hostSet) { await hostSet.save(); await this.transitionTo( - 'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set', + 'scopes.scope.host-catalogs.host-catalog.host-sets.host-set', hostSet ); this.refresh(); @@ -70,7 +70,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsRo async deleteHostSet(hostSet) { await hostSet.destroyRecord(); await this.replaceWith( - 'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets' + 'scopes.scope.host-catalogs.host-catalog.host-sets' ); } } diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.js b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set.js similarity index 54% rename from ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.js rename to ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set.js index 4d88c52b1..31339c0dc 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.js +++ b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set.js @@ -1,10 +1,10 @@ import Route from '@ember/routing/route'; -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetRoute extends Route { +export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetRoute extends Route { // =methods /** - * Load a host-set using current host-catalog and it's parent project scope. + * Load a host-set using current host-catalog and its parent scope. * @param {object} params * @param {string} params.host_set_id * @return {HostSetModel} @@ -23,27 +23,27 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo super.renderTemplate(...arguments); this.render( - 'scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/-header', + 'scopes/scope/host-catalogs/host-catalog/host-sets/host-set/-header', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'header', model: model, } ); this.render( - 'scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/-navigation', + 'scopes/scope/host-catalogs/host-catalog/host-sets/host-set/-navigation', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'navigation', model: model, } ); this.render( - 'scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/-actions', + 'scopes/scope/host-catalogs/host-catalog/host-sets/host-set/-actions', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'actions', model: model, } diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/add-hosts.js b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts.js similarity index 67% rename from ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/add-hosts.js rename to ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts.js index 3b398fcec..afe7ce613 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/add-hosts.js +++ b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts.js @@ -3,9 +3,9 @@ import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import { hash } from 'rsvp'; import loading from 'ember-loading/decorator'; -import { notifySuccess, notifyError } from '../../../../../../../../../decorators/notify'; +import { notifySuccess, notifyError } from '../../../../../../../decorators/notify'; -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetAddHostsRoute extends Route { +export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetAddHostsRoute extends Route { // =services @service intl; @@ -26,11 +26,11 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo */ async model() { const { id: host_catalog_id } = this.modelFor( - 'scopes.scope.projects.project.host-catalogs.host-catalog' + 'scopes.scope.host-catalogs.host-catalog' ); return hash({ hostSet: this.modelFor( - 'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set' + 'scopes.scope.host-catalogs.host-catalog.host-sets.host-set' ), hosts: this.store.query('host', { host_catalog_id }), }); @@ -45,20 +45,20 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo super.renderTemplate(...arguments); this.render( - 'scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/add-hosts/-header', + 'scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts/-header', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'header', } ); this.render('-empty', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'navigation', }); this.render('-empty', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'actions', }); } @@ -76,7 +76,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo async addHosts(hostSet, hostIDs) { await hostSet.addHosts(hostIDs); await this.replaceWith( - 'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set.hosts' + 'scopes.scope.host-catalogs.host-catalog.host-sets.host-set.hosts' ); } @@ -86,7 +86,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo @action cancel() { this.replaceWith( - 'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set.hosts' + 'scopes.scope.host-catalogs.host-catalog.host-sets.host-set.hosts' ); } } diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host.js b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host.js similarity index 53% rename from ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host.js rename to ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host.js index 05aa6ed6f..a726302f2 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host.js +++ b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host.js @@ -1,11 +1,10 @@ import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; import { action } from '@ember/object'; -import { hash } from 'rsvp'; import loading from 'ember-loading/decorator'; -import { notifySuccess, notifyError } from '../../../../../../../../../decorators/notify'; +import { notifySuccess, notifyError } from '../../../../../../../decorators/notify'; -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetCreateHostRoute extends Route { +export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetCreateAndAddHostRoute extends Route { // =services @service intl; @@ -19,22 +18,17 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo */ async model() { const { id: host_catalog_id } = this.modelFor( - 'scopes.scope.projects.project.host-catalogs.host-catalog' + 'scopes.scope.host-catalogs.host-catalog' ); - return hash({ - hostSet: this.modelFor( - 'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set' - ), - host: this.store.createRecord('host', { - type: 'static', - host_catalog_id, - }), + return this.store.createRecord('host', { + type: 'static', + host_catalog_id, }); } /** - * Renders the create-host-specific header template. + * Renders the create host-specific header template. * Empties the actions and navigation outlets and renders a custom empty header. * @override */ @@ -42,20 +36,20 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo super.renderTemplate(...arguments); this.render( - 'scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host/-header', + 'scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host/-header', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'header', } ); this.render('-empty', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'navigation', }); this.render('-empty', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'actions', }); } @@ -70,11 +64,12 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo @loading @notifyError(({ message }) => message, { catch: true }) @notifySuccess('notifications.add-success') - async save(model) { - await model.host.save(); - await model.hostSet.addHost(model.host.id); + async save(host) { + const hostSet = this.modelFor('scopes.scope.host-catalogs.host-catalog.host-sets.host-set'); + await host.save(); + await hostSet.addHost(host.id); await this.replaceWith( - 'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set.hosts' + 'scopes.scope.host-catalogs.host-catalog.host-sets.host-set.hosts' ); } @@ -84,7 +79,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo @action cancel() { this.replaceWith( - 'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set.hosts' + 'scopes.scope.host-catalogs.host-catalog.host-sets.host-set.hosts' ); } } diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/hosts.js b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts.js similarity index 74% rename from ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/hosts.js rename to ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts.js index 8b4a5514d..32c5b8911 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/hosts.js +++ b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts.js @@ -3,10 +3,10 @@ import { hash, all } from 'rsvp'; import { action } from '@ember/object'; import { inject as service } from '@ember/service'; import loading from 'ember-loading/decorator'; -import { confirm } from '../../../../../../../../../decorators/confirm'; -import { notifySuccess, notifyError } from '../../../../../../../../../decorators/notify'; +import { confirm } from '../../../../../../../decorators/confirm'; +import { notifySuccess, notifyError } from '../../../../../../../decorators/notify'; -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetHostsRoute extends Route { +export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetHostsRoute extends Route { // =services @service intl; @@ -20,7 +20,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo */ async model() { const hostSet = this.modelFor( - 'scopes.scope.projects.project.host-catalogs.host-catalog.host-sets.host-set' + 'scopes.scope.host-catalogs.host-catalog.host-sets.host-set' ); return hash({ hostSet, @@ -43,9 +43,9 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo @notifyError(({ message }) => message, { catch: true }) @notifySuccess('notifications.remove-success') async removeHost(hostSet, host) { - const scopeID = this.modelFor('scopes.scope.projects.project').id; + const scopeID = this.modelFor('scopes.scope').id; const hostCatalogID = this.modelFor( - 'scopes.scope.projects.project.host-catalogs.host-catalog' + 'scopes.scope.host-catalogs.host-catalog' ).id; await hostSet.removeHost(host.id, { adapterOptions: { scopeID, hostCatalogID }, diff --git a/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/index.js b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/index.js new file mode 100644 index 000000000..48e4b444d --- /dev/null +++ b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/index.js @@ -0,0 +1,4 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetIndexRoute extends Route { +} diff --git a/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/index.js b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/index.js new file mode 100644 index 000000000..3af22321c --- /dev/null +++ b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/index.js @@ -0,0 +1,4 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeHostCatalogsHostCatalogHostSetsIndexRoute extends Route { +} diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.js b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/new.js similarity index 64% rename from ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.js rename to ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/new.js index 44a134995..3980cf51b 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.js +++ b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets/new.js @@ -1,6 +1,6 @@ import Route from '@ember/routing/route'; -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsNewRoute extends Route { +export default class ScopesScopeHostCatalogsHostCatalogHostSetsNewRoute extends Route { // =methods /** @@ -9,7 +9,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsNe */ model() { const { id: host_catalog_id } = this.modelFor( - 'scopes.scope.projects.project.host-catalogs.host-catalog' + 'scopes.scope.host-catalogs.host-catalog' ); return this.store.createRecord('host-set', { type: 'static', @@ -27,22 +27,22 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsNe super.renderTemplate(...arguments); this.render( - 'scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-header', + 'scopes/scope/host-catalogs/host-catalog/host-sets/new/-header', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'header', model: model, } ); this.render('_empty', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'navigation', model: model, }); this.render('_empty', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'actions', model: model, }); diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts.js b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/hosts.js similarity index 72% rename from ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts.js rename to ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/hosts.js index 9b9732e2a..912381a39 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts.js +++ b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/hosts.js @@ -2,10 +2,10 @@ import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import loading from 'ember-loading/decorator'; -import { confirm } from '../../../../../../../decorators/confirm'; -import { notifySuccess, notifyError } from '../../../../../../../decorators/notify'; +import { confirm } from '../../../../../decorators/confirm'; +import { notifySuccess, notifyError } from '../../../../../decorators/notify'; -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsRoute extends Route { +export default class ScopesScopeHostCatalogsHostCatalogHostsRoute extends Route { // =services @service intl; @@ -14,12 +14,12 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsRoute // =methods /** - * Loads all hosts under the current host catalog and it's parent project scope. + * Loads all hosts under the current host catalog and it's parent scope. * @return {Promise{[HostModel]}} */ model() { const { id: host_catalog_id } = this.modelFor( - 'scopes.scope.projects.project.host-catalogs.host-catalog' + 'scopes.scope.host-catalogs.host-catalog' ); return this.store.query('host', { host_catalog_id }); } @@ -36,7 +36,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsRoute host.rollbackAttributes(); if (isNew) this.transitionTo( - 'scopes.scope.projects.project.host-catalogs.host-catalog.hosts' + 'scopes.scope.host-catalogs.host-catalog.hosts' ); } @@ -52,7 +52,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsRoute async save(host) { await host.save(); await this.transitionTo( - 'scopes.scope.projects.project.host-catalogs.host-catalog.hosts.host', + 'scopes.scope.host-catalogs.host-catalog.hosts.host', host ); this.refresh(); @@ -70,7 +70,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsRoute async deleteHost(host) { await host.destroyRecord(); await this.replaceWith( - 'scopes.scope.projects.project.host-catalogs.host-catalog.hosts' + 'scopes.scope.host-catalogs.host-catalog.hosts' ); this.refresh(); } diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host.js b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/hosts/host.js similarity index 54% rename from ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host.js rename to ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/hosts/host.js index da1ca0685..8cbd978a2 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host.js +++ b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/hosts/host.js @@ -1,10 +1,10 @@ import Route from '@ember/routing/route'; -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsHostRoute extends Route { +export default class ScopesScopeHostCatalogsHostCatalogHostsHostRoute extends Route { // =methods /** - * Load a host using current host-catalog and it's parent project scope. + * Load a host using current host-catalog and it's parent scope. * @param {object} params * @param {string} params.host_id * @return {HostModel} @@ -23,27 +23,27 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsHostR super.renderTemplate(...arguments); this.render( - 'scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/-header', + 'scopes/scope/host-catalogs/host-catalog/hosts/host/-header', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'header', model: model, } ); this.render( - 'scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/-navigation', + 'scopes/scope/host-catalogs/host-catalog/hosts/host/-navigation', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'navigation', model: model, } ); this.render( - 'scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/-actions', + 'scopes/scope/host-catalogs/host-catalog/hosts/host/-actions', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'actions', model: model, } diff --git a/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/hosts/host/index.js b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/hosts/host/index.js new file mode 100644 index 000000000..8d1674617 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/hosts/host/index.js @@ -0,0 +1,4 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeHostCatalogsHostCatalogHostsHostIndexRoute extends Route { +} diff --git a/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/hosts/index.js b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/hosts/index.js new file mode 100644 index 000000000..931deeb2e --- /dev/null +++ b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/hosts/index.js @@ -0,0 +1,4 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeHostCatalogsHostCatalogHostsIndexRoute extends Route { +} diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new.js b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/hosts/new.js similarity index 62% rename from ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new.js rename to ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/hosts/new.js index 6ea7a3f7b..e82bfe0e4 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new.js +++ b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/hosts/new.js @@ -1,6 +1,6 @@ import Route from '@ember/routing/route'; -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsNewRoute extends Route { +export default class ScopesScopeHostCatalogsHostCatalogHostsNewRoute extends Route { // =methods /** @@ -9,7 +9,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsNewRo */ model() { const { id: host_catalog_id } = this.modelFor( - 'scopes.scope.projects.project.host-catalogs.host-catalog' + 'scopes.scope.host-catalogs.host-catalog' ); return this.store.createRecord('host', { type: 'static', @@ -18,7 +18,8 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsNewRo } /** - * Renders new host specific templates for header, navigation, and action page sections. + * Renders new host specific templates for header, navigation, + * and action page sections. * @override * @param {object} controller * @param {object} model @@ -27,22 +28,22 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsNewRo super.renderTemplate(...arguments); this.render( - 'scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new/-header', + 'scopes/scope/host-catalogs/host-catalog/hosts/new/-header', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'header', model: model, } ); this.render('_empty', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'navigation', model: model, }); this.render('_empty', { - into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + into: 'scopes/scope/host-catalogs/host-catalog', outlet: 'actions', model: model, }); diff --git a/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/index.js b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/index.js new file mode 100644 index 000000000..a039b120c --- /dev/null +++ b/ui/core/app/routes/scopes/scope/host-catalogs/host-catalog/index.js @@ -0,0 +1,3 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeHostCatalogsHostCatalogIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/host-catalogs/index.js b/ui/core/app/routes/scopes/scope/host-catalogs/index.js new file mode 100644 index 000000000..7698589d9 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/host-catalogs/index.js @@ -0,0 +1,4 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeHostCatalogsIndexRoute extends Route { +} diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/new.js b/ui/core/app/routes/scopes/scope/host-catalogs/new.js similarity index 62% rename from ui/core/app/routes/scopes/scope/projects/project/host-catalogs/new.js rename to ui/core/app/routes/scopes/scope/host-catalogs/new.js index 58e326cb8..9af8baaef 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/new.js +++ b/ui/core/app/routes/scopes/scope/host-catalogs/new.js @@ -1,14 +1,14 @@ import Route from '@ember/routing/route'; -export default class ScopesScopeProjectsProjectHostCatalogsNewRoute extends Route { +export default class ScopesScopeHostCatalogsNewRoute extends Route { // =methods /** - * Creates a new unsaved host catalog belonging to the current project scope. + * Creates a new unsaved host catalog belonging to the current scope. * @return {HostCatalogModel} */ model() { - const scopeModel = this.modelFor('scopes.scope.projects.project'); + const scopeModel = this.modelFor('scopes.scope'); return this.store.createRecord('host-catalog', { type: 'static', scopeModel, diff --git a/ui/core/app/routes/scopes/scope/index.js b/ui/core/app/routes/scopes/scope/index.js index 36261b82d..8ae76d0a6 100644 --- a/ui/core/app/routes/scopes/scope/index.js +++ b/ui/core/app/routes/scopes/scope/index.js @@ -1,12 +1,25 @@ import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; export default class ScopesScopeIndexRoute extends Route { + // =services + + @service session; + // =methods /** * Redirects to scopes/scope/authenticate for further processing. + * If already authenticated, redirects to scopes/scope/scopes to display + * list of sub scopes. */ - redirect() { - this.transitionTo('scopes.scope.authenticate'); + redirect(model) { + if (!this.session.isAuthenticated) { + this.transitionTo('scopes.scope.authenticate'); + } else if (model.isProject) { + this.transitionTo('scopes.scope.edit'); + } else { + this.transitionTo('scopes.scope.scopes'); + } } } diff --git a/ui/core/app/routes/scopes/scope/new.js b/ui/core/app/routes/scopes/scope/new.js new file mode 100644 index 000000000..0ab9f7f5b --- /dev/null +++ b/ui/core/app/routes/scopes/scope/new.js @@ -0,0 +1,31 @@ +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeNewRoute extends Route { + + // =services + + @service session; + + // =methods + + /** + * If arriving here unauthenticated, redirect to index for further processing. + */ + beforeModel() { + if (!this.session.isAuthenticated) this.transitionTo('index'); + } + + /** + * Creates a new unsaved scope belonging to the current scope. + * @return {ScopeModel} + */ + model() { + const { id: scopeID, isOrg } = this.modelFor('scopes.scope'); + // NOTE: if the current scope is an org, we create a project, otherwise + // it must be global and we create an org. Boundary does not support + // scopes under a project, so such a case is ignored. + const type = isOrg ? 'project' : 'org'; + return this.store.createRecord('scope', { type, scopeID }); + } +} diff --git a/ui/core/app/routes/scopes/scope/orgs.js b/ui/core/app/routes/scopes/scope/orgs.js deleted file mode 100644 index 5aad80343..000000000 --- a/ui/core/app/routes/scopes/scope/orgs.js +++ /dev/null @@ -1,60 +0,0 @@ -import Route from '@ember/routing/route'; -import { inject as service } from '@ember/service'; -import { action } from '@ember/object'; -import loading from 'ember-loading/decorator'; -import { notifySuccess, notifyError } from '../../../decorators/notify'; - -export default class ScopesScopeOrgsRoute extends Route { - // =services - - @service intl; - @service notify; - @service session; - - // =methods - - /** - * If arriving here unauthenticated or from a non-global scope, - * redirect to index for further processing. - */ - beforeModel() { - if (!this.session.isAuthenticated) this.transitionTo('index'); - const scope = this.modelFor('scopes.scope'); - if(!scope.isGlobal) this.transitionTo('index'); - } - - /** - * Loads all scopes under the global scope. - * @return {Promise{[ScopeModel]}} - */ - async model() { - return this.store.query('scope', { scope_id: 'global' }); - } - - // =actions - - /** - * Rollback changes on org. - * @param {ScopeModel} org - */ - @action - cancel(org) { - org.rollbackAttributes(); - this.transitionTo('scopes.scope.orgs'); - } - - /** - * Handle save org. - * @param {ScopeModel} org - * @param {Event} e - */ - @action - @loading - @notifyError(({ message }) => message, { catch: true }) - @notifySuccess('notifications.create-success') - async save(org) { - await org.save(); - await this.transitionTo('scopes.scope.projects', org); - this.refresh(); - } -} diff --git a/ui/core/app/routes/scopes/scope/orgs/index.js b/ui/core/app/routes/scopes/scope/orgs/index.js deleted file mode 100644 index e41a21c19..000000000 --- a/ui/core/app/routes/scopes/scope/orgs/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class ScopesScopeOrgsIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/orgs/new.js b/ui/core/app/routes/scopes/scope/orgs/new.js deleted file mode 100644 index a8819e58c..000000000 --- a/ui/core/app/routes/scopes/scope/orgs/new.js +++ /dev/null @@ -1,16 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class ScopesScopeOrgsNewRoute extends Route { - // =methods - - /** - * Creates a new unsaved org scope belonging to the global scope. - * @return {ScopeModel} - */ - model() { - return this.store.createRecord('scope', { - type: 'org', - scopeID: 'global', - }); - } -} diff --git a/ui/core/app/routes/scopes/scope/projects.js b/ui/core/app/routes/scopes/scope/projects.js deleted file mode 100644 index 7a43e0e71..000000000 --- a/ui/core/app/routes/scopes/scope/projects.js +++ /dev/null @@ -1,90 +0,0 @@ -import Route from '@ember/routing/route'; -import { inject as service } from '@ember/service'; -import { action } from '@ember/object'; -import loading from 'ember-loading/decorator'; -import { confirm } from '../../../decorators/confirm'; -import { notifySuccess, notifyError } from '../../../decorators/notify'; - -export default class ScopesScopeProjectsRoute extends Route { - // =services - - @service intl; - @service notify; - @service session; - @service confirm; - - // =methods - - /** - * If arriving here unauthenticated, redirect to index for further processing. - */ - beforeModel() { - if (!this.session.isAuthenticated) this.transitionTo('index'); - } - - /** - * Loads all scopes under the current scope. - * @return {Promise{[ScopeModel]}} - */ - async model() { - const { id: scope_id } = this.modelFor('scopes.scope'); - return this.store.query('scope', { scope_id }); - } - - /** - * If arriving here within a verifiable project scope, redirect to its - * parent, which is necessarily an org, in order to list projects. - * - * TODO: this conditional redirect based on the scope type is probably - * necessary for many routes directly under scope, so we may want - * to move this into a mixin. - * @param {ScopeModel} - */ - redirect() { - const { isProject, scopeID } = this.modelFor('scopes.scope'); - if (isProject) this.transitionTo('scopes.scope.projects', scopeID); - } - - // =actions - - /** - * Rollback changes on project. - * @param {ProjectModel} project - */ - @action - cancel(project) { - const { isNew } = project; - project.rollbackAttributes(); - if (isNew) this.transitionTo('scopes.scope.projects'); - } - - /** - * Handle save project. - * @param {ProjectModel} project - * @param {Event} e - */ - @action - @loading - @notifyError(({ message }) => message) - @notifySuccess(({ isNew }) => isNew ? 'notifications.create-success' : 'notifications.save-success') - async save(project) { - await project.save(); - await this.transitionTo('scopes.scope.projects.project', project); - this.refresh(); - } - - /** - * Deletes the project and redirects to index. - * @param {ProjectModel} project - */ - @action - @loading - @confirm('questions.delete-confirm') - @notifyError(({ message }) => message, { catch: true }) - @notifySuccess('notifications.delete-success') - async delete(project) { - await project.destroyRecord(); - await this.replaceWith('scopes.scope.projects'); - this.refresh(); - } -} diff --git a/ui/core/app/routes/scopes/scope/projects/index.js b/ui/core/app/routes/scopes/scope/projects/index.js deleted file mode 100644 index d763c183c..000000000 --- a/ui/core/app/routes/scopes/scope/projects/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/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 deleted file mode 100644 index 207ca3dbc..000000000 --- a/ui/core/app/routes/scopes/scope/projects/new.js +++ /dev/null @@ -1,17 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class ScopesScopeProjectsNewRoute extends Route { - // =methods - - /** - * Creates a new unsaved project scope belonging to the current org scope. - * @return {ScopeModel} - */ - model() { - const { id } = this.modelFor('scopes.scope'); - return this.store.createRecord('scope', { - type: 'project', - scopeID: id, - }); - } -} diff --git a/ui/core/app/routes/scopes/scope/projects/project.js b/ui/core/app/routes/scopes/scope/projects/project.js deleted file mode 100644 index 0f3e7dbdb..000000000 --- a/ui/core/app/routes/scopes/scope/projects/project.js +++ /dev/null @@ -1,31 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class ScopesScopeProjectsProjectRoute extends Route { - // =methods - - /** - * Loads a scope by ID (ostensibly a project scope). - * @param {object} params - * @param {string} params.project_id - * @return {ScopeModel} - */ - model({ project_id }) { - return this.store.findRecord('scope', project_id); - } - - /** - * Renders the project-specific sidebar template. - * @override - * @param {object} controller - * @param {object} model - */ - renderTemplate(controller, model) { - super.renderTemplate(...arguments); - - this.render('scopes/scope/projects/project/-sidebar', { - into: 'scopes/scope', - outlet: 'sidebar', - model: model, - }); - } -} diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/index.js b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/index.js deleted file mode 100644 index 0f73c321d..000000000 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHostSetIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/index.js b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/index.js deleted file mode 100644 index 8243577dc..000000000 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/index.js b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/index.js deleted file mode 100644 index 14e5c2210..000000000 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsHostIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/index.js b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/index.js deleted file mode 100644 index d6847d0b1..000000000 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostsIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/index.js b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/index.js deleted file mode 100644 index 88bc29fe9..000000000 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/index.js b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/index.js deleted file mode 100644 index be34e9260..000000000 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class ScopesScopeProjectsProjectHostCatalogsIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/projects/project/index.js b/ui/core/app/routes/scopes/scope/projects/project/index.js deleted file mode 100644 index a004bac08..000000000 --- a/ui/core/app/routes/scopes/scope/projects/project/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class ScopesScopeProjectsProjectIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/projects/project/sessions/index.js b/ui/core/app/routes/scopes/scope/projects/project/sessions/index.js deleted file mode 100644 index a8ae56692..000000000 --- a/ui/core/app/routes/scopes/scope/projects/project/sessions/index.js +++ /dev/null @@ -1,4 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class ScopesScopeProjectsProjectSessionsIndexRoute extends Route { -} diff --git a/ui/core/app/routes/scopes/scope/projects/project/targets/index.js b/ui/core/app/routes/scopes/scope/projects/project/targets/index.js deleted file mode 100644 index 903db12df..000000000 --- a/ui/core/app/routes/scopes/scope/projects/project/targets/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class ScopesScopeProjectsProjectTargetsIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/projects/project/targets/new.js b/ui/core/app/routes/scopes/scope/projects/project/targets/new.js deleted file mode 100644 index d6cbcaf99..000000000 --- a/ui/core/app/routes/scopes/scope/projects/project/targets/new.js +++ /dev/null @@ -1,17 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class ScopesScopeProjectsProjectTargetsNewRoute extends Route { - // =methods - - /** - * Creates a new unsaved target in current project scope. - * @return {TargetModel} - */ - model() { - const scopeModel = this.modelFor('scopes.scope.projects.project'); - return this.store.createRecord('target', { - type: 'tcp', - scopeModel, - }); - } -} diff --git a/ui/core/app/routes/scopes/scope/projects/project/targets/target/host-sets/host-set.js b/ui/core/app/routes/scopes/scope/projects/project/targets/target/host-sets/host-set.js deleted file mode 100644 index e7843fca7..000000000 --- a/ui/core/app/routes/scopes/scope/projects/project/targets/target/host-sets/host-set.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class ScopesScopeProjectsProjectTargetsTargetHostSetsHostSetRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/projects/project/targets/target/host-sets/index.js b/ui/core/app/routes/scopes/scope/projects/project/targets/target/host-sets/index.js deleted file mode 100644 index 80a35e875..000000000 --- a/ui/core/app/routes/scopes/scope/projects/project/targets/target/host-sets/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class ScopesScopeProjectsProjectTargetsTargetHostSetsIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/projects/project/targets/target/index.js b/ui/core/app/routes/scopes/scope/projects/project/targets/target/index.js deleted file mode 100644 index 3eb6dfa5f..000000000 --- a/ui/core/app/routes/scopes/scope/projects/project/targets/target/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class ScopesScopeProjectsProjectTargetsTargetIndexRoute extends Route {} diff --git a/ui/core/app/routes/scopes/scope/scopes.js b/ui/core/app/routes/scopes/scope/scopes.js new file mode 100644 index 000000000..933bfc531 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/scopes.js @@ -0,0 +1,40 @@ +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; + +/** + * The scopes route lists subscopes under the currently active scope. + * For the global scope, the listed scopes are orgs. + * For org scopes, the listed scopes are projects. + */ +export default class ScopesScopeScopesRoute extends Route { + // =services + + @service session; + + // =methods + + /** + * If arriving here unauthenticated, redirect to index for further processing. + */ + beforeModel() { + if (!this.session.isAuthenticated) this.transitionTo('index'); + } + + /** + * Loads sub scopes for the current scope. + * @return {Promise + */ + async model() { + const currentScope = this.modelFor('scopes.scope'); + const parentScope = !currentScope.isGlobal + ? await this.store.findRecord('scope', currentScope.scopeID) + : null; + const subScopes = + await this.store.query('scope', { scope_id: currentScope.id }); + return { + currentScope, + parentScope, + subScopes + }; + } +} diff --git a/ui/core/app/routes/scopes/scope/scopes/index.js b/ui/core/app/routes/scopes/scope/scopes/index.js new file mode 100644 index 000000000..4c30c0049 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/scopes/index.js @@ -0,0 +1,4 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeScopesIndexRoute extends Route { +} diff --git a/ui/core/app/routes/scopes/scope/projects/project/sessions.js b/ui/core/app/routes/scopes/scope/sessions.js similarity index 86% rename from ui/core/app/routes/scopes/scope/projects/project/sessions.js rename to ui/core/app/routes/scopes/scope/sessions.js index 3e01b9f44..a8ae5eb19 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/sessions.js +++ b/ui/core/app/routes/scopes/scope/sessions.js @@ -4,17 +4,18 @@ import { action } from '@ember/object'; import { all, hash } from 'rsvp'; import { task, timeout } from 'ember-concurrency'; import { A } from '@ember/array'; -import { notifySuccess, notifyError } from '../../../../../decorators/notify'; -import config from '../../../../../config/environment'; +import { notifySuccess, notifyError } from '../../../decorators/notify'; +import config from '../../../config/environment'; const POLL_TIMEOUT_SECONDS = config.sessionPollingTimeoutSeconds; -export default class ScopesScopeProjectsProjectSessionsRoute extends Route { +export default class ScopesScopeSessionsRoute extends Route { // =services @service intl; @service notify; + @service session; // =attributes @@ -37,13 +38,20 @@ export default class ScopesScopeProjectsProjectSessionsRoute extends Route { // =methods + /** + * If arriving here unauthenticated, redirect to index for further processing. + */ + beforeModel() { + if (!this.session.isAuthenticated) this.transitionTo('index'); + } + /** * Loads all sessions under the current scope and encapsulates them into * an array of objects containing their associated users and targets. * @return {Promise{[{session: SessionModel, user: UserModel, target: TargetModel}]}} */ async model() { - const { id: scope_id } = this.modelFor('scopes.scope.projects.project'); + const { id: scope_id } = this.modelFor('scopes.scope'); const sessions = await this.store.query('session', { scope_id }); const sessionAggregates = await all( sessions.map(session => hash({ diff --git a/ui/core/app/routes/scopes/scope/sessions/index.js b/ui/core/app/routes/scopes/scope/sessions/index.js new file mode 100644 index 000000000..bf1a6aeaf --- /dev/null +++ b/ui/core/app/routes/scopes/scope/sessions/index.js @@ -0,0 +1,4 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeSessionsIndexRoute extends Route { +} diff --git a/ui/core/app/routes/scopes/scope/projects/project/targets.js b/ui/core/app/routes/scopes/scope/targets.js similarity index 64% rename from ui/core/app/routes/scopes/scope/projects/project/targets.js rename to ui/core/app/routes/scopes/scope/targets.js index 68e0b98d0..f1da50944 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/targets.js +++ b/ui/core/app/routes/scopes/scope/targets.js @@ -2,23 +2,31 @@ import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import loading from 'ember-loading/decorator'; -import { confirm } from '../../../../../decorators/confirm'; -import { notifySuccess, notifyError } from '../../../../../decorators/notify'; +import { confirm } from '../../../decorators/confirm'; +import { notifySuccess, notifyError } from '../../../decorators/notify'; -export default class ScopesScopeProjectsProjectTargetsRoute extends Route { +export default class ScopesScopeTargetsRoute extends Route { // =services @service intl; @service notify; + @service session; // =methods /** - * Loads all targets under current project scope. + * If arriving here unauthenticated, redirect to index for further processing. + */ + beforeModel() { + if (!this.session.isAuthenticated) this.transitionTo('index'); + } + + /** + * Loads all targets under current scope. * @return {Promise{[TargetModel]}} */ async model() { - const { id: scope_id } = this.modelFor('scopes.scope.projects.project'); + const { id: scope_id } = this.modelFor('scopes.scope'); return this.store.query('target', { scope_id }); } @@ -32,7 +40,7 @@ export default class ScopesScopeProjectsProjectTargetsRoute extends Route { cancel(target) { const { isNew } = target; target.rollbackAttributes(); - if (isNew) this.transitionTo('scopes.scope.projects.project.targets'); + if (isNew) this.transitionTo('scopes.scope.targets'); } /** @@ -46,7 +54,7 @@ export default class ScopesScopeProjectsProjectTargetsRoute extends Route { @notifySuccess(({ isNew }) => isNew ? 'notifications.create-success' : 'notifications.save-success') async save(target) { await target.save(); - await this.transitionTo('scopes.scope.projects.project.targets.target', target); + await this.transitionTo('scopes.scope.targets.target', target); this.refresh(); } @@ -61,7 +69,7 @@ export default class ScopesScopeProjectsProjectTargetsRoute extends Route { @notifySuccess('notifications.delete-success') async delete(target) { await target.destroyRecord(); - await this.replaceWith('scopes.scope.projects.project.targets'); + await this.replaceWith('scopes.scope.targets'); this.refresh(); } } diff --git a/ui/core/app/routes/scopes/scope/targets/index.js b/ui/core/app/routes/scopes/scope/targets/index.js new file mode 100644 index 000000000..3902b6c03 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/targets/index.js @@ -0,0 +1,4 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeTargetsIndexRoute extends Route { +} diff --git a/ui/core/app/routes/scopes/scope/targets/new.js b/ui/core/app/routes/scopes/scope/targets/new.js new file mode 100644 index 000000000..5e3d97603 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/targets/new.js @@ -0,0 +1,17 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeTargetsNewRoute extends Route { + // =methods + + /** + * Creates a new unsaved target in current scope. + * @return {TargetModel} + */ + model() { + const scopeModel = this.modelFor('scopes.scope'); + return this.store.createRecord('target', { + type: 'tcp', + scopeModel, + }); + } +} diff --git a/ui/core/app/routes/scopes/scope/projects/project/targets/target.js b/ui/core/app/routes/scopes/scope/targets/target.js similarity index 54% rename from ui/core/app/routes/scopes/scope/projects/project/targets/target.js rename to ui/core/app/routes/scopes/scope/targets/target.js index 83bd76120..4702bb059 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/targets/target.js +++ b/ui/core/app/routes/scopes/scope/targets/target.js @@ -1,6 +1,6 @@ import Route from '@ember/routing/route'; -export default class ScopesScopeProjectsProjectTargetsTargetRoute extends Route { +export default class ScopesScopeTargetsTargetRoute extends Route { // =methods /** @@ -21,18 +21,18 @@ export default class ScopesScopeProjectsProjectTargetsTargetRoute extends Route renderTemplate() { super.renderTemplate(...arguments); - this.render('scopes/scope/projects/project/targets/target/-header', { - into: 'scopes/scope/projects/project/targets/target', + this.render('scopes/scope/targets/target/-header', { + into: 'scopes/scope/targets/target', outlet: 'header', }); - this.render('scopes/scope/projects/project/targets/target/-navigation', { - into: 'scopes/scope/projects/project/targets/target', + this.render('scopes/scope/targets/target/-navigation', { + into: 'scopes/scope/targets/target', outlet: 'navigation', }); - this.render('scopes/scope/projects/project/targets/target/-actions', { - into: 'scopes/scope/projects/project/targets/target', + this.render('scopes/scope/targets/target/-actions', { + into: 'scopes/scope/targets/target', outlet: 'actions', }); } diff --git a/ui/core/app/routes/scopes/scope/projects/project/targets/target/add-host-sets.js b/ui/core/app/routes/scopes/scope/targets/target/add-host-sets.js similarity index 70% rename from ui/core/app/routes/scopes/scope/projects/project/targets/target/add-host-sets.js rename to ui/core/app/routes/scopes/scope/targets/target/add-host-sets.js index b747fda00..1a211d30c 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/targets/target/add-host-sets.js +++ b/ui/core/app/routes/scopes/scope/targets/target/add-host-sets.js @@ -3,9 +3,9 @@ import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import { all } from 'rsvp'; import loading from 'ember-loading/decorator'; -import { notifySuccess, notifyError } from '../../../../../../../decorators/notify'; +import { notifySuccess, notifyError } from '../../../../../decorators/notify'; -export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsRoute extends Route { +export default class ScopesScopeTargetsTargetAddHostSetsRoute extends Route { // =services @service intl; @@ -26,9 +26,9 @@ export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsRoute ext */ async model() { const target = this.modelFor( - 'scopes.scope.projects.project.targets.target' + 'scopes.scope.targets.target' ); - const { id: scope_id } = this.modelFor('scopes.scope.projects.project'); + const { id: scope_id } = this.modelFor('scopes.scope'); const hostCatalogs = await this.store.query('host-catalog', { scope_id }); await all( hostCatalogs.map(({ id: host_catalog_id }) => @@ -51,20 +51,20 @@ export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsRoute ext super.renderTemplate(...arguments); this.render( - 'scopes/scope/projects/project/targets/target/add-host-sets/-header', + 'scopes/scope/targets/target/add-host-sets/-header', { - into: 'scopes/scope/projects/project/targets/target', + into: 'scopes/scope/targets/target', outlet: 'header', } ); this.render('-empty', { - into: 'scopes/scope/projects/project/targets/target', + into: 'scopes/scope/targets/target', outlet: 'navigation', }); this.render('-empty', { - into: 'scopes/scope/projects/project/targets/target', + into: 'scopes/scope/targets/target', outlet: 'actions', }); } @@ -78,7 +78,7 @@ export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsRoute ext async save(target, hostSetIDs) { await target.addHostSets(hostSetIDs); this.replaceWith( - 'scopes.scope.projects.project.targets.target.host-sets' + 'scopes.scope.targets.target.host-sets' ); } @@ -87,6 +87,6 @@ export default class ScopesScopeProjectsProjectTargetsTargetAddHostSetsRoute ext */ @action cancel() { - this.replaceWith('scopes.scope.projects.project.targets.target.host-sets'); + this.replaceWith('scopes.scope.targets.target.host-sets'); } } diff --git a/ui/core/app/routes/scopes/scope/projects/project/targets/target/host-sets.js b/ui/core/app/routes/scopes/scope/targets/target/host-sets.js similarity index 82% rename from ui/core/app/routes/scopes/scope/projects/project/targets/target/host-sets.js rename to ui/core/app/routes/scopes/scope/targets/target/host-sets.js index 08d839f1f..e181d4cdd 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/targets/target/host-sets.js +++ b/ui/core/app/routes/scopes/scope/targets/target/host-sets.js @@ -3,10 +3,10 @@ import { all, hash } from 'rsvp'; import { action } from '@ember/object'; import { inject as service } from '@ember/service'; import loading from 'ember-loading/decorator'; -import { confirm } from '../../../../../../../decorators/confirm'; -import { notifySuccess, notifyError } from '../../../../../../../decorators/notify'; +import { confirm } from '../../../../../decorators/confirm'; +import { notifySuccess, notifyError } from '../../../../../decorators/notify'; -export default class ScopesScopeProjectsProjectTargetsTargetHostSetsRoute extends Route { +export default class ScopesScopeTargetsTargetHostSetsRoute extends Route { // =services @service intl; @@ -21,7 +21,7 @@ export default class ScopesScopeProjectsProjectTargetsTargetHostSetsRoute extend */ beforeModel() { const { scopeID, host_sets } = this.modelFor( - 'scopes.scope.projects.project.targets.target' + 'scopes.scope.targets.target' ); const promises = host_sets.map( ({ host_set_id, host_catalog_id: hostCatalogID }) => @@ -45,7 +45,7 @@ export default class ScopesScopeProjectsProjectTargetsTargetHostSetsRoute extend * @return {TargetModel} */ model() { - return this.modelFor('scopes.scope.projects.project.targets.target'); + return this.modelFor('scopes.scope.targets.target'); } // =actions diff --git a/ui/core/app/routes/scopes/scope/targets/target/index.js b/ui/core/app/routes/scopes/scope/targets/target/index.js new file mode 100644 index 000000000..2f80e30b7 --- /dev/null +++ b/ui/core/app/routes/scopes/scope/targets/target/index.js @@ -0,0 +1,4 @@ +import Route from '@ember/routing/route'; + +export default class ScopesScopeTargetsTargetIndexRoute extends Route { +} diff --git a/ui/core/app/services/scope.js b/ui/core/app/services/scope.js new file mode 100644 index 000000000..b4e93fe03 --- /dev/null +++ b/ui/core/app/services/scope.js @@ -0,0 +1,22 @@ +import Service from '@ember/service'; +import { tracked } from '@glimmer/tracking'; + +/** + * This simple non-functional service is used to retain references to + * the currently active scope or scopes. + */ +export default class ScopeService extends Service { + + // =attributes + + /** + * @type {ScopeModel} + */ + @tracked org; + + /** + * @type {ScopeModel} + */ + @tracked project; + +} diff --git a/ui/core/app/templates/scopes/scope.hbs b/ui/core/app/templates/scopes/scope.hbs index 75c531af1..278755d24 100644 --- a/ui/core/app/templates/scopes/scope.hbs +++ b/ui/core/app/templates/scopes/scope.hbs @@ -1,3 +1,15 @@ +{{#if @model.isOrg}} + {{title (t "resources.org.title_plural") }} + {{title @model.displayName}} +{{/if}} + +{{#if @model.isProject}} + {{title (t "resources.org.title_plural") }} + {{title this.scopes.selectedOrg.displayName}} + {{title (t "resources.project.title_plural") }} + {{title @model.displayName}} +{{/if}} + {{#if this.session.isAuthenticated}} @@ -5,7 +17,7 @@ {{#if @model.isGlobal}} - + @@ -16,7 +28,15 @@ {{#if @model.isOrg}} - + {{#if this.session.data.authenticated.isGlobal}} + + + {{t "resources.org.title_plural"}} + + {{/if}} + @@ -25,7 +45,109 @@ {{/if}} - {{outlet "sidebar"}} + {{#if @model.isProject}} + + {{#if this.session.data.authenticated.isGlobal}} + + + {{t "resources.org.title_plural"}} + + {{/if}} + + + {{t "resources.project.title_plural"}} + + + {{!-- TODO: after scope awareness refactor, update groups and roles + to support project scopes --}} + {{!-- + + + + {{t "resources.group.title_plural"}} + + + + {{t "resources.role.title_plural"}} + + + --}} + + + + {{t "resources.session.title_plural"}} + + + + {{t "resources.target.title_plural"}} + + + + {{t "resources.host-catalog.title_plural"}} + + + {{/if}} + + {{#unless @model.isProject}} + + + + {{t "resources.user.title_plural"}} + + + + {{t "resources.group.title_plural"}} + + + + {{t "resources.role.title_plural"}} + + + + {{t "resources.auth-method.title_plural"}} + + + {{/unless}} + + {{#if @model.isOrg}} + {{#if this.session.data.authenticated.isGlobal}} + + + {{t "resources.org.messages.settings.title"}} + + + {{/if}} + {{/if}} + + {{#if @model.isProject}} + + + {{t "resources.project.messages.settings.title"}} + + + {{/if}} {{/if}} diff --git a/ui/core/app/templates/scopes/scope/-header-nav.hbs b/ui/core/app/templates/scopes/scope/-header-nav.hbs index 00484b51a..809ce6e32 100644 --- a/ui/core/app/templates/scopes/scope/-header-nav.hbs +++ b/ui/core/app/templates/scopes/scope/-header-nav.hbs @@ -1,5 +1,5 @@ {{#if this.session.data.authenticated.isGlobal}} @@ -7,14 +7,23 @@ {{t "titles.global"}} - {{#each this.orgScopes as |scope|}} + {{/if}} + {{#each this.scopes.orgs as |scope|}} + + {{scope.displayName}} + + {{/each}} + + +{{#if this.scopes.selectedProject}} + + {{#each this.scopes.projects as |scope|}} {{scope.displayName}} {{/each}} - {{else}} - - {{this.model.displayName}} - - {{/if}} - + +{{/if}} diff --git a/ui/core/app/templates/scopes/scope/authenticate.hbs b/ui/core/app/templates/scopes/scope/authenticate.hbs index 0bee46a27..ccabf58d4 100644 --- a/ui/core/app/templates/scopes/scope/authenticate.hbs +++ b/ui/core/app/templates/scopes/scope/authenticate.hbs @@ -14,6 +14,9 @@ @text={{t "actions.choose-different-org"}} @icon="user-organization" as |dropdown|> + + {{t "titles.global"}} + {{#each this.sortedScopes as |scope|}} {{scope.displayName}} diff --git a/ui/core/app/templates/scopes/scope/projects/project/index.hbs b/ui/core/app/templates/scopes/scope/edit.hbs similarity index 68% rename from ui/core/app/templates/scopes/scope/projects/project/index.hbs rename to ui/core/app/templates/scopes/scope/edit.hbs index af31fd2e6..610b3026e 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/index.hbs +++ b/ui/core/app/templates/scopes/scope/edit.hbs @@ -5,11 +5,20 @@ -

- {{t "resources.project.title"}} - -

-

{{t "resources.project.description"}}

+ {{#if @model.isOrg}} +

+ {{t "resources.org.title"}} + +

+

{{t "resources.org.description"}}

+ {{/if}} + {{#if @model.isProject}} +

+ {{t "resources.project.title"}} + +

+

{{t "resources.project.description"}}

+ {{/if}} - + {{t 'titles.details'}} @@ -40,7 +49,7 @@ - {{t "resources.host.actions.create"}} {{t "resources.host-set.actions.create"}} diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/-header.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/-header.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/-header.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/-header.hbs diff --git a/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/-navigation.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/-navigation.hbs new file mode 100644 index 000000000..1fec5dffa --- /dev/null +++ b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/-navigation.hbs @@ -0,0 +1,11 @@ + + + {{t 'titles.details'}} + + + {{t 'resources.host.title_plural'}} + + + {{t 'resources.host-set.title_plural'}} + + diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets.hbs similarity index 81% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets.hbs index 37ecd2d33..031f2510b 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets.hbs +++ b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets.hbs @@ -1,3 +1,3 @@ {{title (t "resources.host-set.title_plural")}} -{{outlet}} \ No newline at end of file +{{outlet}} diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set.hbs diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/-actions.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/-actions.hbs similarity index 59% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/-actions.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/-actions.hbs index 2eb61121a..7eccc7b44 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/-actions.hbs +++ b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/-actions.hbs @@ -1,8 +1,8 @@ - - {{t 'resources.host-set.actions.create-host'}} + + {{t 'resources.host-set.actions.create-and-add-host'}} - + {{t 'resources.host-set.actions.add-hosts'}} diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/-header.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/-header.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/-header.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/-header.hbs diff --git a/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/-navigation.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/-navigation.hbs new file mode 100644 index 000000000..70e124d5d --- /dev/null +++ b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/-navigation.hbs @@ -0,0 +1,8 @@ + + + {{t 'titles.details'}} + + + {{t 'resources.host.title_plural'}} + + diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/add-hosts.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/add-hosts.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts.hbs diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/add-hosts/-header.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts/-header.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/add-hosts/-header.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts/-header.hbs diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host.hbs similarity index 55% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host.hbs index 455daa19b..3e7ed3f29 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host.hbs +++ b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host.hbs @@ -1,7 +1,7 @@ -{{title (t 'resources.host-set.actions.create-host')}} +{{title (t 'resources.host-set.actions.create-and-add-host')}} - \ No newline at end of file +/> diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host/-header.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host/-header.hbs similarity index 50% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host/-header.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host/-header.hbs index c8ea81660..ee94f8ff0 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host/-header.hbs +++ b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host/-header.hbs @@ -1,4 +1,4 @@

- {{t "resources.host-set.actions.create-host"}} + {{t "resources.host-set.actions.create-and-add-host"}}

diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/hosts.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts.hbs similarity index 87% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/hosts.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts.hbs index 50b35d364..8eacc846b 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/hosts.hbs +++ b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts.hbs @@ -1,3 +1,5 @@ +{{title (t "resources.host.title_plural")}} + {{#if @model.hosts}} @@ -14,7 +16,7 @@ {{host.displayName}} @@ -62,10 +64,12 @@ {{t "resources.host-set.host.messages.none.description"}} - + {{!-- + - {{t "resources.host-set.actions.create-host"}} + {{t "resources.host-set.actions.create-and-add-host"}} + --}} {{/unless}} diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/index.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/index.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/index.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/index.hbs diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/index.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/index.hbs similarity index 88% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/index.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/index.hbs index bb5f4c14c..d4cb8ca74 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/index.hbs +++ b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/index.hbs @@ -13,7 +13,7 @@ {{hostSet.displayName}} @@ -46,7 +46,7 @@ {{t "resources.host-set.description"}} - + {{t "titles.new"}} diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/new.hbs similarity index 98% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/new.hbs index 1d5d73000..bd5a0338c 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new.hbs +++ b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/new.hbs @@ -4,4 +4,4 @@ @model={{@model}} @submit={{route-action "save" @model}} @cancel={{route-action "cancel" @model}} -/> \ No newline at end of file +/> diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-header.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/new/-header.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new/-header.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/host-sets/new/-header.hbs diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts.hbs similarity index 80% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts.hbs index aff384fe4..5e74dd528 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts.hbs +++ b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts.hbs @@ -1,3 +1,3 @@ {{title (t "resources.host.title_plural")}} -{{outlet}} \ No newline at end of file +{{outlet}} diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/host.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/host.hbs diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/-actions.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/host/-actions.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/-actions.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/host/-actions.hbs diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/-header.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/host/-header.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/-header.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/host/-header.hbs diff --git a/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/host/-navigation.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/host/-navigation.hbs new file mode 100644 index 000000000..157f7472f --- /dev/null +++ b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/host/-navigation.hbs @@ -0,0 +1,5 @@ + + + {{t 'titles.details'}} + + diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/index.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/host/index.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/index.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/host/index.hbs diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/index.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/index.hbs similarity index 90% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/index.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/index.hbs index e29e8dca1..dcf9b3b63 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/index.hbs +++ b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/index.hbs @@ -14,7 +14,7 @@ {{host.displayName}} @@ -50,7 +50,7 @@ {{t "resources.host.description"}} - + {{t "titles.new"}} diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/new.hbs similarity index 97% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/new.hbs index 29bf7404f..2e3ec8149 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new.hbs +++ b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/new.hbs @@ -4,4 +4,4 @@ @model={{@model}} @submit={{route-action "save" @model}} @cancel={{route-action "cancel" @model}} -/> \ No newline at end of file +/> diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new/-header.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/new/-header.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new/-header.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/hosts/new/-header.hbs diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/index.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/index.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/index.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/host-catalog/index.hbs diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/index.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/index.hbs similarity index 87% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/index.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/index.hbs index 91a17f32d..7fdf6fc12 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/index.hbs +++ b/ui/core/app/templates/scopes/scope/host-catalogs/index.hbs @@ -9,12 +9,14 @@ {{t "resources.host-catalog.title_plural"}} -

{{t "resources.host-catalog.description"}}

+ {{#if @model}} +

{{t "resources.host-catalog.description"}}

+ {{/if}}
{{#if @model}} - + {{t "titles.new"}} {{/if}} @@ -37,7 +39,7 @@ {{hostCatalog.displayName}} @@ -70,7 +72,7 @@ {{t "resources.host-catalog.description"}} - + {{t "titles.new"}} diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/new.hbs b/ui/core/app/templates/scopes/scope/host-catalogs/new.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/host-catalogs/new.hbs rename to ui/core/app/templates/scopes/scope/host-catalogs/new.hbs diff --git a/ui/core/app/templates/scopes/scope/orgs/new.hbs b/ui/core/app/templates/scopes/scope/new.hbs similarity index 75% rename from ui/core/app/templates/scopes/scope/orgs/new.hbs rename to ui/core/app/templates/scopes/scope/new.hbs index 390f0f04b..b33c28109 100644 --- a/ui/core/app/templates/scopes/scope/orgs/new.hbs +++ b/ui/core/app/templates/scopes/scope/new.hbs @@ -9,12 +9,15 @@

{{t "titles.new"}} - +

- - - - - - - -

- {{t "resources.org.title_plural"}} - -

- {{#if @model}} -

{{t "resources.org.description"}}

- {{/if}} -
- - - {{#if @model}} - - {{t 'titles.new'}} - - {{/if}} - - - - - {{#if @model}} - - - {{#each @model as |org|}} - - {{/each}} - - - {{else}} - - - - - {{t 'resources.org.description'}} - - - - {{t 'titles.new'}} - - - - - {{/if}} - - - - diff --git a/ui/core/app/templates/scopes/scope/projects.hbs b/ui/core/app/templates/scopes/scope/projects.hbs deleted file mode 100644 index dd40ba6c8..000000000 --- a/ui/core/app/templates/scopes/scope/projects.hbs +++ /dev/null @@ -1,3 +0,0 @@ -{{title (t "resources.project.title_plural")}} - -{{outlet}} diff --git a/ui/core/app/templates/scopes/scope/projects/index.hbs b/ui/core/app/templates/scopes/scope/projects/index.hbs deleted file mode 100644 index 2c220f15b..000000000 --- a/ui/core/app/templates/scopes/scope/projects/index.hbs +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - -

- {{t "resources.project.title_plural"}} - -

- {{#if @model}} -

{{t "resources.project.description"}}

- {{/if}} -
- - - {{#if @model}} - - {{t 'titles.new'}} - - {{/if}} - - - - - {{#if @model}} - - - {{#each @model as |project|}} - - {{/each}} - - - {{else}} - - - - - {{t 'resources.project.description'}} - - - - {{t 'titles.new'}} - - - - - {{/if}} - - - -
diff --git a/ui/core/app/templates/scopes/scope/projects/new.hbs b/ui/core/app/templates/scopes/scope/projects/new.hbs deleted file mode 100644 index 0e9dedf59..000000000 --- a/ui/core/app/templates/scopes/scope/projects/new.hbs +++ /dev/null @@ -1,24 +0,0 @@ -{{title (t 'titles.new')}} - - - - - - - - -

- {{t "titles.new"}} - -

-
- - - - - -
diff --git a/ui/core/app/templates/scopes/scope/projects/project.hbs b/ui/core/app/templates/scopes/scope/projects/project.hbs deleted file mode 100644 index d66e83390..000000000 --- a/ui/core/app/templates/scopes/scope/projects/project.hbs +++ /dev/null @@ -1,3 +0,0 @@ -{{title @model.displayName}} - -{{outlet}} diff --git a/ui/core/app/templates/scopes/scope/projects/project/-sidebar.hbs b/ui/core/app/templates/scopes/scope/projects/project/-sidebar.hbs deleted file mode 100644 index e82349443..000000000 --- a/ui/core/app/templates/scopes/scope/projects/project/-sidebar.hbs +++ /dev/null @@ -1,20 +0,0 @@ - - - - {{t "resources.session.title_plural"}} - - - - {{t "resources.target.title_plural"}} - - - - {{t "resources.host-catalog.title_plural"}} - - diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/-navigation.hbs b/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/-navigation.hbs deleted file mode 100644 index 5be44792b..000000000 --- a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/-navigation.hbs +++ /dev/null @@ -1,11 +0,0 @@ - - - {{t 'titles.details'}} - - - {{t 'resources.host-set.title_plural'}} - - - {{t 'resources.host.title_plural'}} - - diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/-navigation.hbs b/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/-navigation.hbs deleted file mode 100644 index 93590ba90..000000000 --- a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/-navigation.hbs +++ /dev/null @@ -1,8 +0,0 @@ - - - {{t 'titles.details'}} - - - {{t 'resources.host.title_plural'}} - - diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/-navigation.hbs b/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/-navigation.hbs deleted file mode 100644 index d79e3afa2..000000000 --- a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/-navigation.hbs +++ /dev/null @@ -1,5 +0,0 @@ - - - {{t 'titles.details'}} - - \ No newline at end of file diff --git a/ui/core/app/templates/scopes/scope/projects/project/targets/target/-navigation.hbs b/ui/core/app/templates/scopes/scope/projects/project/targets/target/-navigation.hbs deleted file mode 100644 index a31f1590c..000000000 --- a/ui/core/app/templates/scopes/scope/projects/project/targets/target/-navigation.hbs +++ /dev/null @@ -1,8 +0,0 @@ - - - {{t 'titles.details'}} - - - {{t 'resources.host-set.title_plural'}} - - diff --git a/ui/core/app/templates/scopes/scope/projects/project/targets/target/host-sets/host-set.hbs b/ui/core/app/templates/scopes/scope/projects/project/targets/target/host-sets/host-set.hbs deleted file mode 100644 index e2147cab0..000000000 --- a/ui/core/app/templates/scopes/scope/projects/project/targets/target/host-sets/host-set.hbs +++ /dev/null @@ -1 +0,0 @@ -{{outlet}} \ No newline at end of file diff --git a/ui/core/app/templates/scopes/scope/scopes.hbs b/ui/core/app/templates/scopes/scope/scopes.hbs new file mode 100644 index 000000000..ef0177922 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/scopes.hbs @@ -0,0 +1,9 @@ +{{#if @model.currentScope.isGlobal}} + {{title (t "resources.org.title_plural") }} +{{/if}} + +{{#if @model.currentScope.isOrg}} + {{title (t "resources.project.title_plural") }} +{{/if}} + +{{outlet}} diff --git a/ui/core/app/templates/scopes/scope/scopes/index.hbs b/ui/core/app/templates/scopes/scope/scopes/index.hbs new file mode 100644 index 000000000..295eb06f3 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/scopes/index.hbs @@ -0,0 +1,90 @@ + + + + + + + + {{#if @model.currentScope.isGlobal}} +

+ {{t "resources.org.title_plural"}} + +

+ {{#if @model.subScopes}} +

{{t "resources.org.description"}}

+ {{/if}} + {{/if}} + {{#if @model.currentScope.isOrg}} +

+ {{t "resources.project.title_plural"}} + +

+ {{#if @model.subScopes}} +

{{t "resources.project.description"}}

+ {{/if}} + {{/if}} +
+ + + {{#if @model.subScopes}} + + {{t 'titles.new'}} + + {{/if}} + + + + + {{#if @model.subScopes}} + + + {{#each @model.subScopes as |scope|}} + + {{/each}} + + + {{else}} + + {{#if @model.currentScope.isGlobal}} + + + + {{t 'resources.org.description'}} + + + + {{t 'titles.new'}} + + + + {{/if}} + + {{#if @model.currentScope.isOrg}} + + + + {{t 'resources.project.description'}} + + + + {{t 'titles.new'}} + + + + {{/if}} + + {{/if}} + + + +
diff --git a/ui/core/app/templates/scopes/scope/projects/project/sessions.hbs b/ui/core/app/templates/scopes/scope/sessions.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/sessions.hbs rename to ui/core/app/templates/scopes/scope/sessions.hbs diff --git a/ui/core/app/templates/scopes/scope/projects/project/sessions/index.hbs b/ui/core/app/templates/scopes/scope/sessions/index.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/sessions/index.hbs rename to ui/core/app/templates/scopes/scope/sessions/index.hbs diff --git a/ui/core/app/templates/scopes/scope/projects/project/targets.hbs b/ui/core/app/templates/scopes/scope/targets.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/targets.hbs rename to ui/core/app/templates/scopes/scope/targets.hbs diff --git a/ui/core/app/templates/scopes/scope/projects/project/targets/index.hbs b/ui/core/app/templates/scopes/scope/targets/index.hbs similarity index 90% rename from ui/core/app/templates/scopes/scope/projects/project/targets/index.hbs rename to ui/core/app/templates/scopes/scope/targets/index.hbs index 6efba5727..2aa1d6376 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/targets/index.hbs +++ b/ui/core/app/templates/scopes/scope/targets/index.hbs @@ -16,7 +16,7 @@ {{#if @model}} - + {{t "titles.new"}} {{/if}} @@ -39,7 +39,7 @@ {{target.displayName}} @@ -74,7 +74,7 @@ {{t "resources.target.description"}} - + {{t "titles.new"}} diff --git a/ui/core/app/templates/scopes/scope/projects/project/targets/new.hbs b/ui/core/app/templates/scopes/scope/targets/new.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/targets/new.hbs rename to ui/core/app/templates/scopes/scope/targets/new.hbs diff --git a/ui/core/app/templates/scopes/scope/projects/project/targets/target.hbs b/ui/core/app/templates/scopes/scope/targets/target.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/targets/target.hbs rename to ui/core/app/templates/scopes/scope/targets/target.hbs diff --git a/ui/core/app/templates/scopes/scope/projects/project/targets/target/-actions.hbs b/ui/core/app/templates/scopes/scope/targets/target/-actions.hbs similarity index 81% rename from ui/core/app/templates/scopes/scope/projects/project/targets/target/-actions.hbs rename to ui/core/app/templates/scopes/scope/targets/target/-actions.hbs index 46c053cbe..1d87ec790 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/targets/target/-actions.hbs +++ b/ui/core/app/templates/scopes/scope/targets/target/-actions.hbs @@ -1,5 +1,5 @@ - + {{t 'resources.target.actions.add-host-sets'}} diff --git a/ui/core/app/templates/scopes/scope/projects/project/targets/target/-header.hbs b/ui/core/app/templates/scopes/scope/targets/target/-header.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/targets/target/-header.hbs rename to ui/core/app/templates/scopes/scope/targets/target/-header.hbs diff --git a/ui/core/app/templates/scopes/scope/targets/target/-navigation.hbs b/ui/core/app/templates/scopes/scope/targets/target/-navigation.hbs new file mode 100644 index 000000000..e2117fe9a --- /dev/null +++ b/ui/core/app/templates/scopes/scope/targets/target/-navigation.hbs @@ -0,0 +1,8 @@ + + + {{t 'titles.details'}} + + + {{t 'resources.host-set.title_plural'}} + + diff --git a/ui/core/app/templates/scopes/scope/projects/project/targets/target/add-host-sets.hbs b/ui/core/app/templates/scopes/scope/targets/target/add-host-sets.hbs similarity index 89% rename from ui/core/app/templates/scopes/scope/projects/project/targets/target/add-host-sets.hbs rename to ui/core/app/templates/scopes/scope/targets/target/add-host-sets.hbs index 15daf752a..e214aa895 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/targets/target/add-host-sets.hbs +++ b/ui/core/app/templates/scopes/scope/targets/target/add-host-sets.hbs @@ -16,7 +16,7 @@ {{t "resources.target.host-set.messages.none.description"}} - + {{t "actions.back"}} diff --git a/ui/core/app/templates/scopes/scope/projects/project/targets/target/add-host-sets/-header.hbs b/ui/core/app/templates/scopes/scope/targets/target/add-host-sets/-header.hbs similarity index 100% rename from ui/core/app/templates/scopes/scope/projects/project/targets/target/add-host-sets/-header.hbs rename to ui/core/app/templates/scopes/scope/targets/target/add-host-sets/-header.hbs diff --git a/ui/core/app/templates/scopes/scope/projects/project/targets/target/host-sets.hbs b/ui/core/app/templates/scopes/scope/targets/target/host-sets.hbs similarity index 96% rename from ui/core/app/templates/scopes/scope/projects/project/targets/target/host-sets.hbs rename to ui/core/app/templates/scopes/scope/targets/target/host-sets.hbs index 5e49da20d..464dc32e1 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/targets/target/host-sets.hbs +++ b/ui/core/app/templates/scopes/scope/targets/target/host-sets.hbs @@ -58,7 +58,7 @@ {{t "resources.target.host-set.messages.welcome.description"}} - + {{t 'resources.target.actions.add-host-sets'}} diff --git a/ui/core/app/templates/scopes/scope/projects/project/targets/target/index.hbs b/ui/core/app/templates/scopes/scope/targets/target/index.hbs similarity index 97% rename from ui/core/app/templates/scopes/scope/projects/project/targets/target/index.hbs rename to ui/core/app/templates/scopes/scope/targets/target/index.hbs index 5c39ce009..83fc83598 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/targets/target/index.hbs +++ b/ui/core/app/templates/scopes/scope/targets/target/index.hbs @@ -2,4 +2,4 @@ @model={{@model}} @submit={{route-action "save" @model}} @cancel={{route-action "cancel" @model}} -/> \ No newline at end of file +/> diff --git a/ui/core/tests/acceptance/authentication-test.js b/ui/core/tests/acceptance/authentication-test.js index d8bdb6162..e4965ce8e 100644 --- a/ui/core/tests/acceptance/authentication-test.js +++ b/ui/core/tests/acceptance/authentication-test.js @@ -6,7 +6,7 @@ import { click, find, findAll, - setupOnerror, + //setupOnerror, } from '@ember/test-helpers'; import { setupApplicationTest } from 'ember-qunit'; import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; @@ -39,11 +39,16 @@ module('Acceptance | authentication', function (hooks) { let authMethodGlobalAuthenticateURL; let changePasswordURL; let orgsURL; + let orgEditURL; + let newProjectURL; let projectsURL; let usersURL; let groupsURL; let rolesURL; let authMethodsURL; + let hostCatalogsURL; + let sessionsURL; + let targetsURL; hooks.beforeEach(function () { invalidateSession(); @@ -72,12 +77,17 @@ module('Acceptance | authentication', function (hooks) { authMethodGlobalAuthenticateURL = `/scopes/global/authenticate/${globalAuthMethodID}`; authMethodAuthenticateURL = `/scopes/${orgScopeID}/authenticate/${authMethodID}`; changePasswordURL = `/account/change-password`; - orgsURL = `/scopes/global/orgs`; - projectsURL = `/scopes/${orgScopeID}/projects`; + orgsURL = `/scopes/global/scopes`; + orgEditURL = `/scopes/${orgScopeID}/edit`; + newProjectURL = `/scopes/${orgScopeID}/new`; + projectsURL = `/scopes/${orgScopeID}/scopes`; usersURL = `/scopes/${orgScopeID}/users`; groupsURL = `/scopes/${orgScopeID}/groups`; rolesURL = `/scopes/${orgScopeID}/roles`; authMethodsURL = `/scopes/${orgScopeID}/auth-methods`; + hostCatalogsURL = `/scopes/${orgScopeID}/host-catalogs`; + sessionsURL = `/scopes/${orgScopeID}/sessions`; + targetsURL = `/scopes/${orgScopeID}/targets`; }); test('visiting auth methods authenticate route redirects to first auth method', async function (assert) { @@ -129,6 +139,13 @@ module('Acceptance | authentication', function (hooks) { assert.notOk(currentSession().isAuthenticated); }); + test('visiting org edit while unauthenticated redirects to first global authenticate method', async function (assert) { + assert.expect(2); + await visit(orgEditURL); + assert.equal(currentURL(), authMethodGlobalAuthenticateURL); + assert.notOk(currentSession().isAuthenticated); + }); + test('visiting projects while unauthenticated redirects to first global authenticate method', async function (assert) { assert.expect(2); await visit(projectsURL); @@ -136,6 +153,13 @@ module('Acceptance | authentication', function (hooks) { assert.notOk(currentSession().isAuthenticated); }); + test('visiting new project while unauthenticated redirects to first global authenticate method', async function (assert) { + assert.expect(2); + await visit(newProjectURL); + assert.equal(currentURL(), authMethodGlobalAuthenticateURL); + assert.notOk(currentSession().isAuthenticated); + }); + test('visiting users while unauthenticated redirects to first global authenticate method', async function (assert) { assert.expect(2); await visit(usersURL); @@ -157,6 +181,27 @@ module('Acceptance | authentication', function (hooks) { assert.notOk(currentSession().isAuthenticated); }); + test('visiting host catalogs while unauthenticated redirects to first global authenticate method', async function (assert) { + assert.expect(2); + await visit(hostCatalogsURL); + assert.equal(currentURL(), authMethodGlobalAuthenticateURL); + assert.notOk(currentSession().isAuthenticated); + }); + + test('visiting targets while unauthenticated redirects to first global authenticate method', async function (assert) { + assert.expect(2); + await visit(targetsURL); + assert.equal(currentURL(), authMethodGlobalAuthenticateURL); + assert.notOk(currentSession().isAuthenticated); + }); + + test('visiting sessions while unauthenticated redirects to first global authenticate method', async function (assert) { + assert.expect(2); + await visit(sessionsURL); + assert.equal(currentURL(), authMethodGlobalAuthenticateURL); + assert.notOk(currentSession().isAuthenticated); + }); + test('visiting auth methods while unauthenticated redirects to first global authenticate method', async function (assert) { assert.expect(2); await visit(authMethodsURL); @@ -263,13 +308,11 @@ module('Acceptance | authentication', function (hooks) { currentSession().isAuthenticated, 'Session begins authenticated, before encountering 401' ); - this.server.get('/scopes', () => new Response(401)); - setupOnerror(() => { - assert.notOk( - currentSession().isAuthenticated, - 'Session is unauthenticated, after encountering 401' - ); - }); - await visit(projectsURL); + this.server.get('/users', () => new Response(401)); + await visit(usersURL); + assert.notOk( + currentSession().isAuthenticated, + 'Session is unauthenticated, after encountering 401' + ); }); }); diff --git a/ui/core/tests/acceptance/bread-crumbs-test.js b/ui/core/tests/acceptance/bread-crumbs-test.js deleted file mode 100644 index 02d7474f2..000000000 --- a/ui/core/tests/acceptance/bread-crumbs-test.js +++ /dev/null @@ -1,249 +0,0 @@ -import { module, test } from 'qunit'; -import { visit, currentURL, click, find, findAll } from '@ember/test-helpers'; -import { setupApplicationTest } from 'ember-qunit'; -import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; -import { - authenticateSession, - // These are left here intentionally for future reference. - //currentSession, - //invalidateSession, -} from 'ember-simple-auth/test-support'; - -module('Acceptance | breadcrumbs', function (hooks) { - setupApplicationTest(hooks); - setupMirage(hooks); - - let orgScope; - let getProjectScope; - let project; - let hostCatalog; - let user; - let role; - let group; - let projectsURL, projectURL, newProjectURL; - let hostCatalogsURL, hostCatalogURL, newHostCatalogURL; - let usersURL, userURL, newUserURL; - let rolesURL, roleURL, newRoleURL; - let groupsURL, groupURL, newGroupURL; - - let crumbPath; - - hooks.beforeEach(function () { - authenticateSession({}); - orgScope = this.server.create( - 'scope', - { - type: 'org', - }, - 'withChildren' - ); - - getProjectScope = () => - this.server.schema.scopes.where({ type: 'project' }).models[0]; - - project = getProjectScope(); - user = this.server.create('user', { scope: orgScope }); - role = this.server.create('role', { scope: orgScope }); - group = this.server.create('group', { scope: orgScope }); - hostCatalog = this.server.create('host-catalog', { - scope: getProjectScope(), - }); - - projectsURL = `/scopes/${orgScope.id}/projects`; - newProjectURL = `${projectsURL}/new`; - projectURL = `${projectsURL}/${project.id}`; - - rolesURL = `/scopes/${orgScope.id}/roles`; - newRoleURL = `${rolesURL}/new`; - roleURL = `${rolesURL}/${role.id}`; - - groupsURL = `/scopes/${orgScope.id}/groups`; - newGroupURL = `${groupsURL}/new`; - groupURL = `${groupsURL}/${group.id}`; - - usersURL = `/scopes/${orgScope.id}/users`; - newUserURL = `${usersURL}/${user.id}`; - userURL = `${usersURL}/new`; - - hostCatalogsURL = `${projectURL}/host-catalogs`; - newHostCatalogURL = `${hostCatalogsURL}/new`; - hostCatalogURL = `${hostCatalogsURL}/${hostCatalog.id}`; - }); - - test('can navigate via breadcrumbs to projects from project', async function (assert) { - 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; - 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.' - ); - }); - - 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; - 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.' - ); - }); - - 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(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.' - ); - }); - - 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(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.' - ); - }); - - 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(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.' - ); - }); - - 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; - 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.' - ); - }); - - 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; - 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.' - ); - }); - - 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; - 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.' - ); - }); - - 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; - 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.' - ); - }); - - 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; - 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.' - ); - }); - - 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; - 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.' - ); - }); -}); diff --git a/ui/core/tests/acceptance/host-catalogs-test.js b/ui/core/tests/acceptance/host-catalogs-test.js index bcb07a0a3..0c2a1fb30 100644 --- a/ui/core/tests/acceptance/host-catalogs-test.js +++ b/ui/core/tests/acceptance/host-catalogs-test.js @@ -1,9 +1,11 @@ import { module, test } from 'qunit'; -import { visit, currentURL, fillIn, click, find } from '@ember/test-helpers'; +import { visit, currentURL, find, click, fillIn } from '@ember/test-helpers'; import { setupApplicationTest } from 'ember-qunit'; import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; import a11yAudit from 'ember-a11y-testing/test-support/audit'; import { Response } from 'miragejs'; +import { resolve, reject } from 'rsvp'; +import sinon from 'sinon'; import { authenticateSession, // These are left here intentionally for future reference. @@ -11,30 +13,30 @@ import { //invalidateSession, } from 'ember-simple-auth/test-support'; -module('Acceptance | host catalogs', function (hooks) { +module('Acceptance | host-catalogs', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); + let gethostCatalogCount; + const instances = { scopes: { global: null, org: null, project: null, - }, - hostCatalog: null, + } }; const urls = { + globalScope: null, orgScope: null, - projects: null, - project: null, + projectScope: null, hostCatalogs: null, - newHostCatalog: null, hostCatalog: null, + newHostCatalog: null, }; hooks.beforeEach(function () { - // Setup Mirage mock resources for this test - authenticateSession(); + // Generate resources instances.scopes.global = this.server.create('scope', { id: 'global' }); instances.scopes.org = this.server.create('scope', { type: 'org', @@ -47,97 +49,53 @@ module('Acceptance | host catalogs', function (hooks) { instances.hostCatalog = this.server.create('host-catalog', { scope: instances.scopes.project, }); - // Generate route URLs for resources - urls.orgScope = `/scopes/${instances.scopes.org.id}`; - urls.projects = `${urls.orgScope}/projects`; - urls.project = `${urls.projects}/${instances.hostCatalog.scope.id}`; - urls.hostCatalogs = `${urls.project}/host-catalogs`; - urls.newHostCatalog = `${urls.hostCatalogs}/new`; + urls.globalScope = `/scopes/global/scopes`; + urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`; + urls.projectScope = `/scopes/${instances.scopes.project.id}`; + urls.hostCatalogs = `${urls.projectScope}/host-catalogs`; urls.hostCatalog = `${urls.hostCatalogs}/${instances.hostCatalog.id}`; + urls.unknownHostCatalog = `${urls.hostCatalogs}/foo`; + urls.newHostCatalog = `${urls.hostCatalogs}/new`; + // Generate resource couner + gethostCatalogCount = () => this.server.schema.hostCatalogs.all().models.length; + authenticateSession({}); }); test('visiting host catalogs', async function (assert) { - assert.expect(1); + assert.expect(2); await visit(urls.hostCatalogs); await a11yAudit(); assert.equal(currentURL(), urls.hostCatalogs); - }); - - test('can navigate to host catalog form', async function (assert) { - assert.expect(1); - await visit(urls.hostCatalogs); - await click('main tbody .rose-table-header-cell:nth-child(1) a'); + await visit(urls.hostCatalog); await a11yAudit(); assert.equal(currentURL(), urls.hostCatalog); }); - test('can delete host catalog', async function (assert) { + test('visiting an unknown host catalog displays 404 message', async function (assert) { + assert.expect(1); + await visit(urls.unknownHostCatalog); + await a11yAudit(); + assert.ok(find('.rose-message-subtitle').textContent.trim(), 'Error 404'); + }); + + test('can create new host catalogs', async function (assert) { + assert.expect(1); + const count = gethostCatalogCount(); + await visit(urls.newHostCatalog); + await fillIn('[name="name"]', 'random string'); + await click('[type="submit"]'); + assert.equal(gethostCatalogCount(), count + 1); + }); + + test('can cancel create new host catalogs', async function (assert) { assert.expect(2); - const hostCatalogsCount = this.server.db.hostCatalogs.length; - await visit(urls.hostCatalog); - assert.equal(currentURL(), urls.hostCatalog); - await click('.rose-layout-page-actions .rose-dropdown-button-danger'); - assert.equal(this.server.db.hostCatalogs.length, hostCatalogsCount - 1); - }); - - test('can update host catalog and save changes', async function (assert) { - assert.expect(1); - await visit(urls.hostCatalog); - await click('form [type="button"]', 'Activate edit mode'); - await fillIn('[name="name"]', 'Test Name'); - await click('form [type="submit"]:not(:disabled)'); - assert.equal(this.server.db.hostCatalogs[0].name, 'Test Name'); - }); - - test('can update host catalog and cancel changes', async function (assert) { - assert.expect(1); - await visit(urls.hostCatalog); - await click('form [type="button"]', 'Activate edit mode'); - await fillIn('[name="name"]', 'Test Name'); - await click('form button:not([type="submit"])'); - assert.notEqual(this.server.db.hostCatalogs[0].name, 'Test Name'); - }); - - test('can create host catalog and save changes', async function (assert) { - assert.expect(1); - const hostCatalogsCount = this.server.db.hostCatalogs.length; + const count = gethostCatalogCount(); await visit(urls.newHostCatalog); - await fillIn('[name="name"]', 'Test Name'); - await click('form [type="submit"]:not(:disabled)'); - assert.equal(this.server.db.hostCatalogs.length, hostCatalogsCount + 1); - }); - - test('can create host catalog and cancel changes', async function (assert) { - assert.expect(1); - const hostCatalogsCount = this.server.db.hostCatalogs.length; - await visit(urls.newHostCatalog); - await fillIn('[name="name"]', 'Test Name'); - await click('form button:not([type="submit"])'); - assert.equal(this.server.db.hostCatalogs.length, hostCatalogsCount); - }); - - test('errors are displayed when delete host catalog fails', async function (assert) { - assert.expect(1); - this.server.del('/host-catalogs/:id', () => { - return new Response( - 490, - {}, - { - status: 490, - code: 'error', - message: 'Oops.', - } - ); - }); - await visit(urls.hostCatalog); - await click('.rose-layout-page-actions .rose-dropdown-button-danger'); - await a11yAudit(); - assert.ok( - find('[role="alert"]').textContent.trim(), - 'Oops.', - 'Displays primary error message.' - ); + await fillIn('[name="name"]', 'random string'); + await click('.rose-form-actions [type="button"]'); + assert.equal(currentURL(), urls.hostCatalogs); + assert.equal(gethostCatalogCount(), count); }); test('saving a new host catalog with invalid fields displays error messages', async function (assert) { @@ -162,21 +120,35 @@ module('Acceptance | host catalogs', function (hooks) { ); }); await visit(urls.newHostCatalog); - await fillIn('[name="name"]', 'random string'); - await click('form [type="submit"]'); - await a11yAudit(); - assert.ok( - find('[role="alert"]').textContent.trim(), - 'The request was invalid.', - 'Displays primary error message.' - ); + await click('[type="submit"]'); + assert.ok(find('[role="alert"]').textContent.trim(), 'The request was invalid.'); assert.ok( find('.rose-form-error-message').textContent.trim(), - 'Name is required.', - 'Displays field-level errors.' + 'Name is required.' ); }); + test('can save changes to existing host catalog', async function (assert) { + assert.expect(3); + assert.notEqual(instances.hostCatalog.name, 'random string'); + await visit(urls.hostCatalog); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + await click('.rose-form-actions [type="submit"]'); + assert.equal(currentURL(), urls.hostCatalog); + assert.equal(this.server.schema.hostCatalogs.all().models[0].name, 'random string'); + }); + + test('can cancel changes to existing host catalog', async function (assert) { + assert.expect(2); + await visit(urls.hostCatalog); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + await click('.rose-form-actions [type="button"]'); + assert.notEqual(instances.hostCatalog.name, 'random string'); + assert.equal(find('[name="name"]').value, instances.hostCatalog.name); + }); + test('saving an existing host catalog with invalid fields displays error messages', async function (assert) { assert.expect(2); this.server.patch('/host-catalogs/:id', () => { @@ -201,17 +173,100 @@ module('Acceptance | host catalogs', function (hooks) { await visit(urls.hostCatalog); await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'random string'); - await click('form [type="submit"]'); - await a11yAudit(); - assert.ok( - find('[role="alert"]').textContent.trim(), - 'The request was invalid.', - 'Displays primary error message.' - ); + await click('[type="submit"]'); + assert.ok(find('[role="alert"]').textContent.trim(), 'The request was invalid.'); assert.ok( find('.rose-form-error-message').textContent.trim(), - 'Name is required.', - 'Displays field-level errors.' + 'Name is required.' ); }); + + test('can discard unsaved host catalog changes via dialog', async function (assert) { + assert.expect(5); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + assert.notEqual(instances.hostCatalog.name, 'random string'); + await visit(urls.hostCatalog); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + assert.equal(currentURL(), urls.hostCatalog); + try { + await visit(urls.hostCatalogs); + } catch (e) { + assert.ok(find('.rose-dialog')); + await click('.rose-dialog-footer button:first-child'); + assert.equal(currentURL(), urls.hostCatalogs); + assert.notEqual(this.server.schema.hostCatalogs.all().models[0].name, 'random string'); + } + }); + + test('can cancel discard unsaved host catalog changes via dialog', async function (assert) { + assert.expect(5); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + assert.notEqual(instances.hostCatalog.name, 'random string'); + await visit(urls.hostCatalog); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + assert.equal(currentURL(), urls.hostCatalog); + try { + await visit(urls.hostCatalogs); + } catch (e) { + assert.ok(find('.rose-dialog')); + await click('.rose-dialog-footer button:last-child'); + assert.equal(currentURL(), urls.hostCatalog); + assert.notEqual(this.server.schema.hostCatalogs.all().models[0].name, 'random string'); + } + }); + + test('can delete host catalog', async function (assert) { + assert.expect(1); + const count = gethostCatalogCount(); + await visit(urls.hostCatalog); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.equal(gethostCatalogCount(), count - 1); + }); + + test('can accept delete host catalog via dialog', async function (assert) { + assert.expect(2); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + confirmService.confirm = sinon.fake.returns(resolve()); + const count = gethostCatalogCount(); + await visit(urls.hostCatalog); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.equal(gethostCatalogCount(), count - 1); + assert.ok(confirmService.confirm.calledOnce); + }); + + test('cannot cancel delete host catalog via dialog', async function (assert) { + assert.expect(2); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + confirmService.confirm = sinon.fake.returns(reject()); + const count = gethostCatalogCount(); + await visit(urls.hostCatalog); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.equal(gethostCatalogCount(), count); + assert.ok(confirmService.confirm.calledOnce); + }); + + test('deleting a host catalog which errors displays error messages', async function (assert) { + assert.expect(1); + this.server.del('/host-catalogs/:id', () => { + return new Response( + 490, + {}, + { + status: 490, + code: 'error', + message: 'Oops.', + } + ); + }); + await visit(urls.hostCatalog); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.ok(find('[role="alert"]').textContent.trim(), 'Oops.'); + }); + }); diff --git a/ui/core/tests/acceptance/host-catalogs/host-sets-test.js b/ui/core/tests/acceptance/host-catalogs/host-sets-test.js new file mode 100644 index 000000000..aee192343 --- /dev/null +++ b/ui/core/tests/acceptance/host-catalogs/host-sets-test.js @@ -0,0 +1,283 @@ +import { module, test } from 'qunit'; +import { visit, currentURL, find, click, fillIn } from '@ember/test-helpers'; +import { setupApplicationTest } from 'ember-qunit'; +import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; +import a11yAudit from 'ember-a11y-testing/test-support/audit'; +import { Response } from 'miragejs'; +import { resolve, reject } from 'rsvp'; +import sinon from 'sinon'; +import { + authenticateSession, + // These are left here intentionally for future reference. + //currentSession, + //invalidateSession, +} from 'ember-simple-auth/test-support'; + +module('Acceptance | host-catalogs | host sets', function (hooks) { + setupApplicationTest(hooks); + setupMirage(hooks); + + let getHostSetCount; + + const instances = { + scopes: { + global: null, + org: null, + project: null, + hostCatalog: null, + host: null + } + }; + const urls = { + globalScope: null, + orgScope: null, + projectScope: null, + hostCatalogs: null, + hostCatalog: null, + hostSets: null, + hostSet: null, + unknownHostSet: null, + newHostSet: null, + }; + + hooks.beforeEach(function () { + // Generate resources + instances.scopes.global = this.server.create('scope', { id: 'global' }); + instances.scopes.org = this.server.create('scope', { + type: 'org', + scope: { id: 'global', type: 'global' }, + }); + instances.scopes.project = this.server.create('scope', { + type: 'project', + scope: { id: instances.scopes.org.id, type: 'org' }, + }); + instances.hostCatalog = this.server.create('host-catalog', { + scope: instances.scopes.project, + }); + instances.hostSet = this.server.create('host-set', { + scope: instances.scopes.project, + hostCatalog: instances.hostCatalog + }); + // Generate route URLs for resources + urls.globalScope = `/scopes/global/scopes`; + urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`; + urls.projectScope = `/scopes/${instances.scopes.project.id}`; + urls.hostCatalogs = `${urls.projectScope}/host-catalogs`; + urls.hostCatalog = `${urls.hostCatalogs}/${instances.hostCatalog.id}`; + urls.hostSets = `${urls.hostCatalog}/host-sets`; + urls.hostSet = `${urls.hostSets}/${instances.hostSet.id}`; + urls.unknownHostSet = `${urls.hostSets}/foo`; + urls.newHostSet = `${urls.hostSets}/new`; + // Generate resource couner + getHostSetCount = () => this.server.schema.hostSets.all().models.length; + authenticateSession({}); + }); + + test('visiting host sets', async function (assert) { + assert.expect(2); + await visit(urls.hostSets); + await a11yAudit(); + assert.equal(currentURL(), urls.hostSets); + await visit(urls.hostSet); + await a11yAudit(); + assert.equal(currentURL(), urls.hostSet); + }); + + test('visiting an unknown host set displays 404 message', async function (assert) { + assert.expect(1); + await visit(urls.unknownHostSet); + await a11yAudit(); + assert.ok(find('.rose-message-subtitle').textContent.trim(), 'Error 404'); + }); + + test('can create new host', async function (assert) { + assert.expect(1); + const count = getHostSetCount(); + await visit(urls.newHostSet); + await fillIn('[name="name"]', 'random string'); + await click('[type="submit"]'); + assert.equal(getHostSetCount(), count + 1); + }); + + test('can cancel create new host', async function (assert) { + assert.expect(2); + const count = getHostSetCount(); + await visit(urls.newHostSet); + await fillIn('[name="name"]', 'random string'); + await click('.rose-form-actions [type="button"]'); + assert.equal(currentURL(), urls.hostSets); + assert.equal(getHostSetCount(), count); + }); + + test('saving a new host set with invalid fields displays error messages', async function (assert) { + assert.expect(2); + this.server.post('/host-sets', () => { + return new Response( + 400, + {}, + { + status: 400, + code: 'invalid_argument', + message: 'The request was invalid.', + details: { + request_fields: [ + { + name: 'name', + description: 'Name is required.', + }, + ], + }, + } + ); + }); + await visit(urls.newHostSet); + await click('[type="submit"]'); + assert.ok(find('[role="alert"]').textContent.trim(), 'The request was invalid.'); + assert.ok( + find('.rose-form-error-message').textContent.trim(), + 'Name is required.' + ); + }); + + test('can save changes to existing host', async function (assert) { + assert.expect(3); + assert.notEqual(instances.hostSet.name, 'random string'); + await visit(urls.hostSet); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + await click('.rose-form-actions [type="submit"]'); + assert.equal(currentURL(), urls.hostSet); + assert.equal(this.server.schema.hostSets.all().models[0].name, 'random string'); + }); + + test('can cancel changes to existing host', async function (assert) { + assert.expect(2); + await visit(urls.hostSet); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + await click('.rose-form-actions [type="button"]'); + assert.notEqual(instances.hostSet.name, 'random string'); + assert.equal(find('[name="name"]').value, instances.hostSet.name); + }); + + test('saving an existing host set with invalid fields displays error messages', async function (assert) { + assert.expect(2); + this.server.patch('/host-sets/:id', () => { + return new Response( + 400, + {}, + { + status: 400, + code: 'invalid_argument', + message: 'The request was invalid.', + details: { + request_fields: [ + { + name: 'name', + description: 'Name is required.', + }, + ], + }, + } + ); + }); + await visit(urls.hostSet); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + await click('[type="submit"]'); + assert.ok(find('[role="alert"]').textContent.trim(), 'The request was invalid.'); + assert.ok( + find('.rose-form-error-message').textContent.trim(), + 'Name is required.' + ); + }); + + test('can discard unsaved host set changes via dialog', async function (assert) { + assert.expect(5); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + assert.notEqual(instances.hostSet.name, 'random string'); + await visit(urls.hostSet); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + assert.equal(currentURL(), urls.hostSet); + try { + await visit(urls.hostSets); + } catch (e) { + assert.ok(find('.rose-dialog')); + await click('.rose-dialog-footer button:first-child'); + assert.equal(currentURL(), urls.hostSets); + assert.notEqual(this.server.schema.hostSets.all().models[0].name, 'random string'); + } + }); + + test('can cancel discard unsaved host set changes via dialog', async function (assert) { + assert.expect(5); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + assert.notEqual(instances.hostSet.name, 'random string'); + await visit(urls.hostSet); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + assert.equal(currentURL(), urls.hostSet); + try { + await visit(urls.hostSets); + } catch (e) { + assert.ok(find('.rose-dialog')); + await click('.rose-dialog-footer button:last-child'); + assert.equal(currentURL(), urls.hostSet); + assert.notEqual(this.server.schema.hostSets.all().models[0].name, 'random string'); + } + }); + + test('can delete host', async function (assert) { + assert.expect(1); + const count = getHostSetCount(); + await visit(urls.hostSet); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.equal(getHostSetCount(), count - 1); + }); + + test('can accept delete host set via dialog', async function (assert) { + assert.expect(2); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + confirmService.confirm = sinon.fake.returns(resolve()); + const count = getHostSetCount(); + await visit(urls.hostSet); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.equal(getHostSetCount(), count - 1); + assert.ok(confirmService.confirm.calledOnce); + }); + + test('cannot cancel delete host set via dialog', async function (assert) { + assert.expect(2); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + confirmService.confirm = sinon.fake.returns(reject()); + const count = getHostSetCount(); + await visit(urls.hostSet); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.equal(getHostSetCount(), count); + assert.ok(confirmService.confirm.calledOnce); + }); + + test('deleting a host set which errors displays error messages', async function (assert) { + assert.expect(1); + this.server.del('/host-sets/:id', () => { + return new Response( + 490, + {}, + { + status: 490, + code: 'error', + message: 'Oops.', + } + ); + }); + await visit(urls.hostSet); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.ok(find('[role="alert"]').textContent.trim(), 'Oops.'); + }); + +}); diff --git a/ui/core/tests/acceptance/host-sets/hosts-test.js b/ui/core/tests/acceptance/host-catalogs/host-sets/hosts-test.js similarity index 81% rename from ui/core/tests/acceptance/host-sets/hosts-test.js rename to ui/core/tests/acceptance/host-catalogs/host-sets/hosts-test.js index f7ca0eb8b..224b479b4 100644 --- a/ui/core/tests/acceptance/host-sets/hosts-test.js +++ b/ui/core/tests/acceptance/host-catalogs/host-sets/hosts-test.js @@ -11,23 +11,25 @@ import { //invalidateSession, } from 'ember-simple-auth/test-support'; -module('Acceptance | host-sets | hosts', function (hooks) { +module('Acceptance | host-catalogs | host-sets | hosts', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); + let getHostSetHostCount; + const instances = { scopes: { global: null, org: null, project: null, - }, - hostCatalog: null, - hostSet: null, + hostCatalog: null, + host: null + } }; const urls = { + globalScope: null, orgScope: null, - projects: null, - project: null, + projectScope: null, hostCatalogs: null, hostCatalog: null, hostSets: null, @@ -36,11 +38,9 @@ module('Acceptance | host-sets | hosts', function (hooks) { addHosts: null, newHost: null, }; - let hostSetHostsCount; hooks.beforeEach(function () { - // Setup Mirage mock resources for this test - authenticateSession(); + // Generate resources instances.scopes.global = this.server.create('scope', { id: 'global' }); instances.scopes.org = this.server.create('scope', { type: 'org', @@ -55,18 +55,20 @@ module('Acceptance | host-sets | hosts', function (hooks) { }, 'withChildren'); instances.hostSet = this.server.schema.hostSets.all().models[0]; // Generate route URLs for resources - urls.orgScope = `/scopes/${instances.scopes.org.id}`; - urls.projects = `${urls.orgScope}/projects`; - urls.project = `${urls.projects}/${instances.hostCatalog.scope.id}`; - urls.hostCatalogs = `${urls.project}/host-catalogs`; + urls.globalScope = `/scopes/global/scopes`; + urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`; + urls.projectScope = `/scopes/${instances.scopes.project.id}`; + urls.hostCatalogs = `${urls.projectScope}/host-catalogs`; urls.hostCatalog = `${urls.hostCatalogs}/${instances.hostCatalog.id}`; urls.hostSets = `${urls.hostCatalog}/host-sets`; urls.hostSet = `${urls.hostSets}/${instances.hostSet.id}`; urls.hostSetHosts = `${urls.hostSet}/hosts`; urls.addHosts = `${urls.hostSet}/add-hosts`; - urls.newHost = `${urls.hostSet}/create-host`; - // Counts - hostSetHostsCount = instances.hostSet.hosts.length; + urls.createAndAddHost = `${urls.hostSet}/create-and-add-host`; + // Generate resource couner + getHostSetHostCount = () => + this.server.schema.hostSets.all().models[0].hosts.length; + authenticateSession({}); }); test('visiting host set hosts', async function (assert) { @@ -74,15 +76,16 @@ module('Acceptance | host-sets | hosts', function (hooks) { await visit(urls.hostSetHosts); await a11yAudit(); assert.equal(currentURL(), urls.hostSetHosts); - assert.equal(findAll('tbody tr').length, hostSetHostsCount); + assert.equal(findAll('tbody tr').length, getHostSetHostCount()); }); test('can remove a host', async function (assert) { assert.expect(2); + const count = getHostSetHostCount(); await visit(urls.hostSetHosts); - assert.equal(findAll('tbody tr').length, hostSetHostsCount); + assert.equal(findAll('tbody tr').length, count); await click('tbody tr .rose-dropdown-button-danger'); - assert.equal(findAll('tbody tr').length, hostSetHostsCount - 1); + assert.equal(findAll('tbody tr').length, count - 1); }); test('shows error message on host remove error', async function (assert) { @@ -100,7 +103,7 @@ module('Acceptance | host-sets | hosts', function (hooks) { ); }); await visit(urls.hostSetHosts); - assert.equal(findAll('tbody tr').length, hostSetHostsCount); + assert.equal(findAll('tbody tr').length, getHostSetHostCount()); await click('tbody tr .rose-dropdown-button-danger'); assert.ok(find('[role="alert"]')); }); @@ -130,16 +133,17 @@ module('Acceptance | host-sets | hosts', function (hooks) { test('select and cancel hosts to add', async function (assert) { assert.expect(4); + const count = getHostSetHostCount(); await visit(urls.hostSetHosts); - assert.equal(findAll('tbody tr').length, hostSetHostsCount); + assert.equal(findAll('tbody tr').length, count); await click('tbody tr .rose-dropdown-button-danger'); - assert.equal(findAll('tbody tr').length, hostSetHostsCount - 1); + assert.equal(findAll('tbody tr').length, count - 1); await click('.rose-layout-page-actions a:nth-child(2)') assert.equal(currentURL(), urls.addHosts); await click('tbody label'); await click('form [type="button"]'); await visit(urls.hostSetHosts); - assert.equal(findAll('tbody tr').length, hostSetHostsCount - 1); + assert.equal(findAll('tbody tr').length, count - 1); }); test('shows error message on host add error', async function (assert) { @@ -165,9 +169,9 @@ module('Acceptance | host-sets | hosts', function (hooks) { test('visiting host creation from a host set', async function (assert) { assert.expect(1); - await visit(urls.newHost); + await visit(urls.createAndAddHost); await a11yAudit(); - assert.equal(currentURL(), urls.newHost); + assert.equal(currentURL(), urls.createAndAddHost); }); test('create and add host to host set', async function (assert) { @@ -176,7 +180,7 @@ module('Acceptance | host-sets | hosts', function (hooks) { await visit(urls.hostSet); assert.equal(findAll('tbody tr').length, 0); await click('.rose-layout-page-actions a:nth-child(1)') - assert.equal(currentURL(), urls.newHost); + assert.equal(currentURL(), urls.createAndAddHost); await fillIn('[name="name"]', 'Test Name'); await fillIn('[name="description"]', 'description'); await click('form [type="submit"]:not(:disabled)'); @@ -186,7 +190,7 @@ module('Acceptance | host-sets | hosts', function (hooks) { test('create and cancel host add to host set', async function (assert) { assert.expect(1); - await visit(urls.newHost); + await visit(urls.createAndAddHost); await click('form [type="button"]'); assert.equal(currentURL(), urls.hostSetHosts); }); @@ -206,7 +210,7 @@ module('Acceptance | host-sets | hosts', function (hooks) { ); }); instances.hostSet.update({ hostIds: [] }); - await visit(urls.newHost); + await visit(urls.createAndAddHost); await fillIn('[name="name"]', 'New Host'); await click('form [type="submit"]'); assert.ok(find('[role="alert"]')); @@ -227,9 +231,10 @@ module('Acceptance | host-sets | hosts', function (hooks) { ); }); instances.hostSet.update({ hostIds: [] }); - await visit(urls.newHost); + await visit(urls.createAndAddHost); await fillIn('[name="name"]', 'New Host'); await click('form [type="submit"]'); assert.ok(find('[role="alert"]')); }); + }); diff --git a/ui/core/tests/acceptance/host-catalogs/hosts-test.js b/ui/core/tests/acceptance/host-catalogs/hosts-test.js new file mode 100644 index 000000000..ba1acae76 --- /dev/null +++ b/ui/core/tests/acceptance/host-catalogs/hosts-test.js @@ -0,0 +1,283 @@ +import { module, test } from 'qunit'; +import { visit, currentURL, find, click, fillIn } from '@ember/test-helpers'; +import { setupApplicationTest } from 'ember-qunit'; +import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; +import a11yAudit from 'ember-a11y-testing/test-support/audit'; +import { Response } from 'miragejs'; +import { resolve, reject } from 'rsvp'; +import sinon from 'sinon'; +import { + authenticateSession, + // These are left here intentionally for future reference. + //currentSession, + //invalidateSession, +} from 'ember-simple-auth/test-support'; + +module('Acceptance | host-catalogs | hosts', function (hooks) { + setupApplicationTest(hooks); + setupMirage(hooks); + + let getHostCount; + + const instances = { + scopes: { + global: null, + org: null, + project: null, + hostCatalog: null, + host: null + } + }; + const urls = { + globalScope: null, + orgScope: null, + projectScope: null, + hostCatalogs: null, + hostCatalog: null, + hosts: null, + host: null, + unknownHost: null, + newHost: null, + }; + + hooks.beforeEach(function () { + // Generate resources + instances.scopes.global = this.server.create('scope', { id: 'global' }); + instances.scopes.org = this.server.create('scope', { + type: 'org', + scope: { id: 'global', type: 'global' }, + }); + instances.scopes.project = this.server.create('scope', { + type: 'project', + scope: { id: instances.scopes.org.id, type: 'org' }, + }); + instances.hostCatalog = this.server.create('host-catalog', { + scope: instances.scopes.project, + }); + instances.host = this.server.create('host', { + scope: instances.scopes.project, + hostCatalog: instances.hostCatalog + }); + // Generate route URLs for resources + urls.globalScope = `/scopes/global/scopes`; + urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`; + urls.projectScope = `/scopes/${instances.scopes.project.id}`; + urls.hostCatalogs = `${urls.projectScope}/host-catalogs`; + urls.hostCatalog = `${urls.hostCatalogs}/${instances.hostCatalog.id}`; + urls.hosts = `${urls.hostCatalog}/hosts`; + urls.host = `${urls.hosts}/${instances.host.id}`; + urls.unknownHost = `${urls.hosts}/foo`; + urls.newHost = `${urls.hosts}/new`; + // Generate resource couner + getHostCount = () => this.server.schema.hosts.all().models.length; + authenticateSession({}); + }); + + test('visiting hosts', async function (assert) { + assert.expect(2); + await visit(urls.hosts); + await a11yAudit(); + assert.equal(currentURL(), urls.hosts); + await visit(urls.host); + await a11yAudit(); + assert.equal(currentURL(), urls.host); + }); + + test('visiting an unknown host displays 404 message', async function (assert) { + assert.expect(1); + await visit(urls.unknownHost); + await a11yAudit(); + assert.ok(find('.rose-message-subtitle').textContent.trim(), 'Error 404'); + }); + + test('can create new host', async function (assert) { + assert.expect(1); + const count = getHostCount(); + await visit(urls.newHost); + await fillIn('[name="name"]', 'random string'); + await click('[type="submit"]'); + assert.equal(getHostCount(), count + 1); + }); + + test('can cancel create new host', async function (assert) { + assert.expect(2); + const count = getHostCount(); + await visit(urls.newHost); + await fillIn('[name="name"]', 'random string'); + await click('.rose-form-actions [type="button"]'); + assert.equal(currentURL(), urls.hosts); + assert.equal(getHostCount(), count); + }); + + test('saving a new host with invalid fields displays error messages', async function (assert) { + assert.expect(2); + this.server.post('/hosts', () => { + return new Response( + 400, + {}, + { + status: 400, + code: 'invalid_argument', + message: 'The request was invalid.', + details: { + request_fields: [ + { + name: 'name', + description: 'Name is required.', + }, + ], + }, + } + ); + }); + await visit(urls.newHost); + await click('[type="submit"]'); + assert.ok(find('[role="alert"]').textContent.trim(), 'The request was invalid.'); + assert.ok( + find('.rose-form-error-message').textContent.trim(), + 'Name is required.' + ); + }); + + test('can save changes to existing host', async function (assert) { + assert.expect(3); + assert.notEqual(instances.host.name, 'random string'); + await visit(urls.host); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + await click('.rose-form-actions [type="submit"]'); + assert.equal(currentURL(), urls.host); + assert.equal(this.server.schema.hosts.all().models[0].name, 'random string'); + }); + + test('can cancel changes to existing host', async function (assert) { + assert.expect(2); + await visit(urls.host); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + await click('.rose-form-actions [type="button"]'); + assert.notEqual(instances.host.name, 'random string'); + assert.equal(find('[name="name"]').value, instances.host.name); + }); + + test('saving an existing host with invalid fields displays error messages', async function (assert) { + assert.expect(2); + this.server.patch('/hosts/:id', () => { + return new Response( + 400, + {}, + { + status: 400, + code: 'invalid_argument', + message: 'The request was invalid.', + details: { + request_fields: [ + { + name: 'name', + description: 'Name is required.', + }, + ], + }, + } + ); + }); + await visit(urls.host); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + await click('[type="submit"]'); + assert.ok(find('[role="alert"]').textContent.trim(), 'The request was invalid.'); + assert.ok( + find('.rose-form-error-message').textContent.trim(), + 'Name is required.' + ); + }); + + test('can discard unsaved host changes via dialog', async function (assert) { + assert.expect(5); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + assert.notEqual(instances.host.name, 'random string'); + await visit(urls.host); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + assert.equal(currentURL(), urls.host); + try { + await visit(urls.hosts); + } catch (e) { + assert.ok(find('.rose-dialog')); + await click('.rose-dialog-footer button:first-child'); + assert.equal(currentURL(), urls.hosts); + assert.notEqual(this.server.schema.hosts.all().models[0].name, 'random string'); + } + }); + + test('can cancel discard unsaved host changes via dialog', async function (assert) { + assert.expect(5); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + assert.notEqual(instances.host.name, 'random string'); + await visit(urls.host); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + assert.equal(currentURL(), urls.host); + try { + await visit(urls.hosts); + } catch (e) { + assert.ok(find('.rose-dialog')); + await click('.rose-dialog-footer button:last-child'); + assert.equal(currentURL(), urls.host); + assert.notEqual(this.server.schema.hosts.all().models[0].name, 'random string'); + } + }); + + test('can delete host', async function (assert) { + assert.expect(1); + const count = getHostCount(); + await visit(urls.host); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.equal(getHostCount(), count - 1); + }); + + test('can accept delete host via dialog', async function (assert) { + assert.expect(2); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + confirmService.confirm = sinon.fake.returns(resolve()); + const count = getHostCount(); + await visit(urls.host); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.equal(getHostCount(), count - 1); + assert.ok(confirmService.confirm.calledOnce); + }); + + test('cannot cancel delete host via dialog', async function (assert) { + assert.expect(2); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + confirmService.confirm = sinon.fake.returns(reject()); + const count = getHostCount(); + await visit(urls.host); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.equal(getHostCount(), count); + assert.ok(confirmService.confirm.calledOnce); + }); + + test('deleting a host which errors displays error messages', async function (assert) { + assert.expect(1); + this.server.del('/hosts/:id', () => { + return new Response( + 490, + {}, + { + status: 490, + code: 'error', + message: 'Oops.', + } + ); + }); + await visit(urls.host); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.ok(find('[role="alert"]').textContent.trim(), 'Oops.'); + }); + +}); diff --git a/ui/core/tests/acceptance/host-sets-test.js b/ui/core/tests/acceptance/host-sets-test.js deleted file mode 100644 index 1b69b06a3..000000000 --- a/ui/core/tests/acceptance/host-sets-test.js +++ /dev/null @@ -1,203 +0,0 @@ -import { module, test } from 'qunit'; -import { visit, currentURL, fillIn, click, find, findAll } from '@ember/test-helpers'; -import { setupApplicationTest } from 'ember-qunit'; -import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; -import a11yAudit from 'ember-a11y-testing/test-support/audit'; -import { Response } from 'miragejs'; -import { - authenticateSession, - // These are left here intentionally for future reference. - //currentSession, - //invalidateSession, -} from 'ember-simple-auth/test-support'; - -module('Acceptance | host sets', function (hooks) { - setupApplicationTest(hooks); - setupMirage(hooks); - - const instances = { - scopes: { - global: null, - org: null, - project: null, - }, - hostCatalog: null, - hostSet: null, - }; - const urls = { - orgScope: null, - projects: null, - project: null, - hostCatalogs: null, - hostCatalog: null, - hostSets: null, - hostSet: null, - newHostSet: null - }; - - hooks.beforeEach(function () { - // Setup Mirage mock resources for this test - authenticateSession(); - instances.scopes.global = this.server.create('scope', { id: 'global' }); - instances.scopes.org = this.server.create('scope', { - type: 'org', - scope: { id: 'global', type: 'global' }, - }); - instances.scopes.project = this.server.create('scope', { - type: 'project', - scope: { id: instances.scopes.org.id, type: 'org' }, - }); - instances.hostCatalog = this.server.create('host-catalog', { - scope: instances.scopes.project, - }); - instances.hostSet = this.server.create('host-set', { - scope: instances.scopes.project, - hostCatalog: instances.hostCatalog - }); - // Generate route URLs for resources - urls.orgScope = `/scopes/${instances.scopes.org.id}`; - urls.projects = `${urls.orgScope}/projects`; - urls.project = `${urls.projects}/${instances.hostCatalog.scope.id}`; - urls.hostCatalogs = `${urls.project}/host-catalogs`; - urls.hostCatalog = `${urls.hostCatalogs}/${instances.hostCatalog.id}`; - urls.hostSets = `${urls.hostCatalog}/host-sets`; - urls.hostSet = `${urls.hostSets}/${instances.hostSet.id}`; - urls.newHostSet = `${urls.hostSets}/new`; - }); - - test('visiting a host set', async function (assert) { - assert.expect(1); - await visit(urls.hostSet); - await a11yAudit(); - assert.equal(currentURL(), urls.hostSet); - }); - - test('can update a host set and save changes', async function (assert) { - assert.expect(3); - await visit(urls.hostSet); - await click('form [type="button"]', 'Activate edit mode'); - await fillIn('[name="name"]', 'Updated name'); - await fillIn('[name="description"]', 'Updated description'); - await click('.rose-form-actions [type="submit"]'); - assert.equal(currentURL(), urls.hostSet); - assert.equal(this.server.db.hostSets[0].name, 'Updated name'); - assert.equal(this.server.db.hostSets[0].description, 'Updated description'); - }); - - test('can update a host set and cancel changes', async function (assert) { - assert.expect(1); - await visit(urls.hostSet); - await click('form [type="button"]', 'Activate edit mode'); - await fillIn('[name="name"]', 'Updated name'); - await click('.rose-form-actions [type="button"]'); - assert.notEqual(find('[name="name"]').value, 'Updated name'); - }); - - test('can delete host set', async function (assert) { - assert.expect(2); - const hostSetsCount = this.server.db.hostSets.length; - await visit(urls.hostSet); - await click('.rose-layout-page-actions .rose-dropdown-button-danger'); - assert.equal(currentURL(), urls.hostSets); - assert.equal(this.server.db.hostSets.length, hostSetsCount - 1); - }); - - test('saving an existing host set with invalid fields displays error messages', async function (assert) { - assert.expect(2); - this.server.patch('/host-sets/:id', () => { - return new Response( - 400, - {}, - { - status: 400, - code: 'invalid_argument', - message: 'The request was invalid.', - details: { - request_fields: [ - { - name: 'name', - description: 'Name is required.', - }, - ], - }, - } - ); - }); - await visit(urls.hostSet); - await click('form [type="button"]', 'Activate edit mode'); - await fillIn('[name="name"]', 'existing host'); - await click('[type="submit"]'); - await a11yAudit(); - assert.ok(find('[role="alert"]')); - assert.ok(find('.rose-form-error-message')); - }); - - test('errors are displayed when delete on a host set fails', async function (assert) { - assert.expect(1); - this.server.del('/host-sets/:id', () => { - return new Response( - 490, - {}, - { - status: 490, - code: 'error', - message: 'Oops.', - } - ); - }); - await visit(urls.hostSet); - await click('.rose-layout-page-actions .rose-dropdown-button-danger'); - await a11yAudit(); - assert.ok(find('[role="alert"]')); - }); - - test('can create host set and save changes', async function (assert) { - assert.expect(1); - const hostSetsCount = this.server.db.hostSets.length; - await visit(urls.newHostSet); - await fillIn('[name="name"]', 'Test Name'); - await fillIn('[name="description"]', 'description'); - await click('form [type="submit"]:not(:disabled)'); - await visit(urls.hostSets); - assert.equal(findAll('tbody tr').length, hostSetsCount + 1); - }); - - test('can create host set and cancel changes', async function (assert) { - assert.expect(2); - const hostSetsCount = this.server.db.hostSets.length; - await visit(urls.newHostSet); - await fillIn('[name="name"]', 'Test Name'); - await click('form button:not([type="submit"])'); - assert.equal(currentURL(), urls.hostSets); - assert.equal(findAll('tbody tr').length, hostSetsCount); - }); - - test('saving a new host set with invalid fields displays error messages', async function (assert) { - assert.expect(2); - this.server.post('/host-sets', () => { - return new Response( - 400, - {}, - { - status: 400, - code: 'invalid_argument', - message: 'The request was invalid.', - details: { - request_fields: [ - { - name: 'name', - description: 'Name is required.', - }, - ], - }, - } - ); - }); - await visit(urls.newHostSet); - await fillIn('[name="name"]', 'new target'); - await click('form [type="submit"]'); - await a11yAudit(); - assert.ok(find('[role="alert"]')); - assert.ok(find('.rose-form-error-message')); - }); -}); diff --git a/ui/core/tests/acceptance/hosts-test.js b/ui/core/tests/acceptance/hosts-test.js deleted file mode 100644 index d04904da9..000000000 --- a/ui/core/tests/acceptance/hosts-test.js +++ /dev/null @@ -1,205 +0,0 @@ -import { module, test } from 'qunit'; -import { visit, currentURL, fillIn, click, find, findAll } from '@ember/test-helpers'; -import { setupApplicationTest } from 'ember-qunit'; -import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; -import a11yAudit from 'ember-a11y-testing/test-support/audit'; -import { Response } from 'miragejs'; -import { - authenticateSession, - // These are left here intentionally for future reference. - //currentSession, - //invalidateSession, -} from 'ember-simple-auth/test-support'; - -module('Acceptance | hosts', function (hooks) { - setupApplicationTest(hooks); - setupMirage(hooks); - - const instances = { - scopes: { - global: null, - org: null, - project: null, - }, - hostCatalog: null, - host: null, - }; - const urls = { - orgScope: null, - projects: null, - project: null, - hostCatalogs: null, - hostCatalog: null, - hosts: null, - host: null, - newHost: null - }; - - hooks.beforeEach(function () { - // Setup Mirage mock resources for this test - authenticateSession(); - instances.scopes.global = this.server.create('scope', { id: 'global' }); - instances.scopes.org = this.server.create('scope', { - type: 'org', - scope: { id: 'global', type: 'global' }, - }); - instances.scopes.project = this.server.create('scope', { - type: 'project', - scope: { id: instances.scopes.org.id, type: 'org' }, - }); - instances.hostCatalog = this.server.create('host-catalog', { - scope: instances.scopes.project, - }); - instances.host = this.server.create('host', { - scope: instances.scopes.project, - hostCatalog: instances.hostCatalog - }); - // Generate route URLs for resources - urls.orgScope = `/scopes/${instances.scopes.org.id}`; - urls.projects = `${urls.orgScope}/projects`; - urls.project = `${urls.projects}/${instances.hostCatalog.scope.id}`; - urls.hostCatalogs = `${urls.project}/host-catalogs`; - urls.hostCatalog = `${urls.hostCatalogs}/${instances.hostCatalog.id}`; - urls.hosts = `${urls.hostCatalog}/hosts`; - urls.host = `${urls.hosts}/${instances.host.id}`; - urls.newHost = `${urls.hosts}/new`; - }); - - test('visiting a host', async function (assert) { - assert.expect(1); - await visit(urls.host); - await a11yAudit(); - assert.equal(currentURL(), urls.host); - }); - - test('can update a host and save changes', async function (assert) { - assert.expect(4); - await visit(urls.host); - await click('form [type="button"]', 'Activate edit mode'); - await fillIn('[name="name"]', 'Updated name'); - await fillIn('[name="description"]', 'Updated description'); - await fillIn('[name="address"]', '::1'); - await click('.rose-form-actions [type="submit"]'); - assert.equal(currentURL(), urls.host); - assert.equal(this.server.db.hosts[0].name, 'Updated name'); - assert.equal(this.server.db.hosts[0].description, 'Updated description'); - assert.equal(this.server.db.hosts[0].attributes.address, '::1'); - }); - - test('can update a host and cancel changes', async function (assert) { - assert.expect(1); - await visit(urls.host); - await click('form [type="button"]', 'Activate edit mode'); - await fillIn('[name="name"]', 'Updated name'); - await click('.rose-form-actions [type="button"]'); - assert.notEqual(find('[name="name"]').value, 'Updated name'); - }); - - test('can delete host', async function (assert) { - assert.expect(2); - const hostsCount = this.server.db.hosts.length; - await visit(urls.host); - await click('.rose-layout-page-actions .rose-dropdown-button-danger'); - assert.equal(currentURL(), urls.hosts); - assert.equal(this.server.db.hosts.length, hostsCount - 1); - }); - - test('saving an existing host with invalid fields displays error messages', async function (assert) { - assert.expect(2); - this.server.patch('/hosts/:id', () => { - return new Response( - 400, - {}, - { - status: 400, - code: 'invalid_argument', - message: 'The request was invalid.', - details: { - request_fields: [ - { - name: 'name', - description: 'Name is required.', - }, - ], - }, - } - ); - }); - await visit(urls.host); - await click('form [type="button"]', 'Activate edit mode'); - await fillIn('[name="name"]', 'existing host'); - await click('[type="submit"]'); - await a11yAudit(); - assert.ok(find('[role="alert"]')); - assert.ok(find('.rose-form-error-message')); - }); - - test('errors are displayed when delete on a host fails', async function (assert) { - assert.expect(1); - this.server.del('/hosts/:id', () => { - return new Response( - 490, - {}, - { - status: 490, - code: 'error', - message: 'Oops.', - } - ); - }); - await visit(urls.host); - await click('.rose-layout-page-actions .rose-dropdown-button-danger'); - await a11yAudit(); - assert.ok(find('[role="alert"]')); - }); - - test('can create host and save changes', async function (assert) { - assert.expect(1); - const hostsCount = this.server.db.hosts.length; - await visit(urls.newHost); - await fillIn('[name="name"]', 'Test Name'); - await fillIn('[name="description"]', 'description'); - await click('form [type="submit"]:not(:disabled)'); - await visit(urls.hosts); - assert.equal(findAll('tbody tr').length, hostsCount + 1); - }); - - test('can create host and cancel changes', async function (assert) { - assert.expect(2); - const hostsCount = this.server.db.hosts.length; - await visit(urls.newHost); - await fillIn('[name="name"]', 'Test Name'); - await click('form button:not([type="submit"])'); - assert.equal(currentURL(), urls.hosts); - assert.equal(findAll('tbody tr').length, hostsCount); - }); - - test('saving a new host with invalid fields displays error messages', async function (assert) { - assert.expect(2); - this.server.post('/hosts', () => { - return new Response( - 400, - {}, - { - status: 400, - code: 'invalid_argument', - message: 'The request was invalid.', - details: { - request_fields: [ - { - name: 'name', - description: 'Name is required.', - }, - ], - }, - } - ); - }); - await visit(urls.newHost); - await fillIn('[name="name"]', 'new target'); - await click('form [type="submit"]'); - await a11yAudit(); - assert.ok(find('[role="alert"]')); - assert.ok(find('.rose-form-error-message')); - }); -}); diff --git a/ui/core/tests/acceptance/orgs-test.js b/ui/core/tests/acceptance/orgs-test.js deleted file mode 100644 index 4215d3db7..000000000 --- a/ui/core/tests/acceptance/orgs-test.js +++ /dev/null @@ -1,148 +0,0 @@ -import { module, test } from 'qunit'; -import { visit, currentURL, click, find, findAll, fillIn } from '@ember/test-helpers'; -import { setupApplicationTest } from 'ember-qunit'; -import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; -import a11yAudit from 'ember-a11y-testing/test-support/audit'; -import { Response } from 'miragejs'; -import { - authenticateSession, - // These are left here intentionally for future reference. - //currentSession, - //invalidateSession, -} from 'ember-simple-auth/test-support'; - -module('Acceptance | org', function (hooks) { - setupApplicationTest(hooks); - setupMirage(hooks); - - const instances = { - scopes: { - global: null, - }, - orgs: null, - }; - const urls = { - root: null, - scopes: null, - globalScope: null, - orgs: null, - newOrg: null, - }; - let orgsCount; - - hooks.beforeEach(function () { - // Setup Mirage mock resources for this test - authenticateSession({}); - instances.scopes.global = this.server.create('scope', { id: 'global' }); - instances.orgs = this.server.createList('scope', 2, { - type: 'org', - scope: { id: 'global', type: 'global' }, - }); - orgsCount = instances.orgs.length; - // Generate route URLs for resources - urls.root = '/'; - urls.scopes = `/scopes`; - urls.globalScope = `${urls.scopes}/global`; - urls.orgs = `${urls.globalScope}/orgs`; - urls.newOrg = `${urls.orgs}/new`; - }); - - test('visiting orgs', async function (assert) { - assert.expect(3); - await visit(urls.orgs); - await a11yAudit(); - assert.ok(orgsCount); - assert.equal(currentURL(), urls.orgs); - assert.equal(findAll('article').length, orgsCount); - }); - - test('visiting orgs when endpoint 404s shows an error message', async function (assert) { - assert.expect(1); - this.server.get('/scopes', () => new Response(404)); - await visit(urls.orgs); - await a11yAudit(); - assert.ok(find('.rose-message')); - }); - - test('visiting orgs is successful even when the global scope cannot be fetched', async function (assert) { - assert.expect(3); - this.server.get('/scopes/:id', ({ scopes }, { params: { id } }) => { - const scope = scopes.find(id); - return (id === 'global') - ? new Response(404) - : scope; - }); - await visit(urls.orgs); - await a11yAudit(); - assert.ok(orgsCount); - assert.equal(currentURL(), urls.orgs); - assert.equal(findAll('article').length, orgsCount); - }); - - test('visiting scopes redirects to index', async function (assert) { - assert.expect(1); - await visit(urls.scopes); - assert.equal(currentURL(), urls.orgs); - }); - - test('visiting root redirects to index', async function (assert) { - assert.expect(1); - await visit(urls.root); - assert.equal(currentURL(), urls.orgs); - }); - - test('visiting orgs within a non global scope redirects to index', async function (assert) { - const nonGlobalScopeURL = `${urls.scopes}/123/orgs`; - assert.expect(1); - await visit(nonGlobalScopeURL); - assert.equal(currentURL(), urls.orgs); - }); - - test('can create a new org', async function (assert) { - assert.expect(1); - await visit(urls.newOrg); - await fillIn('[name="name"]', 'Org name'); - await fillIn('[name="description"]', 'description'); - await click('form [type="submit"]:not(:disabled)'); - assert.equal(this.server.db.scopes.where(scope => scope.type === 'org').length, orgsCount + 1); - }); - - test('can cancel new org creation', async function (assert) { - assert.expect(2); - await visit(urls.newOrg); - await fillIn('[name="name"]', 'Org name'); - await fillIn('[name="description"]', 'description'); - await click('form button:not([type="submit"])'); - assert.equal(currentURL(), urls.orgs); - assert.equal(this.server.db.scopes.where(scope => scope.type === 'org').length, orgsCount); - }); - - test('saving a new org with invalid fields displays error messages', async function (assert) { - assert.expect(2); - this.server.post('/scopes', () => { - return new Response( - 400, - {}, - { - status: 400, - code: 'invalid_argument', - message: 'The request was invalid.', - details: { - request_fields: [ - { - name: 'name', - description: 'Name is required.', - }, - ], - }, - } - ); - }); - await visit(urls.newOrg); - await fillIn('[name="name"]', 'new org'); - await click('form [type="submit"]'); - await a11yAudit(); - assert.ok(find('[role="alert"]')); - assert.ok(find('.rose-form-error-message')); - }); -}); diff --git a/ui/core/tests/acceptance/projects-test.js b/ui/core/tests/acceptance/projects-test.js deleted file mode 100644 index 068323951..000000000 --- a/ui/core/tests/acceptance/projects-test.js +++ /dev/null @@ -1,264 +0,0 @@ -import { module, test } from 'qunit'; -import { visit, currentURL, click, fillIn, find } from '@ember/test-helpers'; -import { setupApplicationTest } from 'ember-qunit'; -import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; -import a11yAudit from 'ember-a11y-testing/test-support/audit'; -import { Response } from 'miragejs'; -import { resolve, reject } from 'rsvp'; -import { - authenticateSession, - // These are left here intentionally for future reference. - //currentSession, - //invalidateSession, -} from 'ember-simple-auth/test-support'; -import sinon from 'sinon'; - -module('Acceptance | projects', function (hooks) { - setupApplicationTest(hooks); - setupMirage(hooks); - - let org; - let orgID; - let projectsURL; - let newProjectURL; - let existingProject; - let existingProjectURL; - let getProjectScopesCount; - let getFirstProjectScope; - let initialProjectScopesCount; - - hooks.beforeEach(function () { - authenticateSession({}); - 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`; - newProjectURL = `/scopes/${orgID}/projects/new`; - existingProject = getFirstProjectScope(); - existingProjectURL = `/scopes/${orgID}/projects/${existingProject.id}`; - }); - - test('visiting projects', async function (assert) { - assert.expect(1); - await visit(projectsURL); - await a11yAudit(); - assert.equal(currentURL(), projectsURL); - }); - - test('visiting projects within a project scope redirects to the parent org scope', async function (assert) { - assert.expect(2); - const wrongProjectsURL = `/scopes/${existingProject.id}/projects`; - assert.notEqual(wrongProjectsURL, projectsURL); - await visit(wrongProjectsURL); - await a11yAudit(); - assert.equal( - currentURL(), - projectsURL, - 'Wrong projects path was redirected to correct path.' - ); - }); - - test('can create new projects', async function (assert) { - assert.expect(1); - await visit(newProjectURL); - await fillIn('[name="name"]', 'random string'); - await click('[type="submit"]'); - assert.equal(getProjectScopesCount(), initialProjectScopesCount + 1); - }); - - test('can cancel create new projects', async function (assert) { - assert.expect(3); - assert.equal(getProjectScopesCount(), initialProjectScopesCount); - await visit(newProjectURL); - await fillIn('[name="name"]', 'random string'); - await click('.rose-form-actions [type="button"]'); - assert.equal(currentURL(), projectsURL); - assert.equal(getProjectScopesCount(), initialProjectScopesCount); - }); - - test('saving a new project with invalid fields displays error messages', async function (assert) { - assert.expect(2); - this.server.post('/scopes', () => { - return new Response( - 400, - {}, - { - status: 400, - code: 'invalid_argument', - message: 'The request was invalid.', - details: { - request_fields: [ - { - name: 'name', - description: 'Name is required.', - }, - ], - }, - } - ); - }); - await visit(newProjectURL); - await click('[type="submit"]'); - assert.ok( - find('[role="alert"]').textContent.trim(), - 'The request was invalid.', - 'Displays primary error message.' - ); - assert.ok( - find('.rose-form-error-message').textContent.trim(), - 'Name is required.', - 'Displays field-level errors.' - ); - }); - - test('can save changes to existing project', async function (assert) { - assert.expect(3); - assert.notEqual(existingProject.name, 'random string'); - await visit(existingProjectURL); - await click('form [type="button"]', 'Activate edit mode'); - await fillIn('[name="name"]', 'random string'); - await click('.rose-form-actions [type="submit"]'); - assert.equal(currentURL(), existingProjectURL); - assert.equal(getFirstProjectScope().name, 'random string'); - }); - - test('can cancel changes to existing project', async function (assert) { - assert.expect(2); - await visit(existingProjectURL); - await click('form [type="button"]', 'Activate edit mode'); - await fillIn('[name="name"]', 'random string'); - await click('.rose-form-actions [type="button"]'); - assert.notEqual(existingProject.name, 'random string'); - assert.equal(find('[name="name"]').value, existingProject.name); - }); - - test('can discard unsaved changes via dialog', async function (assert) { - assert.expect(5); - const confirmService = this.owner.lookup('service:confirm'); - confirmService.enabled = true; - assert.notEqual(existingProject.name, 'random string'); - await visit(existingProjectURL); - await click('form [type="button"]', 'Activate edit mode'); - await fillIn('[name="name"]', 'random string'); - assert.equal(currentURL(), existingProjectURL); - try { - await visit(projectsURL); - } catch (e) { - assert.ok(find('.rose-dialog')); - await click('.rose-dialog-footer button:first-child'); - assert.equal(currentURL(), projectsURL); - assert.notEqual(getFirstProjectScope().name, 'random string'); - } - }); - - test('can cancel discard unsaved changes via dialog', async function (assert) { - assert.expect(5); - const confirmService = this.owner.lookup('service:confirm'); - confirmService.enabled = true; - assert.notEqual(existingProject.name, 'random string'); - await visit(existingProjectURL); - await click('form [type="button"]', 'Activate edit mode'); - await fillIn('[name="name"]', 'random string'); - assert.equal(currentURL(), existingProjectURL); - try { - await visit(projectsURL); - } catch (e) { - assert.ok(find('.rose-dialog')); - await click('.rose-dialog-footer button:last-child'); - assert.equal(currentURL(), existingProjectURL); - assert.notEqual(getFirstProjectScope().name, 'random string'); - } - }); - - test('can delete project', async function (assert) { - assert.expect(1); - await visit(existingProjectURL); - await click('.rose-layout-page-actions .rose-dropdown-button-danger'); - assert.equal(getProjectScopesCount(), initialProjectScopesCount - 1); - }); - - test('can delete project with confirmation acceptance', async function (assert) { - assert.expect(2); - const confirmService = this.owner.lookup('service:confirm'); - confirmService.enabled = true; - confirmService.confirm = sinon.fake.returns(resolve()); - await visit(existingProjectURL); - await click('.rose-layout-page-actions .rose-dropdown-button-danger'); - assert.equal(getProjectScopesCount(), initialProjectScopesCount - 1); - assert.ok(confirmService.confirm.calledOnce); - }); - - test('cannot delete project with confirmation denial', async function (assert) { - assert.expect(2); - const confirmService = this.owner.lookup('service:confirm'); - confirmService.enabled = true; - confirmService.confirm = sinon.fake.returns(reject()); - await visit(existingProjectURL); - await click('.rose-layout-page-actions .rose-dropdown-button-danger'); - assert.equal(getProjectScopesCount(), initialProjectScopesCount); - assert.ok(confirmService.confirm.calledOnce); - }); - - test('saving an existing project with invalid fields displays error messages', async function (assert) { - assert.expect(2); - this.server.patch('/scopes/:id', () => { - return new Response( - 400, - {}, - { - status: 400, - code: 'invalid_argument', - message: 'The request was invalid.', - details: { - request_fields: [ - { - name: 'name', - description: 'Name is required.', - }, - ], - }, - } - ); - }); - await visit(existingProjectURL); - await click('form [type="button"]', 'Activate edit mode'); - await fillIn('[name="name"]', 'random string'); - await click('[type="submit"]'); - assert.ok( - find('[role="alert"]').textContent.trim(), - 'The request was invalid.', - 'Displays primary error message.' - ); - assert.ok( - find('.rose-form-error-message').textContent.trim(), - 'Name is required.', - 'Displays field-level errors.' - ); - }); - - test('errors are displayed when delete project fails', async function (assert) { - assert.expect(1); - this.server.del('/scopes/:id', () => { - return new Response( - 490, - {}, - { - status: 490, - code: 'error', - message: 'Oops.', - } - ); - }); - await visit(existingProjectURL); - await click('.rose-layout-page-actions .rose-dropdown-button-danger'); - assert.ok( - find('[role="alert"]').textContent.trim(), - 'Oops.', - 'Displays primary error message.' - ); - }); -}); diff --git a/ui/core/tests/acceptance/scopes-test.js b/ui/core/tests/acceptance/scopes-test.js new file mode 100644 index 000000000..9af9e1da8 --- /dev/null +++ b/ui/core/tests/acceptance/scopes-test.js @@ -0,0 +1,344 @@ +import { module, test } from 'qunit'; +import { visit, currentURL, find, click, fillIn } from '@ember/test-helpers'; +import { setupApplicationTest } from 'ember-qunit'; +import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; +import a11yAudit from 'ember-a11y-testing/test-support/audit'; +import { Response } from 'miragejs'; +import { resolve, reject } from 'rsvp'; +import sinon from 'sinon'; +import { + authenticateSession, + // These are left here intentionally for future reference. + //currentSession, + //invalidateSession, +} from 'ember-simple-auth/test-support'; + +module('Acceptance | scopes', function (hooks) { + setupApplicationTest(hooks); + setupMirage(hooks); + + let getScopeCount; + + const instances = { + scopes: { + global: null, + org: null, + org2: null, + project: null, + project2: null, + } + }; + const urls = { + globalScope: null, + orgScope: null, + org2Scope: null, + orgScopeEdit: null, + org2ScopeEdit: null, + projectScope: null, + project2Scope: null, + projectScopeEdit: null, + project2ScopeEdit: null, + }; + + hooks.beforeEach(function () { + // Generate resources + instances.scopes.global = this.server.create('scope', { id: 'global' }); + instances.scopes.org = this.server.create('scope', { + type: 'org', + scope: { id: 'global', type: 'global' }, + }); + instances.scopes.org2 = this.server.create('scope', { + type: 'org', + scope: { id: 'global', type: 'global' }, + }); + instances.scopes.project = this.server.create('scope', { + type: 'project', + scope: { id: instances.scopes.org.id, type: 'org' }, + }); + instances.scopes.project2 = this.server.create('scope', { + type: 'project', + scope: { id: instances.scopes.org.id, type: 'org' }, + }); + // Generate route URLs for resources + urls.globalScope = `/scopes/global/scopes`; + urls.newOrgScope = `/scopes/global/new`; + urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`; + urls.org2Scope = `/scopes/${instances.scopes.org2.id}/scopes`; + urls.orgScopeEdit = `/scopes/${instances.scopes.org.id}/edit`; + urls.org2ScopeEdit = `/scopes/${instances.scopes.org2.id}/edit`; + urls.newProjectScope = `/scopes/${instances.scopes.org.id}/new`; + urls.projectScope = `/scopes/${instances.scopes.project.id}`; + urls.project2Scope = `/scopes/${instances.scopes.project2.id}`; + urls.projectScopeEdit = `/scopes/${instances.scopes.project.id}/edit`; + urls.project2ScopeEdit = `/scopes/${instances.scopes.project2.id}/edit`; + // Generate resource couner + getScopeCount = (type) => this.server.schema.scopes.where({ type }).length; + authenticateSession({}); + }); + + test('visiting global scope', async function (assert) { + assert.expect(1); + await visit(urls.globalScope); + await a11yAudit(); + assert.equal(currentURL(), urls.globalScope); + }); + + // TODO: this probably shouldn't be the case, but was setup to enable + // authentication when the global scope couldn't be loaded. + // In order to resolve this, we might hoist authentication routes up from + // under scopes. + test('visiting global scope is successful even when the global scope cannot be fetched', async function (assert) { + assert.expect(1); + this.server.get('/scopes/:id', ({ scopes }, { params: { id } }) => { + const scope = scopes.find(id); + const response = (id === 'global') + ? new Response(404) + : scope; + return response; + }); + await visit(urls.globalScope); + assert.equal(currentURL(), urls.globalScope); + }); + + test('visiting org scope', async function (assert) { + assert.expect(1); + await visit(urls.orgScope); + await a11yAudit(); + assert.equal(currentURL(), urls.orgScope); + }); + + // NOTE: In reality, we'd have a third "Global" item listed in the org + // dropdown. But since the mock test authenticator bypasses the auth + // normalization step, the UI doesn't know it's authenticated with global + // and thus doesn't display the "Global" item in the org nav dropdown. + test('can navigate among org scopes via header navigation', async function (assert) { + assert.expect(3); + await visit(urls.globalScope); + await a11yAudit(); + assert.equal(currentURL(), urls.globalScope); + await click('.rose-header-nav .rose-dropdown a:nth-child(1)'); + assert.equal(currentURL(), urls.orgScope); + // In reality, there would be a third item in the list + await click('.rose-header-nav .rose-dropdown a:nth-child(2)'); + assert.equal(currentURL(), urls.org2Scope); + }); + + test('can navigate among project scopes via header navigation', async function (assert) { + assert.expect(2); + await visit(urls.projectScope); + await a11yAudit(); + assert.equal(currentURL(), urls.projectScopeEdit); + await click('.rose-header-nav .rose-dropdown + .rose-dropdown a:nth-child(2)'); + assert.equal(currentURL(), urls.project2ScopeEdit); + }); + + test('can create new org scopes', async function (assert) { + assert.expect(1); + const orgScopeCount = getScopeCount('org'); + await visit(urls.newOrgScope); + await fillIn('[name="name"]', 'random string'); + await click('[type="submit"]'); + assert.equal(getScopeCount('org'), orgScopeCount + 1); + }); + + test('can create new project scopes', async function (assert) { + assert.expect(1); + const orgScopeCount = getScopeCount('project'); + await visit(urls.newProjectScope); + await fillIn('[name="name"]', 'random string'); + await click('[type="submit"]'); + assert.equal(getScopeCount('project'), orgScopeCount + 1); + }); + + test('can cancel create new org scopes', async function (assert) { + assert.expect(2); + const orgScopeCount = getScopeCount('org'); + await visit(urls.newOrgScope); + await fillIn('[name="name"]', 'random string'); + await click('.rose-form-actions [type="button"]'); + assert.equal(currentURL(), urls.globalScope); + assert.equal(getScopeCount('org'), orgScopeCount); + }); + + test('can cancel create new project scopes', async function (assert) { + assert.expect(2); + const projectScopeCount = getScopeCount('project'); + await visit(urls.newProjectScope); + await fillIn('[name="name"]', 'random string'); + await click('.rose-form-actions [type="button"]'); + assert.equal(currentURL(), urls.orgScope); + assert.equal(getScopeCount('project'), projectScopeCount); + }); + + test('saving a new scope with invalid fields displays error messages', async function (assert) { + assert.expect(2); + this.server.post('/scopes', () => { + return new Response( + 400, + {}, + { + status: 400, + code: 'invalid_argument', + message: 'The request was invalid.', + details: { + request_fields: [ + { + name: 'name', + description: 'Name is required.', + }, + ], + }, + } + ); + }); + await visit(urls.newOrgScope); + await click('[type="submit"]'); + assert.ok(find('[role="alert"]').textContent.trim(), 'The request was invalid.'); + assert.ok( + find('.rose-form-error-message').textContent.trim(), + 'Name is required.' + ); + }); + + test('can save changes to existing scope', async function (assert) { + assert.expect(3); + assert.notEqual(instances.scopes.org.name, 'random string'); + await visit(urls.orgScopeEdit); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + await click('.rose-form-actions [type="submit"]'); + assert.equal(currentURL(), urls.orgScopeEdit); + assert.equal(this.server.schema.scopes.where({ type: 'org' }).models[0].name, 'random string'); + }); + + test('can cancel changes to existing scope', async function (assert) { + assert.expect(2); + await visit(urls.orgScopeEdit); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + await click('.rose-form-actions [type="button"]'); + assert.notEqual(instances.scopes.org.name, 'random string'); + assert.equal(find('[name="name"]').value, instances.scopes.org.name); + }); + + test('saving an existing scope with invalid fields displays error messages', async function (assert) { + assert.expect(2); + this.server.patch('/scopes/:id', () => { + return new Response( + 400, + {}, + { + status: 400, + code: 'invalid_argument', + message: 'The request was invalid.', + details: { + request_fields: [ + { + name: 'name', + description: 'Name is required.', + }, + ], + }, + } + ); + }); + await visit(urls.orgScopeEdit); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + await click('[type="submit"]'); + assert.ok(find('[role="alert"]').textContent.trim(), 'The request was invalid.'); + assert.ok( + find('.rose-form-error-message').textContent.trim(), + 'Name is required.' + ); + }); + + test('can discard unsaved scope changes via dialog', async function (assert) { + assert.expect(5); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + assert.notEqual(instances.scopes.org.name, 'random string'); + await visit(urls.orgScopeEdit); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + assert.equal(currentURL(), urls.orgScopeEdit); + try { + await visit(urls.globalScope); + } catch (e) { + assert.ok(find('.rose-dialog')); + await click('.rose-dialog-footer button:first-child'); + assert.equal(currentURL(), urls.globalScope); + assert.notEqual(this.server.schema.scopes.where({ type: 'org' }).models[0].name, 'random string'); + } + }); + + test('can cancel discard unsaved scope changes via dialog', async function (assert) { + assert.expect(5); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + assert.notEqual(instances.scopes.org.name, 'random string'); + await visit(urls.orgScopeEdit); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + assert.equal(currentURL(), urls.orgScopeEdit); + try { + await visit(urls.globalScope); + } catch (e) { + assert.ok(find('.rose-dialog')); + await click('.rose-dialog-footer button:last-child'); + assert.equal(currentURL(), urls.orgScopeEdit); + assert.notEqual(this.server.schema.scopes.where({ type: 'org' }).models[0].name, 'random string'); + } + }); + + test('can delete scope', async function (assert) { + assert.expect(1); + const orgScopeCount = getScopeCount('org'); + await visit(urls.orgScopeEdit); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.equal(getScopeCount('org'), orgScopeCount - 1); + }); + + test('can accept delete scope via dialog', async function (assert) { + assert.expect(2); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + confirmService.confirm = sinon.fake.returns(resolve()); + const orgScopeCount = getScopeCount('org'); + await visit(urls.orgScopeEdit); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.equal(getScopeCount('org'), orgScopeCount - 1); + assert.ok(confirmService.confirm.calledOnce); + }); + + test('cannot cancel delete scope via dialog', async function (assert) { + assert.expect(2); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + confirmService.confirm = sinon.fake.returns(reject()); + const orgScopeCount = getScopeCount('org'); + await visit(urls.orgScopeEdit); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.equal(getScopeCount('org'), orgScopeCount); + assert.ok(confirmService.confirm.calledOnce); + }); + + test('deleting a scope which errors displays error messages', async function (assert) { + assert.expect(1); + this.server.del('/scopes/:id', () => { + return new Response( + 490, + {}, + { + status: 490, + code: 'error', + message: 'Oops.', + } + ); + }); + await visit(urls.orgScopeEdit); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.ok(find('[role="alert"]').textContent.trim(), 'Oops.'); + }); + +}); diff --git a/ui/core/tests/acceptance/sessions-test.js b/ui/core/tests/acceptance/sessions-test.js index 2757712f6..6026eaa24 100644 --- a/ui/core/tests/acceptance/sessions-test.js +++ b/ui/core/tests/acceptance/sessions-test.js @@ -46,7 +46,7 @@ module('Acceptance | sessions', function (hooks) { scope: instances.scopes.project, status: 'active' }, 'withAssociations'); - urls.sessions = `/scopes/${instances.scopes.org.id}/projects/${instances.scopes.project.id}/sessions`; + urls.sessions = `/scopes/${instances.scopes.project.id}/sessions`; }); test('visiting sessions', async function (assert) { diff --git a/ui/core/tests/acceptance/targets-test.js b/ui/core/tests/acceptance/targets-test.js index 76e87a931..594756b52 100644 --- a/ui/core/tests/acceptance/targets-test.js +++ b/ui/core/tests/acceptance/targets-test.js @@ -1,9 +1,11 @@ import { module, test } from 'qunit'; -import { visit, currentURL, click, find, findAll, fillIn } from '@ember/test-helpers'; +import { visit, currentURL, find, click, fillIn } from '@ember/test-helpers'; import { setupApplicationTest } from 'ember-qunit'; import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; import a11yAudit from 'ember-a11y-testing/test-support/audit'; import { Response } from 'miragejs'; +import { resolve, reject } from 'rsvp'; +import sinon from 'sinon'; import { authenticateSession, // These are left here intentionally for future reference. @@ -15,29 +17,26 @@ module('Acceptance | targets', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); + let getTargetCount; + const instances = { scopes: { global: null, org: null, project: null, - }, - target: null, - hostSets: null, + } }; const urls = { + globalScope: null, orgScope: null, - projects: null, - project: null, + projectScope: null, targets: null, - newTarget: null, target: null, - targetHostSets: null, - targetAddHostSets: null, + newTarget: null, }; hooks.beforeEach(function () { - // Setup Mirage mock resources for this test - authenticateSession({}); + // Generate resources instances.scopes.global = this.server.create('scope', { id: 'global' }); instances.scopes.org = this.server.create('scope', { type: 'org', @@ -47,97 +46,56 @@ module('Acceptance | targets', function (hooks) { type: 'project', scope: { id: instances.scopes.org.id, type: 'org' }, }); - - instances.hostCatalog = this.server.create('host-catalog', { - scope: instances.scopes.project - }, 'withChildren'); instances.target = this.server.create('target', { scope: instances.scopes.project, - hostSets: instances.hostCatalog.hostSets }); - // Generate route URLs for resources - urls.orgScope = `/scopes/${instances.scopes.org.id}`; - urls.projects = `${urls.orgScope}/projects`; - urls.project = `${urls.projects}/${instances.scopes.project.id}`; - urls.targets = `${urls.project}/targets`; - urls.newTarget = `${urls.targets}/new`; + urls.globalScope = `/scopes/global/scopes`; + urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`; + urls.projectScope = `/scopes/${instances.scopes.project.id}`; + urls.targets = `${urls.projectScope}/targets`; urls.target = `${urls.targets}/${instances.target.id}`; - urls.targetHostSets = `${urls.target}/host-sets`; - urls.targetAddHostSets = `${urls.target}/add-host-sets`; - }); - - hooks.afterEach(async function() { - const notification = find('.rose-notification'); - if(notification) { - await click('.rose-notification-dismiss'); - } + urls.unknownTarget = `${urls.targets}/foo`; + urls.newTarget = `${urls.targets}/new`; + // Generate resource couner + getTargetCount = () => this.server.schema.targets.all().models.length; + authenticateSession({}); }); test('visiting targets', async function (assert) { - assert.expect(1); + assert.expect(2); await visit(urls.targets); await a11yAudit(); assert.equal(currentURL(), urls.targets); - }); - - test('can navigate to a target form', async function (assert) { - assert.expect(1); - await visit(urls.targets); - await click('main tbody .rose-table-header-cell:nth-child(1) a'); + await visit(urls.target); await a11yAudit(); assert.equal(currentURL(), urls.target); }); - test('can update a target and save changes', async function (assert) { - assert.expect(2); - await visit(urls.target); - await click('form [type="button"]', 'Activate edit mode'); - await fillIn('[name="name"]', 'update name'); - await fillIn('[name="default_port"]', '1234'); - await click('form [type="submit"]:not(:disabled)'); - assert.equal(this.server.db.targets[0].name, 'update name'); - assert.equal(this.server.db.targets[0].attributes.default_port, '1234'); - }); - - test('can update a target and cancel changes', async function (assert) { - assert.expect(2); - await visit(urls.target); - await click('form [type="button"]', 'Activate edit mode'); - await fillIn('[name="name"]', 'update name'); - await fillIn('[name="default_port"]', '1234'); - await click('form button:not([type="submit"])'); - assert.notEqual(this.server.db.targets[0].name, 'update name'); - assert.notEqual(this.server.db.targets[0].port, '1234'); - }); - - test('can create new target', async function (assert) { + test('visiting an unknown target displays 404 message', async function (assert) { assert.expect(1); - const targetsCount = this.server.db.targets.length; - await visit(urls.newTarget); - await fillIn('[name="name"]', 'Target name'); - await fillIn('[name="description"]', 'description'); - await fillIn('[name="default_port"]', '1234'); - await click('form [type="submit"]:not(:disabled)'); - assert.equal(this.server.db.targets.length, targetsCount + 1); + await visit(urls.unknownTarget); + await a11yAudit(); + assert.ok(find('.rose-message-subtitle').textContent.trim(), 'Error 404'); }); - test('can cancel new target creation', async function (assert) { - assert.expect(2); - const targetsCount = this.server.db.targets.length; + test('can create new targets', async function (assert) { + assert.expect(1); + const count = getTargetCount(); await visit(urls.newTarget); - await fillIn('[name="name"]', 'Target Name'); - await click('form button:not([type="submit"])'); - assert.equal(this.server.db.targets.length, targetsCount); + await fillIn('[name="name"]', 'random string'); + await click('[type="submit"]'); + assert.equal(getTargetCount(), count + 1); + }); + + test('can cancel create new targets', async function (assert) { + assert.expect(2); + const count = getTargetCount(); + await visit(urls.newTarget); + await fillIn('[name="name"]', 'random string'); + await click('.rose-form-actions [type="button"]'); assert.equal(currentURL(), urls.targets); - }); - - test('can delete a target', async function(assert) { - assert.expect(1); - const targetsCount = this.server.db.targets.length; - await visit(urls.target); - await click('.rose-layout-page-actions .rose-dropdown-button-danger'); - assert.equal(this.server.db.targets.length, targetsCount - 1); + assert.equal(getTargetCount(), count); }); test('saving a new target with invalid fields displays error messages', async function (assert) { @@ -162,30 +120,33 @@ module('Acceptance | targets', function (hooks) { ); }); await visit(urls.newTarget); - await fillIn('[name="name"]', 'new target'); - await click('form [type="submit"]'); - await a11yAudit(); - assert.ok(find('[role="alert"]')); - assert.ok(find('.rose-form-error-message')); + await click('[type="submit"]'); + assert.ok(find('[role="alert"]').textContent.trim(), 'The request was invalid.'); + assert.ok( + find('.rose-form-error-message').textContent.trim(), + 'Name is required.' + ); }); - test('errors are displayed when delete on a target fails', async function (assert) { - assert.expect(1); - this.server.del('/targets/:id', () => { - return new Response( - 490, - {}, - { - status: 490, - code: 'error', - message: 'Oops.', - } - ); - }); + test('can save changes to existing target', async function (assert) { + assert.expect(3); + assert.notEqual(instances.target.name, 'random string'); await visit(urls.target); - await click('.rose-layout-page-actions .rose-dropdown-button-danger'); - await a11yAudit(); - assert.ok(find('[role="alert"]')); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + await click('.rose-form-actions [type="submit"]'); + assert.equal(currentURL(), urls.target); + assert.equal(this.server.schema.targets.all().models[0].name, 'random string'); + }); + + test('can cancel changes to existing target', async function (assert) { + assert.expect(2); + await visit(urls.target); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + await click('.rose-form-actions [type="button"]'); + assert.notEqual(instances.target.name, 'random string'); + assert.equal(find('[name="name"]').value, instances.target.name); }); test('saving an existing target with invalid fields displays error messages', async function (assert) { @@ -211,106 +172,101 @@ module('Acceptance | targets', function (hooks) { }); await visit(urls.target); await click('form [type="button"]', 'Activate edit mode'); - await fillIn('[name="name"]', 'existing target'); - await click('form [type="submit"]'); - await a11yAudit(); - assert.ok(find('[role="alert"]')); - assert.ok(find('.rose-form-error-message')); + await fillIn('[name="name"]', 'random string'); + await click('[type="submit"]'); + assert.ok(find('[role="alert"]').textContent.trim(), 'The request was invalid.'); + assert.ok( + find('.rose-form-error-message').textContent.trim(), + 'Name is required.' + ); }); - test('visiting target host sets', async function (assert) { - assert.expect(3); - const targetHostSetCount = instances.target.hostSets.length; - await visit(urls.targetHostSets); - await a11yAudit(); - assert.equal(currentURL(), urls.targetHostSets); - assert.ok(targetHostSetCount); - assert.equal(findAll('tbody tr').length, targetHostSetCount); + test('can discard unsaved target changes via dialog', async function (assert) { + assert.expect(5); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + assert.notEqual(instances.target.name, 'random string'); + await visit(urls.target); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + assert.equal(currentURL(), urls.target); + try { + await visit(urls.targets); + } catch (e) { + assert.ok(find('.rose-dialog')); + await click('.rose-dialog-footer button:first-child'); + assert.equal(currentURL(), urls.targets); + assert.notEqual(this.server.schema.targets.all().models[0].name, 'random string'); + } }); - test('can remove a host sets', async function (assert) { + test('can cancel discard unsaved target changes via dialog', async function (assert) { + assert.expect(5); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + assert.notEqual(instances.target.name, 'random string'); + await visit(urls.target); + await click('form [type="button"]', 'Activate edit mode'); + await fillIn('[name="name"]', 'random string'); + assert.equal(currentURL(), urls.target); + try { + await visit(urls.targets); + } catch (e) { + assert.ok(find('.rose-dialog')); + await click('.rose-dialog-footer button:last-child'); + assert.equal(currentURL(), urls.target); + assert.notEqual(this.server.schema.targets.all().models[0].name, 'random string'); + } + }); + + test('can delete target', async function (assert) { + assert.expect(1); + const count = getTargetCount(); + await visit(urls.target); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.equal(getTargetCount(), count - 1); + }); + + test('can accept delete target via dialog', async function (assert) { assert.expect(2); - const targetHostSetCount = instances.target.hostSets.length; - await visit(urls.targetHostSets); - assert.equal(findAll('tbody tr').length, targetHostSetCount); - await click('tbody tr .rose-dropdown-button-danger'); - assert.equal(findAll('tbody tr').length, targetHostSetCount - 1); + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + confirmService.confirm = sinon.fake.returns(resolve()); + const count = getTargetCount(); + await visit(urls.target); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.equal(getTargetCount(), count - 1); + assert.ok(confirmService.confirm.calledOnce); }); - test('shows error message on host set remove', async function (assert) { + test('cannot cancel delete target via dialog', async function (assert) { assert.expect(2); - this.server.post('/targets/:idMethod', () => { + const confirmService = this.owner.lookup('service:confirm'); + confirmService.enabled = true; + confirmService.confirm = sinon.fake.returns(reject()); + const count = getTargetCount(); + await visit(urls.target); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.equal(getTargetCount(), count); + assert.ok(confirmService.confirm.calledOnce); + }); + + test('deleting a target which errors displays error messages', async function (assert) { + assert.expect(1); + this.server.del('/targets/:id', () => { return new Response( - 400, + 490, {}, { - status: 400, - code: 'invalid_argument', - message: 'The request was invalid.', - details: {}, + status: 490, + code: 'error', + message: 'Oops.', } ); }); - const targetHostSetCount = instances.target.hostSets.length; - await visit(urls.targetHostSets); - assert.equal(findAll('tbody tr').length, targetHostSetCount); - await click('tbody tr .rose-dropdown-button-danger'); - assert.ok(find('[role="alert"]')); + await visit(urls.target); + await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + assert.ok(find('[role="alert"]').textContent.trim(), 'Oops.'); }); - test('select and save host sets to add', async function (assert) { - assert.expect(3); - instances.target.update({ hostSetIds: [] }); - await visit(urls.targetHostSets); - assert.equal(findAll('tbody tr').length, 0); - await click('.rose-layout-page-actions a') - assert.equal(currentURL(), urls.targetAddHostSets); - // Click three times to select, unselect, then reselect (for coverage) - await click('tbody label'); - await click('tbody label'); - await click('tbody label'); - await click('form [type="submit"]'); - await visit(urls.targetHostSets); - assert.equal(findAll('tbody tr').length, 1); - }); - - test('select and cancel host sets to add', async function (assert) { - assert.expect(4); - const targetHostSetCount = instances.target.hostSets.length; - await visit(urls.targetHostSets); - assert.equal(findAll('tbody tr').length, targetHostSetCount); - // first, remove a target host set (otherwise none would be available to add) - await click('tbody tr .rose-dropdown-button-danger'); - assert.equal(findAll('tbody tr').length, targetHostSetCount - 1); - await click('.rose-layout-page-actions a') - assert.equal(currentURL(), urls.targetAddHostSets); - await click('tbody label'); - await click('form [type="button"]'); - await visit(urls.targetHostSets); - assert.equal(findAll('tbody tr').length, targetHostSetCount - 1); - }); - - test('shows error message on host set add', async function (assert) { - assert.expect(4); - this.server.post('/targets/:idMethod', () => { - return new Response( - 400, - {}, - { - status: 400, - code: 'invalid_argument', - message: 'The request was invalid.', - details: {}, - } - ); - }); - instances.target.update({ hostSetIds: [] }); - await visit(urls.targetAddHostSets); - assert.equal(instances.target.hostSets.length, 0); - assert.equal(currentURL(), urls.targetAddHostSets); - await click('tbody label'); - await click('form [type="submit"]'); - assert.equal(currentURL(), urls.targetAddHostSets); - assert.equal(instances.target.hostSets.length, 0); - }); }); diff --git a/ui/core/tests/acceptance/targets/host-sets-test.js b/ui/core/tests/acceptance/targets/host-sets-test.js new file mode 100644 index 000000000..21655f223 --- /dev/null +++ b/ui/core/tests/acceptance/targets/host-sets-test.js @@ -0,0 +1,160 @@ +import { module, test } from 'qunit'; +import { visit, currentURL, find, findAll, click } from '@ember/test-helpers'; +import { setupApplicationTest } from 'ember-qunit'; +import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; +import a11yAudit from 'ember-a11y-testing/test-support/audit'; +import { Response } from 'miragejs'; +import { + authenticateSession, + // These are left here intentionally for future reference. + //currentSession, + //invalidateSession, +} from 'ember-simple-auth/test-support'; + +module('Acceptance | targets | host-sets', function (hooks) { + setupApplicationTest(hooks); + setupMirage(hooks); + + const instances = { + scopes: { + global: null, + org: null, + project: null, + } + }; + const urls = { + globalScope: null, + orgScope: null, + projectScope: null, + targets: null, + target: null, + targetHostSets: null, + targetAddHostSets: null, + }; + + hooks.beforeEach(function () { + // Generate resources + instances.scopes.global = this.server.create('scope', { id: 'global' }); + instances.scopes.org = this.server.create('scope', { + type: 'org', + scope: { id: 'global', type: 'global' }, + }); + instances.scopes.project = this.server.create('scope', { + type: 'project', + scope: { id: instances.scopes.org.id, type: 'org' }, + }); + instances.hostCatalog = this.server.create('host-catalog', { + scope: instances.scopes.project + }, 'withChildren'); + instances.target = this.server.create('target', { + scope: instances.scopes.project, + hostSets: instances.hostCatalog.hostSets + }); + // Generate route URLs for resources + urls.globalScope = `/scopes/global/scopes`; + urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`; + urls.projectScope = `/scopes/${instances.scopes.project.id}`; + urls.targets = `/scopes/${instances.scopes.project.id}/targets`; + urls.target = `${urls.targets}/${instances.target.id}`; + urls.targetHostSets = `${urls.target}/host-sets`; + urls.targetAddHostSets = `${urls.target}/add-host-sets`; + authenticateSession({}); + }); + + test('visiting target host sets', async function (assert) { + assert.expect(3); + const targetHostSetCount = instances.target.hostSets.length; + await visit(urls.targetHostSets); + await a11yAudit(); + assert.equal(currentURL(), urls.targetHostSets); + assert.ok(targetHostSetCount); + assert.equal(findAll('tbody tr').length, targetHostSetCount); + }); + + test('can remove a host sets', async function (assert) { + assert.expect(2); + const targetHostSetCount = instances.target.hostSets.length; + await visit(urls.targetHostSets); + assert.equal(findAll('tbody tr').length, targetHostSetCount); + await click('tbody tr .rose-dropdown-button-danger'); + assert.equal(findAll('tbody tr').length, targetHostSetCount - 1); + }); + + test('removing a target host set which errors displays error messages', async function (assert) { + assert.expect(2); + this.server.post('/targets/:idMethod', () => { + return new Response( + 400, + {}, + { + status: 400, + code: 'invalid_argument', + message: 'The request was invalid.', + details: {}, + } + ); + }); + const targetHostSetCount = instances.target.hostSets.length; + await visit(urls.targetHostSets); + assert.equal(findAll('tbody tr').length, targetHostSetCount); + await click('tbody tr .rose-dropdown-button-danger'); + assert.ok(find('[role="alert"]')); + }); + + test('select and save host sets to add', async function (assert) { + assert.expect(3); + instances.target.update({ hostSetIds: [] }); + await visit(urls.targetHostSets); + assert.equal(findAll('tbody tr').length, 0); + await click('.rose-layout-page-actions a') + assert.equal(currentURL(), urls.targetAddHostSets); + // Click three times to select, unselect, then reselect (for coverage) + await click('tbody label'); + await click('tbody label'); + await click('tbody label'); + await click('form [type="submit"]'); + await visit(urls.targetHostSets); + assert.equal(findAll('tbody tr').length, 1); + }); + + test('select and cancel host sets to add', async function (assert) { + assert.expect(4); + const targetHostSetCount = instances.target.hostSets.length; + await visit(urls.targetHostSets); + assert.equal(findAll('tbody tr').length, targetHostSetCount); + // first, remove a target host set (otherwise none would be available to add) + await click('tbody tr .rose-dropdown-button-danger'); + assert.equal(findAll('tbody tr').length, targetHostSetCount - 1); + await click('.rose-layout-page-actions a') + assert.equal(currentURL(), urls.targetAddHostSets); + await click('tbody label'); + await click('form [type="button"]'); + await visit(urls.targetHostSets); + assert.equal(findAll('tbody tr').length, targetHostSetCount - 1); + }); + + test('adding a target host set which errors displays error messages', async function (assert) { + assert.expect(4); + this.server.post('/targets/:idMethod', () => { + return new Response( + 400, + {}, + { + status: 400, + code: 'invalid_argument', + message: 'The request was invalid.', + details: {}, + } + ); + }); + instances.target.update({ hostSetIds: [] }); + await visit(urls.targetAddHostSets); + assert.equal(instances.target.hostSets.length, 0); + assert.equal(currentURL(), urls.targetAddHostSets); + await click('tbody label'); + await click('form [type="submit"]'); + assert.equal(currentURL(), urls.targetAddHostSets); + assert.equal(instances.target.hostSets.length, 0); + }); + +}); diff --git a/ui/core/tests/integration/components/form/account-test.js b/ui/core/tests/integration/components/form/account-test.js deleted file mode 100644 index 5fc184035..000000000 --- a/ui/core/tests/integration/components/form/account-test.js +++ /dev/null @@ -1,23 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, find } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | form/account/index', function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - this.submit = () => {}; - this.cancel = () => {}; - this.model = { type: 'password' }; - - await render(hbs` - `); - - assert.ok(find('form')); - }); -}); diff --git a/ui/core/tests/integration/components/form/account/password-test.js b/ui/core/tests/integration/components/form/account/password-test.js deleted file mode 100644 index 3ac6bf4ed..000000000 --- a/ui/core/tests/integration/components/form/account/password-test.js +++ /dev/null @@ -1,23 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, find } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | form/account/password', function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - this.submit = () => {}; - this.cancel = () => {}; - this.model = { type: 'password' }; - - await render(hbs` - `); - - assert.ok(find('form')); - }); -}); diff --git a/ui/core/tests/integration/components/form/account/password/change-password-test.js b/ui/core/tests/integration/components/form/account/password/change-password-test.js deleted file mode 100644 index 54a6f61dd..000000000 --- a/ui/core/tests/integration/components/form/account/password/change-password-test.js +++ /dev/null @@ -1,26 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, find } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module( - 'Integration | Component | form/account/password/change-password', - function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - this.submit = () => {}; - this.cancel = () => {}; - this.model = { type: 'password' }; - - await render(hbs` - `); - - assert.ok(find('form')); - }); - } -); diff --git a/ui/core/tests/integration/components/form/account/password/set-password-test.js b/ui/core/tests/integration/components/form/account/password/set-password-test.js deleted file mode 100644 index ae4e1d355..000000000 --- a/ui/core/tests/integration/components/form/account/password/set-password-test.js +++ /dev/null @@ -1,26 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, find } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module( - 'Integration | Component | form/account/password/set-password', - function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - this.submit = () => {}; - this.cancel = () => {}; - this.model = { type: 'password' }; - - await render(hbs` - `); - - assert.ok(find('form')); - }); - } -); diff --git a/ui/core/tests/integration/components/form/auth-method-test.js b/ui/core/tests/integration/components/form/auth-method-test.js deleted file mode 100644 index 267e516b5..000000000 --- a/ui/core/tests/integration/components/form/auth-method-test.js +++ /dev/null @@ -1,23 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, find } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | form/auth-method', function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - this.submit = () => {}; - this.cancel = () => {}; - this.model = { type: 'password' }; - - await render(hbs` - `); - - assert.ok(find('form')); - }); -}); diff --git a/ui/core/tests/integration/components/form/host-catalog-test.js b/ui/core/tests/integration/components/form/host-catalog-test.js deleted file mode 100644 index 20dbd545f..000000000 --- a/ui/core/tests/integration/components/form/host-catalog-test.js +++ /dev/null @@ -1,23 +0,0 @@ -import { module, test } from 'qunit'; -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) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - // Set any properties with this.set('myProperty', 'value'); - // Handle any actions with this.set('myAction', function(val) { ... }); - this.submit = () => {}; - this.cancel = () => {}; - - await render(hbs` - `); - - assert.ok(find('form')); - }); -}); diff --git a/ui/core/tests/integration/components/form/host-set-test.js b/ui/core/tests/integration/components/form/host-set-test.js deleted file mode 100644 index 849ca7651..000000000 --- a/ui/core/tests/integration/components/form/host-set-test.js +++ /dev/null @@ -1,23 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, find } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | form/host-set', function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - // Set any properties with this.set('myProperty', 'value'); - // Handle any actions with this.set('myAction', function(val) { ... }); - this.submit = () => {}; - this.cancel = () => {}; - - await render(hbs` - `); - - assert.ok(find('form')); - }); -}); diff --git a/ui/core/tests/integration/components/form/host-set/add-hosts-test.js b/ui/core/tests/integration/components/form/host-set/add-hosts-test.js deleted file mode 100644 index 2614047a0..000000000 --- a/ui/core/tests/integration/components/form/host-set/add-hosts-test.js +++ /dev/null @@ -1,12 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -// import { render } from '@ember/test-helpers'; -// import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | form/host-set/add-hosts', function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - assert.expect(0); - }); -}); diff --git a/ui/core/tests/integration/components/form/host-test.js b/ui/core/tests/integration/components/form/host-test.js deleted file mode 100644 index bb4420a6f..000000000 --- a/ui/core/tests/integration/components/form/host-test.js +++ /dev/null @@ -1,23 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, find } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | form/host', function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - // Set any properties with this.set('myProperty', 'value'); - // Handle any actions with this.set('myAction', function(val) { ... }); - this.submit = () => {}; - this.cancel = () => {}; - - await render(hbs` - `); - - assert.ok(find('form')); - }); -}); diff --git a/ui/core/tests/integration/components/form/org-test.js b/ui/core/tests/integration/components/form/org-test.js deleted file mode 100644 index cfc7d25e5..000000000 --- a/ui/core/tests/integration/components/form/org-test.js +++ /dev/null @@ -1,23 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, find } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | form/org', function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - // Set any properties with this.set('myProperty', 'value'); - // Handle any actions with this.set('myAction', function(val) { ... }); - this.submit = () => {}; - this.cancel = () => {}; - - await render(hbs` - `); - - assert.ok(find('form')); - }); -}); diff --git a/ui/core/tests/integration/components/form/project-test.js b/ui/core/tests/integration/components/form/project-test.js deleted file mode 100644 index d4cb276ed..000000000 --- a/ui/core/tests/integration/components/form/project-test.js +++ /dev/null @@ -1,23 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, find } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | form/project', function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - // Set any properties with this.set('myProperty', 'value'); - // Handle any actions with this.set('myAction', function(val) { ... }); - this.submit = () => {}; - this.cancel = () => {}; - - await render(hbs` - `); - - assert.ok(find('form')); - }); -}); diff --git a/ui/core/tests/integration/components/form/role/add-principals-test.js b/ui/core/tests/integration/components/form/role/add-principals-test.js deleted file mode 100644 index 4b6ed6a3d..000000000 --- a/ui/core/tests/integration/components/form/role/add-principals-test.js +++ /dev/null @@ -1,12 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -// import { render } from '@ember/test-helpers'; -// import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | form/role/add-principals', function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - assert.expect(0); - }); -}); diff --git a/ui/core/tests/integration/components/form/target-test.js b/ui/core/tests/integration/components/form/target-test.js deleted file mode 100644 index e0246833f..000000000 --- a/ui/core/tests/integration/components/form/target-test.js +++ /dev/null @@ -1,23 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, find } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | form/target', function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - // Set any properties with this.set('myProperty', 'value'); - // Handle any actions with this.set('myAction', function(val) { ... }); - this.submit = () => {}; - this.cancel = () => {}; - - await render(hbs` - `); - - assert.ok(find('form')); - }); -}); diff --git a/ui/core/tests/integration/components/form/target/add-host-sets-test.js b/ui/core/tests/integration/components/form/target/add-host-sets-test.js deleted file mode 100644 index ce93c7a02..000000000 --- a/ui/core/tests/integration/components/form/target/add-host-sets-test.js +++ /dev/null @@ -1,12 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -// import { render } from '@ember/test-helpers'; -// import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | form/target/add-host-sets', function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - assert.expect(0); - }); -}); diff --git a/ui/core/tests/integration/components/form/user/add-accounts-test.js b/ui/core/tests/integration/components/form/user/add-accounts-test.js deleted file mode 100644 index ba96e4dba..000000000 --- a/ui/core/tests/integration/components/form/user/add-accounts-test.js +++ /dev/null @@ -1,12 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -// import { render } from '@ember/test-helpers'; -// import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | form/user/add-accounts', function(hooks) { - setupRenderingTest(hooks); - - test('it renders', async function(assert) { - assert.expect(0); - }); -}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host-test.js b/ui/core/tests/unit/controllers/scopes/scope/auth-methods/auth-method/accounts/account/set-password-test.js similarity index 57% rename from ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host-test.js rename to ui/core/tests/unit/controllers/scopes/scope/auth-methods/auth-method/accounts/account/set-password-test.js index aba1c7c22..daed6ca0a 100644 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host-test.js +++ b/ui/core/tests/unit/controllers/scopes/scope/auth-methods/auth-method/accounts/account/set-password-test.js @@ -1,12 +1,12 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host', function(hooks) { +module('Unit | Controller | scopes/scope/auth-methods/auth-method/accounts/account/set-password', function(hooks) { setupTest(hooks); // TODO: Replace this with your real tests. test('it exists', function(assert) { - let controller = this.owner.lookup('controller:scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host'); + let controller = this.owner.lookup('controller:scopes/scope/auth-methods/auth-method/accounts/account/set-password'); assert.ok(controller); }); }); diff --git a/ui/core/tests/unit/controllers/scopes/scope/groups/group/members-test.js b/ui/core/tests/unit/controllers/scopes/scope/groups/group/members-test.js new file mode 100644 index 000000000..026f44d5e --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/groups/group/members-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/groups/group/members', function(hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/groups/group/members'); + 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/host-catalogs-test.js similarity index 53% rename from ui/core/tests/unit/controllers/scopes/scope/projects/new-test.js rename to ui/core/tests/unit/controllers/scopes/scope/host-catalogs-test.js index 8da2a6f6d..0c055095e 100644 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/new-test.js +++ b/ui/core/tests/unit/controllers/scopes/scope/host-catalogs-test.js @@ -1,12 +1,12 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | scopes/scope/projects/new', function (hooks) { +module('Unit | Controller | scopes/scope/host-catalogs', function(hooks) { setupTest(hooks); - // Replace this with your real tests. - test('it exists', function (assert) { - let controller = this.owner.lookup('controller:scopes/scope/projects/new'); + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/host-catalogs'); assert.ok(controller); }); }); diff --git a/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog-test.js b/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog-test.js new file mode 100644 index 000000000..32b03a815 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/host-catalogs/host-catalog', function(hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/host-catalogs/host-catalog'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets-test.js b/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets-test.js new file mode 100644 index 000000000..677b9c125 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/host-catalogs/host-catalog/host-sets', function(hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/host-catalogs/host-catalog/host-sets'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set-test.js b/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set-test.js new file mode 100644 index 000000000..49736df08 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/host-catalogs/host-catalog/host-sets/host-set', function(hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/host-catalogs/host-catalog/host-sets/host-set'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts-test.js b/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts-test.js new file mode 100644 index 000000000..36621e39d --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts', function(hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host-test.js b/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host-test.js new file mode 100644 index 000000000..bebd552c3 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host', function(hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts-test.js b/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts-test.js new file mode 100644 index 000000000..0d3c2be24 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts', function(hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/hosts-test.js b/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/hosts-test.js new file mode 100644 index 000000000..f19f65477 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/hosts-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/host-catalogs/host-catalog/hosts', function(hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/host-catalogs/host-catalog/hosts'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/hosts/host-test.js b/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/hosts/host-test.js new file mode 100644 index 000000000..15bc7b716 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/hosts/host-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/host-catalogs/host-catalog/hosts/host', function(hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/host-catalogs/host-catalog/hosts/host'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/orgs-test.js b/ui/core/tests/unit/controllers/scopes/scope/orgs-test.js deleted file mode 100644 index 2833aba29..000000000 --- a/ui/core/tests/unit/controllers/scopes/scope/orgs-test.js +++ /dev/null @@ -1,12 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Controller | scopes/scope/orgs', function (hooks) { - setupTest(hooks); - - // Replace this with your real tests. - test('it exists', function (assert) { - let controller = this.owner.lookup('controller:scopes/scope/orgs'); - 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 deleted file mode 100644 index ee20af93d..000000000 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/project-test.js +++ /dev/null @@ -1,14 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -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' - ); - assert.ok(controller); - }); -}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs-test.js deleted file mode 100644 index 76cfc0a4d..000000000 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs-test.js +++ /dev/null @@ -1,17 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Controller | scopes/scope/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:scopes/scope/projects/project/host-catalogs' - ); - assert.ok(controller); - }); - } -); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog-test.js deleted file mode 100644 index a7f2eed72..000000000 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog-test.js +++ /dev/null @@ -1,17 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Controller | scopes/scope/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:scopes/scope/projects/project/host-catalogs/host-catalog' - ); - assert.ok(controller); - }); - } -); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets-test.js deleted file mode 100644 index ac959ef1c..000000000 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets-test.js +++ /dev/null @@ -1,17 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Controller | scopes/scope/projects/project/host-catalogs/host-catalog/host-sets', - 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/host-catalogs/host-catalog/host-sets' - ); - assert.ok(controller); - }); - } -); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set-test.js deleted file mode 100644 index 10fc9c009..000000000 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set-test.js +++ /dev/null @@ -1,17 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Controller | scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set', - 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/host-catalogs/host-catalog/host-sets/host-set' - ); - assert.ok(controller); - }); - } -); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new-test.js deleted file mode 100644 index 5781b7eaa..000000000 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new-test.js +++ /dev/null @@ -1,17 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Controller | scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new', - 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/host-catalogs/host-catalog/host-sets/new' - ); - assert.ok(controller); - }); - } -); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/hosts-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/hosts-test.js deleted file mode 100644 index 21d65d16a..000000000 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/hosts-test.js +++ /dev/null @@ -1,17 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Controller | scopes/scope/projects/project/host-catalogs/host-catalog/hosts', - 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/host-catalogs/host-catalog/hosts' - ); - assert.ok(controller); - }); - } -); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host-test.js deleted file mode 100644 index 48b020001..000000000 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host-test.js +++ /dev/null @@ -1,17 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Controller | scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host', - 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/host-catalogs/host-catalog/hosts/host' - ); - assert.ok(controller); - }); - } -); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new-test.js deleted file mode 100644 index 8823785d6..000000000 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new-test.js +++ /dev/null @@ -1,17 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Controller | scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new', - 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/host-catalogs/host-catalog/hosts/new' - ); - assert.ok(controller); - }); - } -); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/new-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/new-test.js deleted file mode 100644 index f6fe63dbd..000000000 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/project/host-catalogs/new-test.js +++ /dev/null @@ -1,17 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Controller | scopes/scope/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:scopes/scope/projects/project/host-catalogs/new' - ); - assert.ok(controller); - }); - } -); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/targets-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project/targets-test.js deleted file mode 100644 index 738a97d05..000000000 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/project/targets-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Controller | scopes/scope/projects/project/targets', 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/targets' - ); - assert.ok(controller); - }); -}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/targets/new-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project/targets/new-test.js deleted file mode 100644 index d4e27841c..000000000 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/project/targets/new-test.js +++ /dev/null @@ -1,17 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Controller | scopes/scope/projects/project/targets/new', - 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/targets/new' - ); - assert.ok(controller); - }); - } -); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/targets/target-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project/targets/target-test.js deleted file mode 100644 index 982aa3005..000000000 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/project/targets/target-test.js +++ /dev/null @@ -1,17 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Controller | scopes/scope/projects/project/targets/target', - 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/targets/target' - ); - assert.ok(controller); - }); - } -); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/targets/target/add-host-sets-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project/targets/target/add-host-sets-test.js deleted file mode 100644 index 2c14ea978..000000000 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/project/targets/target/add-host-sets-test.js +++ /dev/null @@ -1,17 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Controller | scopes/scope/projects/project/targets/target/add-host-sets', - 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/targets/target/add-host-sets' - ); - assert.ok(controller); - }); - } -); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/targets/target/host-sets-test.js b/ui/core/tests/unit/controllers/scopes/scope/projects/project/targets/target/host-sets-test.js deleted file mode 100644 index 4708b25e9..000000000 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/project/targets/target/host-sets-test.js +++ /dev/null @@ -1,17 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Controller | scopes/scope/projects/project/targets/target/host-sets', - 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/targets/target/host-sets' - ); - assert.ok(controller); - }); - } -); diff --git a/ui/core/tests/unit/controllers/scopes/scope/roles/role/grants-test.js b/ui/core/tests/unit/controllers/scopes/scope/roles/role/grants-test.js new file mode 100644 index 000000000..41a7c1fcc --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/roles/role/grants-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/roles/role/grants', function(hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/roles/role/grants'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/roles/role/principals-test.js b/ui/core/tests/unit/controllers/scopes/scope/roles/role/principals-test.js new file mode 100644 index 000000000..7ca6f77b9 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/roles/role/principals-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/roles/role/principals', function(hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/roles/role/principals'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/orgs/new-test.js b/ui/core/tests/unit/controllers/scopes/scope/scopes-test.js similarity index 55% rename from ui/core/tests/unit/controllers/scopes/scope/orgs/new-test.js rename to ui/core/tests/unit/controllers/scopes/scope/scopes-test.js index e11003833..6a6b181de 100644 --- a/ui/core/tests/unit/controllers/scopes/scope/orgs/new-test.js +++ b/ui/core/tests/unit/controllers/scopes/scope/scopes-test.js @@ -1,12 +1,12 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | scopes/scope/orgs/new', function (hooks) { +module('Unit | Controller | scopes/scope/scopes', function(hooks) { setupTest(hooks); - // Replace this with your real tests. - test('it exists', function (assert) { - let controller = this.owner.lookup('controller:scopes/scope/orgs/new'); + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/scopes'); assert.ok(controller); }); }); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects/project/sessions-test.js b/ui/core/tests/unit/controllers/scopes/scope/sessions-test.js similarity index 60% rename from ui/core/tests/unit/controllers/scopes/scope/projects/project/sessions-test.js rename to ui/core/tests/unit/controllers/scopes/scope/sessions-test.js index 8361f91f2..58e72740c 100644 --- a/ui/core/tests/unit/controllers/scopes/scope/projects/project/sessions-test.js +++ b/ui/core/tests/unit/controllers/scopes/scope/sessions-test.js @@ -1,12 +1,12 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | scopes/scope/projects/project/sessions', function(hooks) { +module('Unit | Controller | scopes/scope/sessions', function(hooks) { setupTest(hooks); - // Replace this with your real tests. + // TODO: Replace this with your real tests. test('it exists', function(assert) { - let controller = this.owner.lookup('controller:scopes/scope/projects/project/sessions'); + let controller = this.owner.lookup('controller:scopes/scope/sessions'); assert.ok(controller); }); }); diff --git a/ui/core/tests/unit/controllers/scopes/scope/projects-test.js b/ui/core/tests/unit/controllers/scopes/scope/targets-test.js similarity index 55% rename from ui/core/tests/unit/controllers/scopes/scope/projects-test.js rename to ui/core/tests/unit/controllers/scopes/scope/targets-test.js index 052687cd2..16e710ca3 100644 --- a/ui/core/tests/unit/controllers/scopes/scope/projects-test.js +++ b/ui/core/tests/unit/controllers/scopes/scope/targets-test.js @@ -1,12 +1,12 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Controller | scopes/scope/projects', function (hooks) { +module('Unit | Controller | scopes/scope/targets', function(hooks) { setupTest(hooks); - // Replace this with your real tests. - test('it exists', function (assert) { - let controller = this.owner.lookup('controller:scopes/scope/projects'); + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/targets'); assert.ok(controller); }); }); diff --git a/ui/core/tests/unit/controllers/scopes/scope/targets/target-test.js b/ui/core/tests/unit/controllers/scopes/scope/targets/target-test.js new file mode 100644 index 000000000..d6e49be75 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/targets/target-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/targets/target', function(hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/targets/target'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/targets/target/add-host-sets-test.js b/ui/core/tests/unit/controllers/scopes/scope/targets/target/add-host-sets-test.js new file mode 100644 index 000000000..bef629ad8 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/targets/target/add-host-sets-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/targets/target/add-host-sets', function(hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/targets/target/add-host-sets'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/targets/target/host-sets-test.js b/ui/core/tests/unit/controllers/scopes/scope/targets/target/host-sets-test.js new file mode 100644 index 000000000..d2f2ef7ea --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/targets/target/host-sets-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/targets/target/host-sets', function(hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/targets/target/host-sets'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/controllers/scopes/scope/users/user/accounts-test.js b/ui/core/tests/unit/controllers/scopes/scope/users/user/accounts-test.js new file mode 100644 index 000000000..5bbf27235 --- /dev/null +++ b/ui/core/tests/unit/controllers/scopes/scope/users/user/accounts-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Controller | scopes/scope/users/user/accounts', function(hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let controller = this.owner.lookup('controller:scopes/scope/users/user/accounts'); + assert.ok(controller); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/edit-test.js b/ui/core/tests/unit/routes/scopes/scope/edit-test.js new file mode 100644 index 000000000..0b4334ea0 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/edit-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/edit', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/edit'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/host-catalogs-test.js b/ui/core/tests/unit/routes/scopes/scope/host-catalogs-test.js new file mode 100644 index 000000000..391eaa2c5 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/host-catalogs-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/host-catalogs', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/host-catalogs'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog-test.js b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog-test.js new file mode 100644 index 000000000..cefbf9457 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/host-catalogs/host-catalog', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/host-catalogs/host-catalog'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets-test.js b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets-test.js new file mode 100644 index 000000000..8178e1810 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/host-catalogs/host-catalog/host-sets', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/host-catalogs/host-catalog/host-sets'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set-test.js b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set-test.js new file mode 100644 index 000000000..56f46755c --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/host-catalogs/host-catalog/host-sets/host-set', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/host-catalogs/host-catalog/host-sets/host-set'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts-test.js b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts-test.js new file mode 100644 index 000000000..cfcfcffdb --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host-test.js b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host-test.js new file mode 100644 index 000000000..9c8d8b120 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts-test.js b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts-test.js new file mode 100644 index 000000000..728788fe7 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/index-test.js b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/index-test.js new file mode 100644 index 000000000..f2c55644a --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/host-catalogs/host-catalog/host-sets/host-set/index', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/host-catalogs/host-catalog/host-sets/host-set/index'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/index-test.js b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/index-test.js new file mode 100644 index 000000000..c158018f5 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/host-catalogs/host-catalog/host-sets/index', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/host-catalogs/host-catalog/host-sets/index'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/new-test.js b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/new-test.js new file mode 100644 index 000000000..3216994c2 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/host-sets/new-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/host-catalogs/host-catalog/host-sets/new', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/host-catalogs/host-catalog/host-sets/new'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/hosts-test.js b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/hosts-test.js new file mode 100644 index 000000000..7c2891d51 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/hosts-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/host-catalogs/host-catalog/hosts', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/host-catalogs/host-catalog/hosts'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/hosts/host-test.js b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/hosts/host-test.js new file mode 100644 index 000000000..d40fb98a9 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/hosts/host-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/host-catalogs/host-catalog/hosts/host', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/host-catalogs/host-catalog/hosts/host'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/hosts/host/index-test.js b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/hosts/host/index-test.js new file mode 100644 index 000000000..1f6b2379b --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/hosts/host/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/host-catalogs/host-catalog/hosts/host/index', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/host-catalogs/host-catalog/hosts/host/index'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/hosts/index-test.js b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/hosts/index-test.js new file mode 100644 index 000000000..5bccae028 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/hosts/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/host-catalogs/host-catalog/hosts/index', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/host-catalogs/host-catalog/hosts/index'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/hosts/new-test.js b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/hosts/new-test.js new file mode 100644 index 000000000..e7d31cca4 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/hosts/new-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/host-catalogs/host-catalog/hosts/new', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/host-catalogs/host-catalog/hosts/new'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/index-test.js b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/index-test.js new file mode 100644 index 000000000..6bd3f5df2 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/host-catalog/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/host-catalogs/host-catalog/index', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/host-catalogs/host-catalog/index'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/host-catalogs/index-test.js b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/index-test.js new file mode 100644 index 000000000..a64c67754 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/host-catalogs/index', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/host-catalogs/index'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/host-catalogs/new-test.js b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/new-test.js new file mode 100644 index 000000000..c2d2397d3 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/host-catalogs/new-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/host-catalogs/new', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/host-catalogs/new'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/new-test.js b/ui/core/tests/unit/routes/scopes/scope/new-test.js new file mode 100644 index 000000000..76ed6531b --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/new-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/new', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/new'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/orgs-test.js b/ui/core/tests/unit/routes/scopes/scope/orgs-test.js deleted file mode 100644 index 860f214b3..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/orgs-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Route | scopes/scope/orgs', function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup('route:scopes/scope/orgs'); - assert.ok(route); - }); -}); diff --git a/ui/core/tests/unit/routes/scopes/scope/orgs/index-test.js b/ui/core/tests/unit/routes/scopes/scope/orgs/index-test.js deleted file mode 100644 index 9dde8b948..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/orgs/index-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Route | scopes/scope/orgs/index', function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup('route:scopes/scope/orgs/index'); - assert.ok(route); - }); -}); diff --git a/ui/core/tests/unit/routes/scopes/scope/orgs/new-test.js b/ui/core/tests/unit/routes/scopes/scope/orgs/new-test.js deleted file mode 100644 index 15aa7691f..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/orgs/new-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Route | scopes/scope/orgs/new', function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup('route:scopes/scope/orgs/new'); - 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 deleted file mode 100644 index 127213dac..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Route | scopes/scope/projects', function (hooks) { - setupTest(hooks); - - 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 deleted file mode 100644 index 74a15f224..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/index-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Route | scopes/scope/projects/index', function (hooks) { - setupTest(hooks); - - 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 deleted file mode 100644 index 8c28e87b5..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/new-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Route | scopes/scope/projects/new', function (hooks) { - setupTest(hooks); - - 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 deleted file mode 100644 index ed0ffe51a..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Route | scopes/scope/projects/project', function (hooks) { - setupTest(hooks); - - 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/host-catalogs-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs-test.js deleted file mode 100644 index 30ac55d7a..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs-test.js +++ /dev/null @@ -1,15 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Route | scopes/scope/projects/project/host-catalogs', function ( - hooks -) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/host-catalogs' - ); - assert.ok(route); - }); -}); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog-test.js deleted file mode 100644 index 4855fd74a..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/host-catalogs/host-catalog' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets-test.js deleted file mode 100644 index f57da0c59..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/host-sets', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/host-catalogs/host-catalog/host-sets' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set-test.js deleted file mode 100644 index 6b6057ddf..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/add-hosts-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/add-hosts-test.js deleted file mode 100644 index b93eea3c7..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/add-hosts-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/add-hosts', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/add-hosts' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host-test.js deleted file mode 100644 index ad9e0c61e..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host', function(hooks) { - setupTest(hooks); - - test('it exists', function(assert) { - let route = this.owner.lookup('route:scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/create-host'); - assert.ok(route); - }); -}); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/hosts-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/hosts-test.js deleted file mode 100644 index c527a620f..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/hosts-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/hosts', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/hosts' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/index-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/index-test.js deleted file mode 100644 index 3454fcc25..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/index-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/index', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/index' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/index-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/index-test.js deleted file mode 100644 index 781e1b605..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/index-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/index', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/index' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new-test.js deleted file mode 100644 index 74cda4552..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/new' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts-test.js deleted file mode 100644 index 24a7ab5e9..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/hosts', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/host-catalogs/host-catalog/hosts' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host-test.js deleted file mode 100644 index 4c1510f8b..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/index-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/index-test.js deleted file mode 100644 index cb7589b5a..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/index-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/index', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/host-catalogs/host-catalog/hosts/host/index' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/index-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/index-test.js deleted file mode 100644 index 4250615d8..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/index-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/hosts/index', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/host-catalogs/host-catalog/hosts/index' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new-test.js deleted file mode 100644 index c4f727b6e..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/host-catalogs/host-catalog/hosts/new' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/index-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/index-test.js deleted file mode 100644 index e440523af..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/host-catalog/index-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/host-catalogs/host-catalog/index', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/host-catalogs/host-catalog/index' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/index-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/index-test.js deleted file mode 100644 index aa6495519..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/index-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/host-catalogs/index', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/host-catalogs/index' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/new-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/new-test.js deleted file mode 100644 index 60ca74f13..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/host-catalogs/new-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/host-catalogs/new', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/host-catalogs/new' - ); - 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 deleted file mode 100644 index f14370229..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/index-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Route | scopes/scope/projects/project/index', function (hooks) { - setupTest(hooks); - - 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/projects/project/sessions/index-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/sessions/index-test.js deleted file mode 100644 index a774bf223..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/sessions/index-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Route | scopes/scope/projects/project/sessions/index', function(hooks) { - setupTest(hooks); - - test('it exists', function(assert) { - let route = this.owner.lookup('route:scopes/scope/projects/project/sessions/index'); - assert.ok(route); - }); -}); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/targets-test.js deleted file mode 100644 index 24a8476c4..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets-test.js +++ /dev/null @@ -1,15 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Route | scopes/scope/projects/project/targets', function ( - hooks -) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/targets' - ); - assert.ok(route); - }); -}); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/index-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/index-test.js deleted file mode 100644 index 7d77e93a0..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/index-test.js +++ /dev/null @@ -1,15 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Route | scopes/scope/projects/project/targets/index', function ( - hooks -) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/targets/index' - ); - assert.ok(route); - }); -}); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/new-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/new-test.js deleted file mode 100644 index a4b79d78c..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/new-test.js +++ /dev/null @@ -1,15 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Route | scopes/scope/projects/project/targets/new', function ( - hooks -) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/targets/new' - ); - assert.ok(route); - }); -}); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target-test.js deleted file mode 100644 index 22acb8b9e..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target-test.js +++ /dev/null @@ -1,15 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Route | scopes/scope/projects/project/targets/target', function ( - hooks -) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/targets/target' - ); - assert.ok(route); - }); -}); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target/add-host-sets-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target/add-host-sets-test.js deleted file mode 100644 index 3238718e1..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target/add-host-sets-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/targets/target/add-host-sets', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/targets/target/add-host-sets' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target/host-sets-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target/host-sets-test.js deleted file mode 100644 index 063b787d5..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target/host-sets-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/targets/target/host-sets', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/targets/target/host-sets' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target/host-sets/host-set-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target/host-sets/host-set-test.js deleted file mode 100644 index afc25f627..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target/host-sets/host-set-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/targets/target/host-sets/host-set', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/targets/target/host-sets/host-set' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target/index-test.js b/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target/index-test.js deleted file mode 100644 index ec0c8507b..000000000 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/targets/target/index-test.js +++ /dev/null @@ -1,16 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module( - 'Unit | Route | scopes/scope/projects/project/targets/target/index', - function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup( - 'route:scopes/scope/projects/project/targets/target/index' - ); - assert.ok(route); - }); - } -); diff --git a/ui/core/tests/unit/routes/scopes/scope/scopes-test.js b/ui/core/tests/unit/routes/scopes/scope/scopes-test.js new file mode 100644 index 000000000..7cb21ef85 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/scopes-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/scopes', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/scopes'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/scopes/index-test.js b/ui/core/tests/unit/routes/scopes/scope/scopes/index-test.js new file mode 100644 index 000000000..ca7e3fb91 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/scopes/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/scopes/index', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/scopes/index'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/projects/project/sessions-test.js b/ui/core/tests/unit/routes/scopes/scope/sessions-test.js similarity index 51% rename from ui/core/tests/unit/routes/scopes/scope/projects/project/sessions-test.js rename to ui/core/tests/unit/routes/scopes/scope/sessions-test.js index 70769438e..078865278 100644 --- a/ui/core/tests/unit/routes/scopes/scope/projects/project/sessions-test.js +++ b/ui/core/tests/unit/routes/scopes/scope/sessions-test.js @@ -1,11 +1,11 @@ import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; -module('Unit | Route | scopes/scope/projects/project/sessions', function(hooks) { +module('Unit | Route | scopes/scope/sessions', function(hooks) { setupTest(hooks); test('it exists', function(assert) { - let route = this.owner.lookup('route:scopes/scope/projects/project/sessions'); + let route = this.owner.lookup('route:scopes/scope/sessions'); assert.ok(route); }); }); diff --git a/ui/core/tests/unit/routes/scopes/scope/sessions/index-test.js b/ui/core/tests/unit/routes/scopes/scope/sessions/index-test.js new file mode 100644 index 000000000..3d18fa306 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/sessions/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/sessions/index', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/sessions/index'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/targets-test.js b/ui/core/tests/unit/routes/scopes/scope/targets-test.js new file mode 100644 index 000000000..45d66036b --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/targets-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/targets', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/targets'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/targets/index-test.js b/ui/core/tests/unit/routes/scopes/scope/targets/index-test.js new file mode 100644 index 000000000..fea08576c --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/targets/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/targets/index', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/targets/index'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/targets/new-test.js b/ui/core/tests/unit/routes/scopes/scope/targets/new-test.js new file mode 100644 index 000000000..1c1402d57 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/targets/new-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/targets/new', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/targets/new'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/targets/target-test.js b/ui/core/tests/unit/routes/scopes/scope/targets/target-test.js new file mode 100644 index 000000000..d2cb9f9fa --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/targets/target-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/targets/target', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/targets/target'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/targets/target/add-host-sets-test.js b/ui/core/tests/unit/routes/scopes/scope/targets/target/add-host-sets-test.js new file mode 100644 index 000000000..c07db35c9 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/targets/target/add-host-sets-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/targets/target/add-host-sets', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/targets/target/add-host-sets'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/targets/target/host-sets-test.js b/ui/core/tests/unit/routes/scopes/scope/targets/target/host-sets-test.js new file mode 100644 index 000000000..1309e5b03 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/targets/target/host-sets-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/targets/target/host-sets', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/targets/target/host-sets'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/targets/target/index-test.js b/ui/core/tests/unit/routes/scopes/scope/targets/target/index-test.js new file mode 100644 index 000000000..6f4f3b248 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/targets/target/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/targets/target/index', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/targets/target/index'); + assert.ok(route); + }); +}); diff --git a/ui/core/tests/unit/services/scope-test.js b/ui/core/tests/unit/services/scope-test.js new file mode 100644 index 000000000..95493c0b4 --- /dev/null +++ b/ui/core/tests/unit/services/scope-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Service | scope', function(hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function(assert) { + let service = this.owner.lookup('service:scope'); + assert.ok(service); + }); +}); diff --git a/ui/core/translations/en-us.yaml b/ui/core/translations/en-us.yaml index 22fd19edb..d208e7102 100644 --- a/ui/core/translations/en-us.yaml +++ b/ui/core/translations/en-us.yaml @@ -6,6 +6,7 @@ auth: choose-org: Choose a scope to authenticate. authenticating-with-org: "You are authenticating with {name}." titles: + home: Home iam: IAM new: New resources: Resources diff --git a/ui/core/translations/resources/en-us.yaml b/ui/core/translations/resources/en-us.yaml index a19916d43..e24600300 100644 --- a/ui/core/translations/resources/en-us.yaml +++ b/ui/core/translations/resources/en-us.yaml @@ -67,7 +67,7 @@ host-set: add: Add Host Set create: New Host Set delete: Delete Host Set - create-host: Create and Add Host + create-and-add-host: Create and Add Host add-hosts: Add Existing Host messages: welcome: @@ -116,6 +116,8 @@ org: messages: welcome: title: Welcome to Orgs + settings: + title: Org Settings project: title: Project title_plural: Projects @@ -123,6 +125,8 @@ project: messages: welcome: title: Welcome to Projects + settings: + title: Project Settings actions: delete: Delete Project user: