diff --git a/ui/core/app/routes/scopes/scope/groups.js b/ui/core/app/routes/scopes/scope/groups.js index 94441ca1e..ea24aa58e 100644 --- a/ui/core/app/routes/scopes/scope/groups.js +++ b/ui/core/app/routes/scopes/scope/groups.js @@ -15,7 +15,8 @@ export default class ScopesScopeGroupsRoute extends Route { * @return {Promise[GroupModel]} */ async model() { - return this.store.findAll('group', this.scopeAdapterOptions()); + const { id: scopeID } = this.modelFor('scopes.scope'); + return this.store.findAll('group', { adapterOptions: { scopeID } }); } // =actions @@ -57,7 +58,7 @@ export default class ScopesScopeGroupsRoute extends Route { @action async delete(group) { try { - await group.destroyRecord(this.scopeAdapterOptions()); + await group.destroyRecord(); this.refresh(); this.notify.success(this.intl.t('notify.delete-success')); this.transitionTo('scopes.scope.groups'); @@ -66,9 +67,4 @@ export default class ScopesScopeGroupsRoute extends Route { this.notify.error(error.message, { closeAfter: null }); } } - - scopeAdapterOptions() { - const { id: scopeID } = this.modelFor('scopes.scope'); - return { adapterOptions: { scopeID } }; - } } diff --git a/ui/core/app/routes/scopes/scope/groups/new.js b/ui/core/app/routes/scopes/scope/groups/new.js index 3326dc7e4..fe281afb2 100644 --- a/ui/core/app/routes/scopes/scope/groups/new.js +++ b/ui/core/app/routes/scopes/scope/groups/new.js @@ -8,7 +8,7 @@ export default class ScopesScopeGroupsNewRoute extends Route { * @return {GroupModel} */ model() { - const { id: scopeID } = this.modelFor('scopes.scope'); - return this.store.createRecord('group', { scopeID }); + const scopeModel = this.modelFor('scopes.scope'); + return this.store.createRecord('group', { type: 'group', scopeModel }); } } diff --git a/ui/core/app/routes/scopes/scope/roles.js b/ui/core/app/routes/scopes/scope/roles.js index a4d9d2c5b..f5e27a9f5 100644 --- a/ui/core/app/routes/scopes/scope/roles.js +++ b/ui/core/app/routes/scopes/scope/roles.js @@ -15,7 +15,8 @@ export default class ScopesScopeRolesRoute extends Route { * @return {Promise{[RoleModel]}} */ async model() { - return this.store.findAll('role', this.scopeAdapterOptions()); + const { id: scopeID } = this.modelFor('scopes.scope'); + return this.store.findAll('role', { adapterOptions: { scopeID } }); } // =actions @@ -57,7 +58,7 @@ export default class ScopesScopeRolesRoute extends Route { @action async delete(role) { try { - await role.destroyRecord(this.scopeAdapterOptions()); + await role.destroyRecord(); this.refresh(); this.notify.success(this.intl.t('notify.delete-success')); this.transitionTo('scopes.scope.roles'); @@ -66,9 +67,4 @@ export default class ScopesScopeRolesRoute extends Route { this.notify.error(error.message, { closeAfter: null }); } } - - scopeAdapterOptions() { - const { id: scopeID } = this.modelFor('scopes.scope'); - return { adapterOptions: { scopeID } }; - } } diff --git a/ui/core/app/routes/scopes/scope/roles/new.js b/ui/core/app/routes/scopes/scope/roles/new.js index edc239e21..bcde1bb0f 100644 --- a/ui/core/app/routes/scopes/scope/roles/new.js +++ b/ui/core/app/routes/scopes/scope/roles/new.js @@ -8,7 +8,7 @@ export default class ScopesScopeRolesNewRoute extends Route { * @return {RoleModel} */ model() { - const { id: scopeID } = this.modelFor('scopes.scope'); - return this.store.createRecord('role', { scopeID }); + const scopeModel = this.modelFor('scopes.scope'); + return this.store.createRecord('role', { type: 'role', scopeModel }); } } diff --git a/ui/core/app/routes/scopes/scope/users.js b/ui/core/app/routes/scopes/scope/users.js index 8beb4f146..6519086fd 100644 --- a/ui/core/app/routes/scopes/scope/users.js +++ b/ui/core/app/routes/scopes/scope/users.js @@ -15,7 +15,8 @@ export default class ScopesScopeUsersRoute extends Route { * @return {Promise{[UserModel]}} */ async model() { - return this.store.findAll('user', this.scopeAdapterOptions()); + const { id: scopeID } = this.modelFor('scopes.scope'); + return this.store.findAll('user', { adapterOptions: { scopeID } }); } // =actions @@ -58,7 +59,7 @@ export default class ScopesScopeUsersRoute extends Route { @action async delete(user) { try { - await user.destroyRecord(this.scopeAdapterOptions()); + await user.destroyRecord(); this.refresh(); this.notify.success(this.intl.t('notify.delete-success')); this.transitionTo('scopes.scope.users'); @@ -67,9 +68,4 @@ export default class ScopesScopeUsersRoute extends Route { this.notify.error(error.message, { closeAfter: null }); } } - - scopeAdapterOptions() { - const { id: scopeID } = this.modelFor('scopes.scope'); - return { adapterOptions: { scopeID } }; - } } diff --git a/ui/core/app/routes/scopes/scope/users/new.js b/ui/core/app/routes/scopes/scope/users/new.js index 25c4a0b52..89cca81d9 100644 --- a/ui/core/app/routes/scopes/scope/users/new.js +++ b/ui/core/app/routes/scopes/scope/users/new.js @@ -8,7 +8,7 @@ export default class ScopesScopeUsersNewRoute extends Route { * @return {UserModel} */ model() { - const { id: scopeID } = this.modelFor('scopes.scope'); - return this.store.createRecord('user', { scopeID }); + const scopeModel = this.modelFor('scopes.scope'); + return this.store.createRecord('user', { type: 'user', scopeModel }); } }