mirror of
https://github.com/status-im/consul.git
synced 2025-01-25 21:19:12 +00:00
5c0ec13fb9
* ui: Apply native class codemod to all services * ui: Apply native class codemod to routes * ui: Apply native class codemod to controllers * Fix up ember proxy `content` issue * Add a CreateTime on policy creation * Minor formatting * Convert child based saving to use ec instead of custom approach * Remove custom event source repo wrapping initializer * Repos here are no longer proxy objects revert to using them normally * Remove areas of code that were used to set up source backed repos
47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
import { inject as service } from '@ember/service';
|
|
import Route from 'consul-ui/routing/route';
|
|
import { hash } from 'rsvp';
|
|
import { get } from '@ember/object';
|
|
|
|
import WithAclActions from 'consul-ui/mixins/acl/with-actions';
|
|
|
|
export default class IndexRoute extends Route.extend(WithAclActions) {
|
|
@service('repository/acl')
|
|
repo;
|
|
|
|
@service('settings')
|
|
settings;
|
|
|
|
queryParams = {
|
|
search: {
|
|
as: 'filter',
|
|
replace: true,
|
|
},
|
|
};
|
|
|
|
beforeModel(transition) {
|
|
return this.settings.findBySlug('token').then(token => {
|
|
// If you don't have a token set or you have a
|
|
// token set with AccessorID set to not null (new ACL mode)
|
|
// then rewrite to the new acls
|
|
if (!token || get(token, 'AccessorID') !== null) {
|
|
// If you return here, you get a TransitionAborted error in the tests only
|
|
// everything works fine either way checking things manually
|
|
this.replaceWith('dc.acls.tokens');
|
|
}
|
|
});
|
|
}
|
|
|
|
model(params) {
|
|
return hash({
|
|
items: this.repo.findAllByDatacenter(this.modelFor('dc').dc.Name),
|
|
token: this.settings.findBySlug('token'),
|
|
});
|
|
}
|
|
|
|
setupController(controller, model) {
|
|
super.setupController(...arguments);
|
|
controller.setProperties(model);
|
|
}
|
|
}
|