mirror of
https://github.com/nasa/openmct.git
synced 2025-03-28 14:48:42 +00:00
refactored to address review comments
This commit is contained in:
parent
11c205b5c4
commit
53e0ed4d4a
@ -3,7 +3,7 @@
|
|||||||
<label>{{ setRowLabel }}</label>
|
<label>{{ setRowLabel }}</label>
|
||||||
<span class="t-configuration">
|
<span class="t-configuration">
|
||||||
<span class="controls">
|
<span class="controls">
|
||||||
<select v-model="selectedTelemetryObject"
|
<select v-model="criterion.telemetry"
|
||||||
@change="updateMetadataOptions"
|
@change="updateMetadataOptions"
|
||||||
>
|
>
|
||||||
<option value="">- Select Telemetry -</option>
|
<option value="">- Select Telemetry -</option>
|
||||||
@ -16,7 +16,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</span>
|
</span>
|
||||||
<span class="controls">
|
<span class="controls">
|
||||||
<select v-model="selectedMetadataOption"
|
<select v-model="criterion.metadata"
|
||||||
@change="updateMetadataSelection"
|
@change="updateMetadataSelection"
|
||||||
>
|
>
|
||||||
<option value="">- Select Field -</option>
|
<option value="">- Select Field -</option>
|
||||||
@ -29,8 +29,8 @@
|
|||||||
</select>
|
</select>
|
||||||
</span>
|
</span>
|
||||||
<span class="controls">
|
<span class="controls">
|
||||||
<select v-model="selectedOperationOption"
|
<select v-model="criterion.operation"
|
||||||
@change="updateOperationOption"
|
@change="updateOperationInputVisibility"
|
||||||
>
|
>
|
||||||
<option value="">- Select Comparison -</option>
|
<option value="">- Select Comparison -</option>
|
||||||
<option v-for="option in operations"
|
<option v-for="option in operations"
|
||||||
@ -41,10 +41,9 @@
|
|||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<input v-if="isInputOperation"
|
<input v-if="isInputOperation"
|
||||||
v-model="comparisonInputValue"
|
v-model="criterion.input"
|
||||||
class="t-condition-name-input"
|
class="t-condition-name-input"
|
||||||
type="text"
|
type="text"
|
||||||
@blur="setInput"
|
|
||||||
>
|
>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
@ -80,10 +79,6 @@ export default {
|
|||||||
return {
|
return {
|
||||||
telemetryMetadata: {},
|
telemetryMetadata: {},
|
||||||
operations: OPERATIONS,
|
operations: OPERATIONS,
|
||||||
selectedTelemetryObject: this.criterion.telemetry || '',
|
|
||||||
selectedMetadataOption: this.criterion.metadata || {},
|
|
||||||
selectedOperationOption: this.criterion.operation || '',
|
|
||||||
comparisonInputValue: this.criterion.input || '',
|
|
||||||
isInputOperation: false,
|
isInputOperation: false,
|
||||||
rowLabel: ''
|
rowLabel: ''
|
||||||
}
|
}
|
||||||
@ -91,55 +86,31 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
setRowLabel: function () {
|
setRowLabel: function () {
|
||||||
let operator = this.trigger === 'all' ? 'and ': 'or ';
|
let operator = this.trigger === 'all' ? 'and ': 'or ';
|
||||||
|
|
||||||
return (this.index !== 0 ? operator : '') + 'when';
|
return (this.index !== 0 ? operator : '') + 'when';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initialize();
|
this.updateMetadataOptions();
|
||||||
|
this.updateOperationInputVisibility();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initialize() {
|
|
||||||
this.updateMetadataOptions();
|
|
||||||
this.updateOperationInputVisibility();
|
|
||||||
},
|
|
||||||
updateMetadataOptions() {
|
updateMetadataOptions() {
|
||||||
if (this.selectedTelemetryObject) {
|
if (this.criterion.telemetry) {
|
||||||
this.openmct.objects.get(this.selectedTelemetryObject).then((telemetryObject) => {
|
this.openmct.objects.get(this.criterion.telemetry).then((telemetryObject) => {
|
||||||
this.telemetryMetadata = this.openmct.telemetry.getMetadata(telemetryObject).values();
|
this.telemetryMetadata = this.openmct.telemetry.getMetadata(telemetryObject).values();
|
||||||
});
|
});
|
||||||
this.criterion.telemetry = this.selectedTelemetryObject;
|
|
||||||
} else {
|
|
||||||
this.selectedMetadataOption = '';
|
|
||||||
}
|
}
|
||||||
this.persist();
|
|
||||||
},
|
|
||||||
updateOperationOption() {
|
|
||||||
this.criterion.operation = this.selectedOperationOption;
|
|
||||||
this.updateOperationInputVisibility();
|
|
||||||
this.persist();
|
|
||||||
},
|
},
|
||||||
updateOperationInputVisibility() {
|
updateOperationInputVisibility() {
|
||||||
for (let i=0; i < this.operations.length; i++) {
|
for (let i=0; i < this.operations.length; i++) {
|
||||||
if (this.selectedOperationOption === this.operations[i].name) {
|
if (this.criterion.operation === this.operations[i].name) {
|
||||||
if (this.operations[i].inputCount > 0) {
|
this.isInputOperation = this.operations[i].inputCount > 0;
|
||||||
this.isInputOperation = true;
|
if (!this.isInputOperation) {this.criterion.input = ''}
|
||||||
} else {
|
|
||||||
this.isInputOperation = false;
|
|
||||||
this.comparisonInputValue = '';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.criterion.operation = this.selectedOperationOption;
|
|
||||||
},
|
},
|
||||||
updateMetadataSelection() {
|
updateMetadataSelection() {
|
||||||
this.comparisonInputValue = '';
|
this.comparisonInputValue = '';
|
||||||
this.criterion.metadata = this.selectedMetadataOption;
|
|
||||||
this.persist();
|
|
||||||
},
|
|
||||||
setInput() {
|
|
||||||
this.criterion.input = this.comparisonInputValue;
|
|
||||||
this.persist();
|
|
||||||
},
|
},
|
||||||
persist() {
|
persist() {
|
||||||
this.$emit('persist', this.criterion);
|
this.$emit('persist', this.criterion);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user