open-vault/ui/app/routes/vault/cluster/access/identity/index.js
2018-04-03 09:16:57 -05:00

39 lines
952 B
JavaScript

import Ember from 'ember';
import ListRoute from 'vault/mixins/list-route';
export default Ember.Route.extend(ListRoute, {
model(params) {
let itemType = this.modelFor('vault.cluster.access.identity');
let modelType = `identity/${itemType}`;
return this.store
.lazyPaginatedQuery(modelType, {
responsePath: 'data.keys',
page: params.page,
pageFilter: params.pageFilter,
size: 100,
})
.catch(err => {
if (err.httpStatus === 404) {
return [];
} else {
throw err;
}
});
},
setupController(controller) {
this._super(...arguments);
controller.set('identityType', this.modelFor('vault.cluster.access.identity'));
},
actions: {
willTransition(transition) {
window.scrollTo(0, 0);
if (transition.targetName !== this.routeName) {
this.store.clearAllDatasets();
}
return true;
},
},
});