diff --git a/src/plugins/condition/components/ConditionCollection.vue b/src/plugins/condition/components/ConditionCollection.vue index 50808dd27b..a9cfe62c8a 100644 --- a/src/plugins/condition/components/ConditionCollection.vue +++ b/src/plugins/condition/components/ConditionCollection.vue @@ -31,6 +31,7 @@
-
@@ -94,16 +94,19 @@ export default { }, methods: { removeCondition(ev) { - let conditionDiv = ev.target.closest('.conditionArea'); - let conditionCollectionDiv = conditionDiv.closest('.condition-collection'); - let index = Array.from(conditionDiv.parentNode.children).indexOf(conditionDiv) + const conditionDiv = ev.target.closest('.conditionArea'); + const conditionCollectionDiv = conditionDiv.closest('.condition-collection'); + const index = Array.from(conditionCollectionDiv.children).indexOf(conditionDiv); - //Array.from(element.parentNode.children).indexOf(element) - //console.log(`conditionDiv.nodeName: ${conditionDiv.nodeName}`); - console.log(`index: ${index}`); - console.log(`conditionCollectionDiv.children.length: ${conditionCollectionDiv.childNodes.length}`); - console.log(this.domainObject.configuration.conditionCollection.length); - // this.conditions.splice(index, 1); + this.domainObject.configuration.conditionCollection.splice(index, 1); + this.persist() + }, + persist(index) { + if (index) { + this.openmct.objects.mutate(this.domainObject, `configuration.conditionCollection[${index}]`, this.domainObject.configuration.conditionCollection[index]); + } else { + this.openmct.objects.mutate(this.domainObject, 'configuration.conditionCollection', this.domainObject.configuration.conditionCollection); + } } } }