open-vault/ui/app/routes/vault/cluster/replication.js
madalynrose 554446ae4e
Licensing in the UI (#5437)
Add licensing to the UI
2018-10-12 15:03:01 -04:00

39 lines
1 KiB
JavaScript

import { inject as service } from '@ember/service';
import { setProperties } from '@ember/object';
import { hash } from 'rsvp';
import Route from '@ember/routing/route';
import ClusterRoute from 'vault/mixins/cluster-route';
export default Route.extend(ClusterRoute, {
version: service(),
beforeModel() {
return this.get('version')
.fetchFeatures()
.then(() => {
return this._super(...arguments);
});
},
model() {
return this.modelFor('vault.cluster');
},
afterModel(model) {
return 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 }) => {
setProperties(model, {
canEnablePrimary,
canEnableSecondary,
});
return model;
});
},
});