open-vault/ui/app/routes/vault/cluster/policies.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

24 lines
590 B
JavaScript

import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
import ClusterRoute from 'vault/mixins/cluster-route';
const ALLOWED_TYPES = ['acl', 'egp', 'rgp'];
export default Route.extend(ClusterRoute, {
version: 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 {};
},
});