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

24 lines
562 B
JavaScript

import Ember from 'ember';
import ClusterRoute from 'vault/mixins/cluster-route';
const ALLOWED_TYPES = ['acl', 'egp', 'rgp'];
const { inject } = Ember;
export default Ember.Route.extend(ClusterRoute, {
version: inject.service(),
beforeModel() {
return this.get('version').fetchFeatures().then(() => {
return this._super(...arguments);
});
},
model(params) {
let policyType = params.type;
if (!ALLOWED_TYPES.includes(policyType)) {
return this.transitionTo(this.routeName, ALLOWED_TYPES[0]);
}
return {};
},
});