Files
threshold-ui/ui/admin/app/routes/scopes/scope/auth-methods/auth-method/managed-groups.js
T
Carlos Alcaide Corvo b7bf44b997 feat: 🎸 Add managed groups read CRUD
Add managed groups Read CRUD operation
2021-11-10 07:47:51 -08:00

29 lines
776 B
JavaScript

import Route from '@ember/routing/route';
import { action } from '@ember/object';
export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsRoute extends Route {
/**
*
* @returns {Promise{[ManagedGroupsModel]}}
*/
model() {
const authMethod = this.modelFor('scopes.scope.auth-methods.auth-method');
const { id: auth_method_id } = authMethod;
return this.store.query('managed-group', { auth_method_id });
}
// =actions
/**
* Rollback changes on a managed group.
* @param {ManagedGroupModel} managedGroup
*/
@action
cancel(managedGroup) {
const { isNew } = managedGroup;
managedGroup.rollbackAttributes();
if (isNew) {
this.transitionTo('scopes.scope.auth-methods.auth-method.managed-groups');
}
}
}