Fixes saving the input value for a criteria

This commit is contained in:
Joshi 2020-01-26 22:56:21 -08:00
parent d98b54bea7
commit d6a422fbdb
2 changed files with 4 additions and 10 deletions

View File

@ -127,7 +127,6 @@
class="t-rule-name-input" class="t-rule-name-input"
type="text" type="text"
v-model="operationValue" v-model="operationValue"
@keyup="getOperationValue"
> >
</span> </span>
</span> </span>
@ -241,7 +240,7 @@ export default {
this.selectedOperationKey = this.operations[i].name; this.selectedOperationKey = this.operations[i].name;
this.comparisonValueField = this.operations[i].inputCount > 0; this.comparisonValueField = this.operations[i].inputCount > 0;
if (this.comparisonValueField) { if (this.comparisonValueField) {
this.operationValue = this.condition.definition.criteria[0].input; this.operationValue = this.condition.definition.criteria[0].input[0];
} }
} }
} }
@ -287,9 +286,11 @@ export default {
this.condition.definition.criteria[0].key = this.selectedTelemetryKey; this.condition.definition.criteria[0].key = this.selectedTelemetryKey;
this.condition.definition.criteria[0].metaDataKey = this.selectedMetaDataKey; this.condition.definition.criteria[0].metaDataKey = this.selectedMetaDataKey;
this.condition.definition.criteria[0].operation = this.selectedOperationKey; this.condition.definition.criteria[0].operation = this.selectedOperationKey;
this.condition.definition.criteria[0].input = [this.operationValue];
} }
}, },
persist() { persist() {
this.updateConditionCriteria();
this.openmct.objects.mutate(this.condition, 'definition', this.condition.definition); this.openmct.objects.mutate(this.condition, 'definition', this.condition.definition);
}, },
checkInputValue() { checkInputValue() {
@ -305,19 +306,12 @@ export default {
} else { } else {
this.comparisonValueField = false; this.comparisonValueField = false;
} }
this.updateConditionCriteria();
//find the criterion being updated and set the operation property //find the criterion being updated and set the operation property
}, },
telemetryChange() { telemetryChange() {
this.selectedMetaDataKey = ''; this.selectedMetaDataKey = '';
this.updateConditionCriteria();
this.updateTelemetry(); this.updateTelemetry();
}, },
getOperationValue(ev) {
this.condition.definition.criteria[0].input = [ev.target.value];
this.updateConditionCriteria();
//find the criterion being updated and set the input property
},
updateCurrentCondition() { updateCurrentCondition() {
this.$emit('update-current-condition', this.conditionIdentifier); this.$emit('update-current-condition', this.conditionIdentifier);
} }

View File

@ -77,7 +77,7 @@ export default class TelemetryCriterion extends EventEmitter {
let params = []; let params = [];
let result = false; let result = false;
params.push(data[this.metaDataKey]); params.push(data[this.metaDataKey]);
params.push(this.input); params.push(this.input[0]);
console.log(params); console.log(params);
if (typeof comparator === 'function') { if (typeof comparator === 'function') {
result = comparator(params); result = comparator(params);