Merge pull request #2806 from nasa/preserve-user-input

Preserve user input when changing criterion comparison
This commit is contained in:
David Tsay 2020-03-29 15:59:31 -07:00 committed by GitHub
commit 389589d7f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 9 deletions

View File

@ -20,8 +20,7 @@
<span v-if="criterion.telemetry"
class="c-cdef__control"
>
<select ref="metadataSelect"
v-model="criterion.metadata"
<select v-model="criterion.metadata"
@change="updateOperations"
>
<option value="">- Select Field -</option>
@ -208,8 +207,9 @@ export default {
},
updateOperationInputVisibility(ev) {
if (ev) {
this.criterion.input = this.enumerations.length ? [this.enumerations[0].value.toString()] : [];
this.inputCount = 0;
if (this.enumerations.length) {
this.criterion.input = [this.enumerations[0].value.toString()];
}
this.persist();
}
for (let i = 0; i < this.filteredOps.length; i++) {
@ -222,10 +222,8 @@ export default {
clearDependentFields(el) {
if (el === this.$refs.telemetrySelect) {
this.criterion.metadata = '';
this.criterion.operation = '';
} else if (el === this.$refs.metadataSelect) {
this.criterion.operation = '';
}
this.criterion.operation = '';
this.criterion.input = [];
this.inputCount = 0;
},

View File

@ -82,7 +82,7 @@ export const OPERATIONS = [
appliesTo: ['number'],
inputCount: 2,
getDescription: function (values) {
return ' is between ' + values.join(', ') + ' and ' + values[1];
return ' is between ' + values[0] + ' and ' + values[1];
}
},
{
@ -94,7 +94,7 @@ export const OPERATIONS = [
appliesTo: ['number'],
inputCount: 2,
getDescription: function (values) {
return ' is not between ' + values.join(', ') + ' and ' + values[1];
return ' is not between ' + values[0] + ' and ' + values[1];
}
},
{