github.com/outbrain/consul@v1.4.5/ui-v2/app/routes/dc/acls/create.js (about) 1 import Route from '@ember/routing/route'; 2 import { inject as service } from '@ember/service'; 3 import { hash } from 'rsvp'; 4 import { get, set } from '@ember/object'; 5 6 import WithAclActions from 'consul-ui/mixins/acl/with-actions'; 7 8 export default Route.extend(WithAclActions, { 9 templateName: 'dc/acls/edit', 10 repo: service('repository/acl'), 11 beforeModel: function() { 12 get(this, 'repo').invalidate(); 13 }, 14 model: function(params) { 15 this.item = get(this, 'repo').create(); 16 set(this.item, 'Datacenter', this.modelFor('dc').dc.Name); 17 return hash({ 18 create: true, 19 isLoading: false, 20 item: this.item, 21 types: ['management', 'client'], 22 }); 23 }, 24 setupController: function(controller, model) { 25 this._super(...arguments); 26 controller.setProperties(model); 27 }, 28 deactivate: function() { 29 if (get(this.item, 'isNew')) { 30 this.item.destroyRecord(); 31 } 32 }, 33 });