reverted changes unrelated to id

This commit is contained in:
Joel McKinnon 2020-04-01 15:08:31 -07:00
parent c33314a4bf
commit d3443518d6
2 changed files with 14 additions and 16 deletions

View File

@ -108,7 +108,7 @@ export default class ConditionManager extends EventEmitter {
if (conditionConfiguration) { if (conditionConfiguration) {
conditionObj = { conditionObj = {
...conditionConfiguration, ...conditionConfiguration,
id: conditionConfiguration.id || uuid(), id: uuid(),
configuration: { configuration: {
...conditionConfiguration.configuration, ...conditionConfiguration.configuration,
name: `Copy of ${conditionConfiguration.configuration.name}` name: `Copy of ${conditionConfiguration.configuration.name}`

View File

@ -85,7 +85,7 @@
</span> </span>
</template> </template>
<span v-else> <span v-else>
<span v-if="inputCount" <span v-if="inputCount && criterion.operation"
class="c-cdef__control" class="c-cdef__control"
> >
<select v-model="criterion.input[0]" <select v-model="criterion.input[0]"
@ -134,6 +134,7 @@ export default {
return { return {
telemetryMetadataOptions: [], telemetryMetadataOptions: [],
operations: OPERATIONS, operations: OPERATIONS,
inputCount: 0,
rowLabel: '', rowLabel: '',
operationFormat: '', operationFormat: '',
enumerations: [], enumerations: [],
@ -161,18 +162,6 @@ export default {
} }
} }
return type; return type;
},
inputCount: function () {
let inputCount = 0;
if (this.criterion.operation) {
for (let i = 0; i < this.filteredOps.length; i++) {
if (this.criterion.operation === this.filteredOps[i].name) {
inputCount = this.filteredOps[i].inputCount;
break;
}
}
}
return inputCount;
} }
}, },
watch: { watch: {
@ -270,6 +259,15 @@ export default {
this.clearDependentFields(); this.clearDependentFields();
this.persist(); this.persist();
} }
for (let i = 0; i < this.filteredOps.length; i++) {
if (this.criterion.operation === this.filteredOps[i].name) {
this.inputCount = this.filteredOps[i].inputCount;
}
}
if (!this.inputCount) {
this.criterion.input = [];
}
}, },
clearDependentFields(el) { clearDependentFields(el) {
if (el === this.$refs.telemetrySelect) { if (el === this.$refs.telemetrySelect) {
@ -278,12 +276,12 @@ export default {
if (!this.filteredOps.find(operation => operation.name === this.criterion.operation)) { if (!this.filteredOps.find(operation => operation.name === this.criterion.operation)) {
this.criterion.operation = ''; this.criterion.operation = '';
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; }
} else { } else {
if (this.enumerations.length && !this.criterion.input.length) { if (this.enumerations.length && !this.criterion.input.length) {
this.criterion.input = [this.enumerations[0].value.toString()]; this.criterion.input = [this.enumerations[0].value.toString()];
} }
} this.inputCount = 0; }
}, },
persist() { persist() {
this.$emit('persist', this.criterion); this.$emit('persist', this.criterion);