2018-09-25 16:28:26 +00:00
|
|
|
import { alias } from '@ember/object/computed';
|
|
|
|
import Component from '@ember/component';
|
|
|
|
import { computed } from '@ember/object';
|
2018-04-03 14:16:57 +00:00
|
|
|
import ReplicationActions from 'vault/mixins/replication-actions';
|
|
|
|
|
|
|
|
const DEFAULTS = {
|
|
|
|
token: null,
|
|
|
|
primary_api_addr: null,
|
|
|
|
primary_cluster_addr: null,
|
|
|
|
errors: [],
|
|
|
|
id: null,
|
|
|
|
replicationMode: null,
|
|
|
|
};
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
export default Component.extend(ReplicationActions, DEFAULTS, {
|
2018-04-03 14:16:57 +00:00
|
|
|
replicationMode: null,
|
|
|
|
selectedAction: null,
|
|
|
|
tagName: 'form',
|
|
|
|
|
|
|
|
didReceiveAttrs() {
|
|
|
|
this._super(...arguments);
|
|
|
|
},
|
|
|
|
|
|
|
|
model: null,
|
2018-09-25 16:28:26 +00:00
|
|
|
cluster: alias('model'),
|
2018-04-03 14:16:57 +00:00
|
|
|
loading: false,
|
|
|
|
onSubmit: null,
|
|
|
|
|
|
|
|
reset() {
|
|
|
|
if (!this || this.isDestroyed || this.isDestroying) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.setProperties(DEFAULTS);
|
|
|
|
},
|
|
|
|
|
|
|
|
replicationDisplayMode: computed('replicationMode', function() {
|
|
|
|
const replicationMode = this.get('replicationMode');
|
|
|
|
if (replicationMode === 'dr') {
|
|
|
|
return 'DR';
|
|
|
|
}
|
|
|
|
if (replicationMode === 'performance') {
|
|
|
|
return 'Performance';
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
onSubmit() {
|
|
|
|
return this.submitHandler(...arguments);
|
|
|
|
},
|
|
|
|
clear() {
|
|
|
|
this.reset();
|
|
|
|
this.setProperties({
|
|
|
|
token: null,
|
|
|
|
id: null,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|