diff --git a/src/plugins/condition/components/Condition.vue b/src/plugins/condition/components/Condition.vue index 07c2db5502..cab86f2e5f 100644 --- a/src/plugins/condition/components/Condition.vue +++ b/src/plugins/condition/components/Condition.vue @@ -214,7 +214,9 @@ export default { trigger: 'all', selectedOutputSelection: '', outputOptions: ['false', 'true', 'string'], - criterionIndex: 0 + criterionIndex: 0, + selectedTelemetryName: '', + selectedFieldName: '' }; }, computed: { @@ -296,10 +298,6 @@ export default { this.condition.configuration.criteria.splice(index + 1, 0, clonedCriterion); this.persist() }, - hasTelemetry(identifier) { - // TODO: check parent condition.composition.hasTelemetry - return this.currentCriteria && identifier; - }, persist() { this.$emit('updateCondition', { condition: this.condition, diff --git a/src/plugins/condition/components/Criterion.vue b/src/plugins/condition/components/Criterion.vue index 3359c15fd1..8fdc18278d 100644 --- a/src/plugins/condition/components/Criterion.vue +++ b/src/plugins/condition/components/Criterion.vue @@ -5,6 +5,7 @@ @@ -162,29 +164,34 @@ export default { }); }, updateMetadataOptions(ev) { - if (ev) {this.clearInputs()} + if (ev) { + this.clearDependentFields(ev.target) + } if (this.criterion.telemetry) { this.openmct.objects.get(this.criterion.telemetry).then((telemetryObject) => { this.telemetryMetadata = this.openmct.telemetry.getMetadata(telemetryObject); this.telemetryMetadataOptions = this.telemetryMetadata.values(); - this.updateOperations(); + this.updateOperations(ev); this.updateOperationInputVisibility(); + this.$emit('setTelemetryName', telemetryObject.name) }); } else { this.criterion.metadata = ''; } }, updateOperations(ev) { - if (ev) { - this.clearInputs() + if (ev && ev.target.classList.contains('js-metadata-select')) { + this.clearDependentFields(ev.target); + this.persist(); } this.getOperationFormat(); - this.persist(); + }, updateOperationInputVisibility(ev) { if (ev) { this.criterion.input = this.enumerations.length ? [this.enumerations[0].value.toString()] : []; this.inputCount = 0; + this.persist(); } for (let i = 0; i < this.filteredOps.length; i++) { if (this.criterion.operation === this.filteredOps[i].name) { @@ -192,10 +199,14 @@ export default { if (!this.inputCount) {this.criterion.input = []} } } - this.persist(); }, - clearInputs() { - this.criterion.operation = ''; + clearDependentFields(el) { + if (el.classList.contains('js-telemetry-select')) { + this.criterion.metadata = ''; + this.criterion.operation = ''; + } else if (el.classList.contains('js-metadata-select')) { + this.criterion.operation = ''; + } this.criterion.input = []; this.inputCount = 0; },