2018-09-25 16:28:26 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import Route from '@ember/routing/route';
|
2018-04-03 14:16:57 +00:00
|
|
|
import ClusterRoute from 'vault/mixins/cluster-route';
|
|
|
|
|
|
|
|
const ALLOWED_TYPES = ['acl', 'egp', 'rgp'];
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
export default Route.extend(ClusterRoute, {
|
|
|
|
version: service(),
|
2018-04-03 14:16:57 +00:00
|
|
|
|
|
|
|
beforeModel() {
|
2018-10-12 19:03:01 +00:00
|
|
|
return this.get('version')
|
|
|
|
.fetchFeatures()
|
|
|
|
.then(() => {
|
|
|
|
return this._super(...arguments);
|
|
|
|
});
|
2018-04-03 14:16:57 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
model(params) {
|
|
|
|
let policyType = params.type;
|
|
|
|
if (!ALLOWED_TYPES.includes(policyType)) {
|
|
|
|
return this.transitionTo(this.routeName, ALLOWED_TYPES[0]);
|
|
|
|
}
|
|
|
|
return {};
|
|
|
|
},
|
|
|
|
});
|