mirror of
https://github.com/nasa/openmct.git
synced 2024-12-30 09:58:52 +00:00
Persist conditionCollection to the conditionSet
Populate persisted operation
This commit is contained in:
parent
ab6e87ae6b
commit
67b24ce846
@ -79,7 +79,11 @@ export default {
|
||||
this.composition.on('add', this.addTelemetry);
|
||||
this.composition.load();
|
||||
this.conditionCollection = this.domainObject.configuration ? this.domainObject.configuration.conditionCollection : [];
|
||||
if (!this.conditionCollection.length) {this.addCondition(null, true)}
|
||||
if (!this.conditionCollection.length) {
|
||||
this.addCondition(null, true)
|
||||
} else {
|
||||
console.log(this.conditionCollection.length, this.conditionCollection);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleConditionResult(args) {
|
||||
@ -94,6 +98,7 @@ export default {
|
||||
this.openmct.objects.mutate(conditionDO, 'created', new Date());
|
||||
|
||||
this.conditionCollection.unshift(conditionDO.identifier);
|
||||
this.persist();
|
||||
},
|
||||
getConditionDomainObject(isDefault) {
|
||||
let conditionObj = {
|
||||
@ -134,6 +139,9 @@ export default {
|
||||
reorderPlan.forEach((reorderEvent) => {
|
||||
this.$set(this.conditionCollection, reorderEvent.newIndex, oldConditions[reorderEvent.oldIndex]);
|
||||
});
|
||||
},
|
||||
persist() {
|
||||
this.openmct.objects.mutate(this.domainObject, 'configuration.conditionCollection', this.conditionCollection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -187,6 +187,7 @@ export default {
|
||||
this.openmct.objects.get(this.conditionIdentifier).then((obj => {
|
||||
this.condition = obj;
|
||||
this.setOutput();
|
||||
this.setOperation();
|
||||
this.updateTelemetry();
|
||||
this.conditionClass = new ConditionClass(this.condition, this.openmct);
|
||||
this.conditionClass.on('conditionResultUpdated', this.handleConditionResult.bind(this));
|
||||
@ -212,9 +213,7 @@ export default {
|
||||
},
|
||||
setOutput() {
|
||||
if (this.condition.definition.output !== 'false' && this.condition.definition.output !== 'true') {
|
||||
// this.$refs.outputSelect.value = 'string';
|
||||
this.selectedOutputKey = this.outputOptions[2].key;
|
||||
// this.stringOutputField = true;
|
||||
} else {
|
||||
if (this.condition.definition.output === 'true') {
|
||||
this.selectedOutputKey = this.outputOptions[1].key;
|
||||
@ -223,6 +222,15 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
setOperation() {
|
||||
if (this.condition.definition.criteria.length && this.condition.definition.criteria[0].operation) {
|
||||
for (let i=0, ii=this.operations.length; i < ii; i++) {
|
||||
if (this.condition.definition.criteria[0].operation === this.operations[i].name) {
|
||||
this.selectedOperationKey = this.operations[i].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
updateTelemetry() {
|
||||
if (this.hasTelemetry()) {
|
||||
this.openmct.objects.get(this.condition.definition.criteria[0].key).then((obj) => {
|
||||
|
Loading…
Reference in New Issue
Block a user