mirror of
https://github.com/nasa/openmct.git
synced 2025-01-17 10:20:27 +00:00
moved persist calls to events, used emit to save name and fieldname props
This commit is contained in:
parent
e08b4ff0ab
commit
44f48a3e2a
@ -139,6 +139,8 @@
|
|||||||
:trigger="condition.configuration.trigger"
|
:trigger="condition.configuration.trigger"
|
||||||
:is-default="condition.configuration.criteria.length === 1"
|
:is-default="condition.configuration.criteria.length === 1"
|
||||||
@persist="persist"
|
@persist="persist"
|
||||||
|
@setTelemetryName="setTelemetryName"
|
||||||
|
@setFieldName="setFieldName"
|
||||||
/>
|
/>
|
||||||
<div class="c-cdef__criteria__buttons">
|
<div class="c-cdef__criteria__buttons">
|
||||||
<button class="c-click-icon c-cdef__criteria-duplicate-button icon-duplicate"
|
<button class="c-click-icon c-cdef__criteria-duplicate-button icon-duplicate"
|
||||||
@ -240,7 +242,9 @@ export default {
|
|||||||
trigger: 'all',
|
trigger: 'all',
|
||||||
selectedOutputSelection: '',
|
selectedOutputSelection: '',
|
||||||
outputOptions: ['false', 'true', 'string'],
|
outputOptions: ['false', 'true', 'string'],
|
||||||
criterionIndex: 0
|
criterionIndex: 0,
|
||||||
|
selectedTelemetryName: '',
|
||||||
|
selectedFieldName: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -268,8 +272,14 @@ export default {
|
|||||||
this.setOutputSelection();
|
this.setOutputSelection();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
setTelemetryName(name) {
|
||||||
|
this.selectedTelemetryName = name;
|
||||||
|
},
|
||||||
|
setFieldName(name) {
|
||||||
|
this.selectedFieldName = name;
|
||||||
|
},
|
||||||
getRule(criterion, index) {
|
getRule(criterion, index) {
|
||||||
return `${criterion.telemetry.name} ${criterion.telemetry.fieldName} ${this.findDescription(criterion.operation, criterion.input)}`;
|
return `${this.selectedTelemetryName} ${criterion.telemetry.fieldName} ${this.findDescription(criterion.operation, criterion.input)}`;
|
||||||
},
|
},
|
||||||
isLastCriterion(index) {
|
isLastCriterion(index) {
|
||||||
return index === this.condition.configuration.criteria.length - 1;
|
return index === this.condition.configuration.criteria.length - 1;
|
||||||
@ -337,12 +347,9 @@ export default {
|
|||||||
const clonedCriterion = {...this.condition.configuration.criteria[index]};
|
const clonedCriterion = {...this.condition.configuration.criteria[index]};
|
||||||
this.condition.configuration.criteria.splice(index + 1, 0, clonedCriterion);
|
this.condition.configuration.criteria.splice(index + 1, 0, clonedCriterion);
|
||||||
this.persist()
|
this.persist()
|
||||||
},
|
},
|
||||||
hasTelemetry(identifier) {
|
|
||||||
// TODO: check parent condition.composition.hasTelemetry
|
|
||||||
return this.currentCriteria && identifier;
|
|
||||||
},
|
|
||||||
persist() {
|
persist() {
|
||||||
|
console.log('persist')
|
||||||
this.$emit('updateCondition', {
|
this.$emit('updateCondition', {
|
||||||
condition: this.condition,
|
condition: this.condition,
|
||||||
index: this.conditionIndex
|
index: this.conditionIndex
|
||||||
|
@ -163,11 +163,11 @@ export default {
|
|||||||
if (ev) {this.clearInputs()}
|
if (ev) {this.clearInputs()}
|
||||||
if (this.criterion.telemetry) {
|
if (this.criterion.telemetry) {
|
||||||
this.openmct.objects.get(this.criterion.telemetry).then((telemetryObject) => {
|
this.openmct.objects.get(this.criterion.telemetry).then((telemetryObject) => {
|
||||||
this.criterion.telemetry.name = telemetryObject.name;
|
|
||||||
this.telemetryMetadata = this.openmct.telemetry.getMetadata(telemetryObject);
|
this.telemetryMetadata = this.openmct.telemetry.getMetadata(telemetryObject);
|
||||||
this.telemetryMetadataOptions = this.telemetryMetadata.values();
|
this.telemetryMetadataOptions = this.telemetryMetadata.values();
|
||||||
this.updateOperations();
|
this.updateOperations();
|
||||||
this.updateOperationInputVisibility();
|
this.updateOperationInputVisibility();
|
||||||
|
this.$emit('setTelemetryName', telemetryObject.name)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.criterion.metadata = '';
|
this.criterion.metadata = '';
|
||||||
@ -175,16 +175,17 @@ export default {
|
|||||||
},
|
},
|
||||||
updateOperations(ev) {
|
updateOperations(ev) {
|
||||||
if (ev) {
|
if (ev) {
|
||||||
this.criterion.telemetry.fieldName = ev.target.options[ev.target.selectedIndex].text;
|
this.$emit('setFieldName', ev.target.options[ev.target.selectedIndex].text);
|
||||||
this.clearInputs()
|
this.clearInputs();
|
||||||
|
this.persist();
|
||||||
}
|
}
|
||||||
this.getOperationFormat();
|
this.getOperationFormat();
|
||||||
this.persist();
|
|
||||||
},
|
},
|
||||||
updateOperationInputVisibility(ev) {
|
updateOperationInputVisibility(ev) {
|
||||||
if (ev) {
|
if (ev) {
|
||||||
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;
|
this.inputCount = 0;
|
||||||
|
this.persist();
|
||||||
}
|
}
|
||||||
for (let i = 0; i < this.filteredOps.length; i++) {
|
for (let i = 0; i < this.filteredOps.length; i++) {
|
||||||
if (this.criterion.operation === this.filteredOps[i].name) {
|
if (this.criterion.operation === this.filteredOps[i].name) {
|
||||||
@ -192,7 +193,6 @@ export default {
|
|||||||
if (!this.inputCount) {this.criterion.input = []}
|
if (!this.inputCount) {this.criterion.input = []}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.persist();
|
|
||||||
},
|
},
|
||||||
clearInputs() {
|
clearInputs() {
|
||||||
this.criterion.operation = '';
|
this.criterion.operation = '';
|
||||||
|
Loading…
Reference in New Issue
Block a user