open-vault/ui/app/components/replication-actions.js
Matthew Irish d509588cd2
Ember update (#5386)
Ember update - update ember-cli, ember-data, and ember to 3.4 series
2018-09-25 11:28:26 -05:00

59 lines
1.2 KiB
JavaScript

import { alias } from '@ember/object/computed';
import Component from '@ember/component';
import { computed } from '@ember/object';
import ReplicationActions from 'vault/mixins/replication-actions';
const DEFAULTS = {
token: null,
primary_api_addr: null,
primary_cluster_addr: null,
errors: [],
id: null,
replicationMode: null,
};
export default Component.extend(ReplicationActions, DEFAULTS, {
replicationMode: null,
selectedAction: null,
tagName: 'form',
didReceiveAttrs() {
this._super(...arguments);
},
model: null,
cluster: alias('model'),
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,
});
},
},
});