Updates to operation show up in conditionclass

This commit is contained in:
Joshi 2020-01-22 13:01:23 -08:00
parent cdb7066bed
commit ab6e87ae6b
2 changed files with 16 additions and 15 deletions

View File

@ -1,20 +1,20 @@
<template>
<div id="conditionArea"
v-if="condition"
v-if="condition && condition.definition"
class="c-cs-ui__conditions"
:class="['widget-condition', { 'widget-condition--current': condition.isCurrent }]"
>
<div class="title-bar">
<span class="condition-name">
{{ condition.name }}
{{ condition.definition.name }}
</span>
<span class="condition-output">
Output: {{ condition.output }}
Output: {{ condition.definition.output }}
</span>
</div>
<div class="condition-config">
<span class="condition-description">
{{ condition.description }}
{{ condition.definition.description }}
</span>
</div>
</div>
@ -36,9 +36,7 @@ export default {
};
},
mounted() {
this.condition = {};
this.openmct.objects.get(this.conditionIdentifier).then((obj => {
console.log('ConditionEdit obj', obj);
this.condition = obj;
}));
},

View File

@ -107,7 +107,9 @@
</select>
</span>
<span class="controls">
<select @change="getOperationKey">
<select v-model="selectedOperationKey"
@change="operationKeyChange"
>
<option value="">- Select Comparison -</option>
<option v-for="option in operations"
:key="option.name"
@ -176,6 +178,7 @@ export default {
};
},
destroyed() {
this.conditionClass.off('conditionResultUpdated', this.handleConditionResult.bind(this));
if (this.conditionClass && typeof this.conditionClass.destroy === 'function') {
this.conditionClass.destroy();
}
@ -183,10 +186,10 @@ export default {
mounted() {
this.openmct.objects.get(this.conditionIdentifier).then((obj => {
this.condition = obj;
this.conditionClass = new ConditionClass(this.condition, this.openmct);
this.conditionClass.on('conditionResultUpdated', this.handleConditionResult.bind(this))
this.setOutput();
this.updateTelemetry();
this.conditionClass = new ConditionClass(this.condition, this.openmct);
this.conditionClass.on('conditionResultUpdated', this.handleConditionResult.bind(this));
}));
},
updated() {
@ -235,7 +238,7 @@ export default {
hasTelemetry() {
return this.condition.definition.criteria.length && this.condition.definition.criteria[0].key;
},
persist(index) { //this should only persist the condition domain object
persist() {
this.openmct.objects.mutate(this.condition, 'definition', this.condition.definition);
},
checkInputValue() {
@ -243,19 +246,19 @@ export default {
this.condition.definition.output = '';
}
},
getOperationKey(ev) {
operationKeyChange(ev) {
if (ev.target.value !== 'isUndefined' && ev.target.value !== 'isDefined') {
this.comparisonValueField = true;
} else {
this.comparisonValueField = false;
}
this.selectedOperationKey = ev.target.value;
this.condition.definition.operator = this.selectedOperationKey;
this.condition.definition.criteria[0].operation = this.selectedOperationKey;
this.persist();
//find the criterion being updated and set the operator property
//find the criterion being updated and set the operation property
},
getOperationValue(ev) {
this.selectedOperationKey = ev.target.value;
this.condition.definition.criteria[0].input = [ev.target.value];
this.persist();
//find the criterion being updated and set the input property
}
}