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

28 lines
814 B
JavaScript

import Ember from 'ember';
import Base from '../../replication-base';
export default Base.extend({
modelPath: 'model.config',
model(params) {
return Ember.RSVP.hash({
cluster: this.modelFor('vault.cluster.replication.mode.secondaries'),
config: this.store.findRecord('mount-filter-config', params.secondary_id),
mounts: this.fetchMounts(),
});
},
redirect(model) {
const cluster = model.cluster;
const replicationMode = this.get('replicationMode');
if (
!this.get('version.hasPerfReplication') ||
replicationMode !== 'performance' ||
!cluster.get(`${replicationMode}.isPrimary`) ||
!cluster.get('canAddSecondary')
) {
return this.transitionTo('vault.cluster.replication.mode', cluster.get('name'), replicationMode);
}
},
});