persist output string selection

This commit is contained in:
Joel McKinnon 2020-01-16 15:29:07 -08:00
parent 642499d519
commit 08656a6674

View File

@ -47,14 +47,17 @@
<li> <li>
<label>Output</label> <label>Output</label>
<span class="controls"> <span class="controls">
<select @change="getOutputBinary"> <select ref="outputSelect"
@change="getOutputBinary">
<option value="false">False</option> <option value="false">False</option>
<option value="true">True</option> <option value="true">True</option>
<option value="string">String</option> <option value="string">String</option>
</select> </select>
<input v-if="stringOutput" <input v-if="stringOutputField"
ref="outputString"
class="t-rule-name-input" class="t-rule-name-input"
type="text" type="text"
:value="condition.output"
@keyup="getOutputString" @keyup="getOutputString"
> >
</span> </span>
@ -98,7 +101,7 @@
</select> </select>
</span> </span>
<span class="controls"> <span class="controls">
<select v-model="selectedOperationKey"> <select @change="getOperationKey">
<option value="">- Select Comparison -</option> <option value="">- Select Comparison -</option>
<option v-for="option in operations" <option v-for="option in operations"
:key="option.name" :key="option.name"
@ -107,6 +110,11 @@
{{ option.text }} {{ option.text }}
</option> </option>
</select> </select>
<input v-if="comparisonValueField"
class="t-rule-name-input"
type="text"
@keyup="getOperationValue"
>
</span> </span>
</span> </span>
</li> </li>
@ -142,16 +150,20 @@ export default {
operations: OPERATIONS, operations: OPERATIONS,
selectedMetaDataKey: null, selectedMetaDataKey: null,
selectedOperationKey: null, selectedOperationKey: null,
stringOutput: false stringOutputField: false,
comparisonValueField: false
}; };
}, },
mounted() { mounted() {
if (this.condition.output !== 'false' && this.condition.output !== 'true') {
this.$refs.outputSelect.value = 'string';
this.stringOutputField = true;
}
this.updateTelemetry(); this.updateTelemetry();
}, },
updated() { updated() {
console.log('updated conditionEdit');
this.updateCurrentCondition(); this.updateCurrentCondition();
this.persist() this.persist();
}, },
methods: { methods: {
removeCondition(ev) { removeCondition(ev) {
@ -196,13 +208,25 @@ export default {
getOutputBinary(ev) { getOutputBinary(ev) {
if (ev.target.value !== 'string') { if (ev.target.value !== 'string') {
this.condition.output = ev.target.value; this.condition.output = ev.target.value;
this.stringOutput = false; this.stringOutputField = false;
} else { } else {
this.stringOutput = true; this.stringOutputField = true;
} }
}, },
getOutputString(ev) { getOutputString(ev) {
this.condition.output = ev.target.value; this.condition.output = ev.target.value;
},
getOperationKey(ev) {
console.log(ev.target.value)
if (ev.target.value !== 'isUndefined' && ev.target.value !== 'isDefined') {
this.comparisonValueField = true;
} else {
this.comparisonValueField = false;
}
this.selectedOperationKey = ev.target.value;
},
getOperationValue(ev) {
this.selectedOperationKey = ev.target.value;
} }
} }
} }