[Conditionals] Ensure correct conditions are updated after reordering (#3336)

* Use id of condition instead of index to ensure
This commit is contained in:
Shefali Joshi
2020-08-28 11:54:52 -07:00
committed by GitHub
parent c4cd725c9a
commit efd97de743
4 changed files with 125 additions and 33 deletions

View File

@@ -308,15 +308,15 @@ export default {
};
this.condition.configuration.criteria.push(criteriaObject);
},
dragStart(e) {
e.dataTransfer.setData('dragging', e.target); // required for FF to initiate drag
e.dataTransfer.effectAllowed = "copyMove";
e.dataTransfer.setDragImage(e.target.closest('.c-condition-h'), 0, 0);
dragStart(event) {
event.dataTransfer.clearData();
event.dataTransfer.setData('dragging', event.target); // required for FF to initiate drag
event.dataTransfer.effectAllowed = "copyMove";
event.dataTransfer.setDragImage(event.target.closest('.c-condition-h'), 0, 0);
this.$emit('setMoveIndex', this.conditionIndex);
},
dragEnd(event) {
dragEnd() {
this.dragStarted = false;
event.dataTransfer.clearData();
this.$emit('dragComplete');
},
dropCondition(event, targetIndex) {
@@ -359,10 +359,10 @@ export default {
},
destroy() {
},
removeCondition(ev) {
this.$emit('removeCondition', this.conditionIndex);
removeCondition() {
this.$emit('removeCondition', this.condition.id);
},
cloneCondition(ev) {
cloneCondition() {
this.$emit('cloneCondition', {
condition: this.condition,
index: this.conditionIndex
@@ -380,8 +380,7 @@ export default {
},
persist() {
this.$emit('updateCondition', {
condition: this.condition,
index: this.conditionIndex
condition: this.condition
});
},
initCap(str) {

View File

@@ -223,10 +223,10 @@ export default {
this.conditionManager.addCondition();
},
updateCondition(data) {
this.conditionManager.updateCondition(data.condition, data.index);
this.conditionManager.updateCondition(data.condition);
},
removeCondition(index) {
this.conditionManager.removeCondition(index);
removeCondition(id) {
this.conditionManager.removeCondition(id);
},
reorder(reorderPlan) {
this.conditionManager.reorderConditions(reorderPlan);