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

28 lines
765 B
JavaScript

import Ember from 'ember';
import Base from '../../replication-base';
export default Base.extend({
model() {
return Ember.RSVP.hash({
cluster: this.modelFor('vault.cluster.replication.mode.secondaries'),
mounts: this.fetchMounts(),
});
},
redirect(model) {
const replicationMode = this.get('replicationMode');
if (!model.cluster.get(`${replicationMode}.isPrimary`) || !model.cluster.get('canAddSecondary')) {
return this.transitionTo('vault.cluster.replication.mode', model.cluster.get('name'), replicationMode);
}
},
setupController(controller, model) {
controller.set('model', model.cluster);
controller.set('mounts', model.mounts);
},
resetController(controller) {
controller.reset();
},
});