2018-09-25 16:28:26 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import { setProperties } from '@ember/object';
|
|
|
|
import { hash } from 'rsvp';
|
|
|
|
import Route from '@ember/routing/route';
|
2018-04-03 14:16:57 +00:00
|
|
|
import ClusterRoute from 'vault/mixins/cluster-route';
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
export default Route.extend(ClusterRoute, {
|
|
|
|
version: service(),
|
2019-05-13 19:05:25 +00:00
|
|
|
store: 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() {
|
2019-05-13 19:05:25 +00:00
|
|
|
return this.store.findRecord('cluster', 'vault');
|
2018-04-03 14:16:57 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
afterModel(model) {
|
2018-09-25 16:28:26 +00:00
|
|
|
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,
|
2018-04-03 14:16:57 +00:00
|
|
|
});
|
2018-09-25 16:28:26 +00:00
|
|
|
return model;
|
|
|
|
});
|
2018-04-03 14:16:57 +00:00
|
|
|
},
|
2019-05-13 19:05:25 +00:00
|
|
|
actions: {
|
|
|
|
refresh() {
|
|
|
|
this.refresh();
|
|
|
|
},
|
|
|
|
},
|
2018-04-03 14:16:57 +00:00
|
|
|
});
|