diff --git a/addon/components/acl-wizzard.hbs b/addon/components/acl-wizzard.hbs index ba496b8b..f84ab46d 100644 --- a/addon/components/acl-wizzard.hbs +++ b/addon/components/acl-wizzard.hbs @@ -1,7 +1,7 @@ {{#if this.modelToSelect}}
- + {{#each (get this.fields this.modelToSelect) as |field|}} @@ -37,7 +37,7 @@ @selected={{this.user}} @header={{this.user.username}} @model="user" - @selectEntry={{set this.modelToSelect "user"}} + @selectEntry={{fn this.openModel "user"}} data-test-select-user >
@@ -61,7 +61,7 @@ @@ -78,7 +78,7 @@ {{/unless}} diff --git a/addon/components/acl-wizzard.js b/addon/components/acl-wizzard.js index ccb1c2a7..5c076984 100644 --- a/addon/components/acl-wizzard.js +++ b/addon/components/acl-wizzard.js @@ -2,6 +2,10 @@ import { action } from "@ember/object"; import Component from "@glimmer/component"; import { tracked } from "@glimmer/tracking"; +const DEFAULT_SORT = { + scope: "full_name", +}; + export default class AclWizzardComponent extends Component { @tracked modelToSelect; @tracked user; @@ -31,4 +35,10 @@ export default class AclWizzardComponent extends Component { this[this.modelToSelect] = model; this.modelToSelect = null; } + + @action + openModel(model) { + this.modelToSelect = model; + this.sort = DEFAULT_SORT[model]; + } } diff --git a/addon/routes/scopes.js b/addon/routes/scopes.js index f352522c..680c51dd 100644 --- a/addon/routes/scopes.js +++ b/addon/routes/scopes.js @@ -8,7 +8,7 @@ export default class ScopesRoute extends Route { model() { // this eager fetching is necessary, since we need a store-independent result set // for use-cases where we have other non-relevant scopes in store - return this.store.query("scope", {}); + return this.store.query("scope", { sort: "full_name" }); } redirect(scopes, transition) {