Merge pull request #2764 from nasa/condition-persist

Telemetry stickiness issue
This commit is contained in:
David Tsay 2020-03-26 12:34:37 -07:00 committed by GitHub
commit 23ec838643
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 15 deletions

View File

@ -214,7 +214,9 @@ export default {
trigger: 'all', trigger: 'all',
selectedOutputSelection: '', selectedOutputSelection: '',
outputOptions: ['false', 'true', 'string'], outputOptions: ['false', 'true', 'string'],
criterionIndex: 0 criterionIndex: 0,
selectedTelemetryName: '',
selectedFieldName: ''
}; };
}, },
computed: { computed: {
@ -296,10 +298,6 @@ export default {
this.condition.configuration.criteria.splice(index + 1, 0, clonedCriterion); this.condition.configuration.criteria.splice(index + 1, 0, clonedCriterion);
this.persist() this.persist()
}, },
hasTelemetry(identifier) {
// TODO: check parent condition.composition.hasTelemetry
return this.currentCriteria && identifier;
},
persist() { persist() {
this.$emit('updateCondition', { this.$emit('updateCondition', {
condition: this.condition, condition: this.condition,

View File

@ -4,7 +4,8 @@
<span class="c-cdef__label">{{ setRowLabel }}</span> <span class="c-cdef__label">{{ setRowLabel }}</span>
<span class="c-cdef__controls"> <span class="c-cdef__controls">
<span class="c-cdef__control"> <span class="c-cdef__control">
<select v-model="criterion.telemetry" <select ref="telemetrySelect"
v-model="criterion.telemetry"
@change="updateMetadataOptions" @change="updateMetadataOptions"
> >
<option value="">- Select Telemetry -</option> <option value="">- Select Telemetry -</option>
@ -19,7 +20,8 @@
<span v-if="criterion.telemetry" <span v-if="criterion.telemetry"
class="c-cdef__control" class="c-cdef__control"
> >
<select v-model="criterion.metadata" <select ref="metadataSelect"
v-model="criterion.metadata"
@change="updateOperations" @change="updateOperations"
> >
<option value="">- Select Field -</option> <option value="">- Select Field -</option>
@ -162,29 +164,34 @@ export default {
}); });
}, },
updateMetadataOptions(ev) { updateMetadataOptions(ev) {
if (ev) {this.clearInputs()} if (ev) {
this.clearDependentFields(ev.target)
}
if (this.criterion.telemetry) { if (this.criterion.telemetry) {
this.openmct.objects.get(this.criterion.telemetry).then((telemetryObject) => { this.openmct.objects.get(this.criterion.telemetry).then((telemetryObject) => {
this.telemetryMetadata = this.openmct.telemetry.getMetadata(telemetryObject); this.telemetryMetadata = this.openmct.telemetry.getMetadata(telemetryObject);
this.telemetryMetadataOptions = this.telemetryMetadata.values(); this.telemetryMetadataOptions = this.telemetryMetadata.values();
this.updateOperations(); this.updateOperations(ev);
this.updateOperationInputVisibility(); this.updateOperationInputVisibility();
this.$emit('setTelemetryName', telemetryObject.name)
}); });
} else { } else {
this.criterion.metadata = ''; this.criterion.metadata = '';
} }
}, },
updateOperations(ev) { updateOperations(ev) {
if (ev) { if (ev.target === this.$ref.telemetrySelect) {
this.clearInputs() this.clearDependentFields(ev.target);
this.persist();
} }
this.getOperationFormat(); this.getOperationFormat();
this.persist();
}, },
updateOperationInputVisibility(ev) { updateOperationInputVisibility(ev) {
if (ev) { if (ev) {
this.criterion.input = this.enumerations.length ? [this.enumerations[0].value.toString()] : []; this.criterion.input = this.enumerations.length ? [this.enumerations[0].value.toString()] : [];
this.inputCount = 0; this.inputCount = 0;
this.persist();
} }
for (let i = 0; i < this.filteredOps.length; i++) { for (let i = 0; i < this.filteredOps.length; i++) {
if (this.criterion.operation === this.filteredOps[i].name) { if (this.criterion.operation === this.filteredOps[i].name) {
@ -192,10 +199,14 @@ export default {
if (!this.inputCount) {this.criterion.input = []} if (!this.inputCount) {this.criterion.input = []}
} }
} }
this.persist();
}, },
clearInputs() { clearDependentFields(el) {
this.criterion.operation = ''; if (el === this.$ref.telemetrySelect) {
this.criterion.metadata = '';
this.criterion.operation = '';
} else if (el === this.$ref.metadataSelect) {
this.criterion.operation = '';
}
this.criterion.input = []; this.criterion.input = [];
this.inputCount = 0; this.inputCount = 0;
}, },