open-vault/ui/app/routes/vault/cluster/policy.js
Matthew Irish 3a734d7cb4
UI - first RC feedback (#4278)
* add hasSentinel to the version service
* use hasSentinel instead of features directly
* type='button' strikes again
* pass url param in tab links to ensure hrefs are updated
* 404 when the item_type is invalid for the identity route
2018-04-05 16:08:18 -05:00

25 lines
714 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('vault.cluster.policies', ALLOWED_TYPES[0]);
}
if (!this.get('version.hasSentinel') && policyType !== 'acl') {
return this.transitionTo('vault.cluster.policies', policyType);
}
return {};
},
});