added persist for remove

This commit is contained in:
Joel McKinnon 2020-01-22 08:53:25 -08:00
parent 2d8f61172d
commit 4d263bcf32
2 changed files with 7 additions and 7 deletions

View File

@ -137,16 +137,22 @@ export default {
this.conditions[index] = updatedCondition; this.conditions[index] = updatedCondition;
}, },
removeCondition(identifier) { removeCondition(identifier) {
console.log('this.conditions', this.conditions);
let index = _.findIndex(this.conditionCollection, (condition) => { let index = _.findIndex(this.conditionCollection, (condition) => {
identifier.key === condition.key identifier.key === condition.key
}); });
this.conditionCollection.splice(index + 1, 1); this.conditionCollection.splice(index + 1, 1);
this.persist();
}, },
reorder(reorderPlan) { reorder(reorderPlan) {
let oldConditions = this.conditionCollection.slice(); let oldConditions = this.conditionCollection.slice();
reorderPlan.forEach((reorderEvent) => { reorderPlan.forEach((reorderEvent) => {
this.$set(this.conditionCollection, reorderEvent.newIndex, oldConditions[reorderEvent.oldIndex]); this.$set(this.conditionCollection, reorderEvent.newIndex, oldConditions[reorderEvent.oldIndex]);
}); });
},
persist() {
console.log('this.domainObject', this.domainObject);
this.openmct.objects.mutate(this.domainObject, 'configuration.conditionCollection', this.conditionCollection);
} }
} }
} }

View File

@ -176,14 +176,8 @@ export default {
this.persist(); this.persist();
}, },
methods: { methods: {
removeCondition(ev) { removeCondition() {
this.$emit('remove-condition', this.conditionIdentifier); this.$emit('remove-condition', this.conditionIdentifier);
// const conditionDiv = ev.target.closest('.conditionArea');
// const conditionCollectionDiv = conditionDiv.closest('.condition-collection');
// const index = Array.from(conditionCollectionDiv.children).indexOf(conditionDiv);
// this.domainObject.configuration.conditionCollection.splice(index, 1);
// this.updateCurrentCondition();
}, },
updateTelemetry() { updateTelemetry() {
if (this.hasTelemetry()) { if (this.hasTelemetry()) {