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

37 lines
963 B
JavaScript

import Ember from 'ember';
import ClusterRoute from 'vault/mixins/cluster-route';
const { inject } = Ember;
export default Ember.Route.extend(ClusterRoute, {
version: inject.service(),
beforeModel() {
return this.get('version').fetchFeatures().then(() => {
return this._super(...arguments);
});
},
model() {
return this.modelFor('vault.cluster');
},
afterModel(model) {
return Ember.RSVP
.hash({
canEnablePrimary: this.store
.findRecord('capabilities', 'sys/replication/primary/enable')
.then(c => c.get('canUpdate')),
canEnableSecondary: this.store
.findRecord('capabilities', 'sys/replication/secondary/enable')
.then(c => c.get('canUpdate')),
})
.then(({ canEnablePrimary, canEnableSecondary }) => {
Ember.setProperties(model, {
canEnablePrimary,
canEnableSecondary,
});
return model;
});
},
});