mirror of
https://github.com/status-im/consul.git
synced 2025-02-12 13:46:46 +00:00
3ae91e064c
Adds a 'status' for the filtering/searching in the UI, without this its not super clear that you are filtering a recordset due to the menu selections being hidden once closed. You can also use the pills in this status view to delete individual filters.
46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
import { inject as service } from '@ember/service';
|
|
import Route from 'consul-ui/routing/route';
|
|
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 = {
|
|
sortBy: 'sort',
|
|
kind: 'kind',
|
|
search: {
|
|
as: 'filter',
|
|
replace: true,
|
|
},
|
|
};
|
|
|
|
async beforeModel(transition) {
|
|
const token = await this.settings.findBySlug('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');
|
|
}
|
|
}
|
|
|
|
async model(params) {
|
|
const _items = this.repo.findAllByDatacenter(this.modelFor('dc').dc.Name);
|
|
const _token = this.settings.findBySlug('token');
|
|
return {
|
|
items: await _items,
|
|
token: await _token,
|
|
};
|
|
}
|
|
|
|
setupController(controller, model) {
|
|
super.setupController(...arguments);
|
|
controller.setProperties(model);
|
|
}
|
|
}
|