open-vault/ui/app/routes/vault/cluster/access/identity/index.js
Matthew Irish d509588cd2
Ember update (#5386)
Ember update - update ember-cli, ember-data, and ember to 3.4 series
2018-09-25 11:28:26 -05:00

43 lines
1 KiB
JavaScript

import Route from '@ember/routing/route';
import ListRoute from 'vault/mixins/list-route';
export default 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;
},
reload() {
this.store.clearAllDatasets();
this.refresh();
},
},
});