vault/ui/lib/replication/addon/routes/mode/secondaries/config-show.js
Matthew Irish 6d273dc368
UI ember engines (#6718)
Adds replication engine and core in-repo addon
2019-05-13 14:05:25 -05:00

33 lines
909 B
JavaScript

import { hash, resolve } from 'rsvp';
import Base from '../../replication-base';
export default Base.extend({
modelPath: 'model.config',
model(params) {
const id = params.secondary_id;
return hash({
cluster: this.modelFor('application'),
config: this.store.findRecord('mount-filter-config', id).catch(e => {
if (e.httpStatus === 404) {
// return an empty obj to let them nav to create
return resolve({ id });
} else {
throw e;
}
}),
});
},
redirect(model) {
const cluster = model.cluster;
const replicationMode = this.paramsFor('mode').replication_mode;
if (
!this.get('version.hasPerfReplication') ||
replicationMode !== 'performance' ||
!cluster.get(`${replicationMode}.isPrimary`)
) {
return this.transitionTo('mode', cluster.get('name'), replicationMode);
}
},
});