mirror of
https://github.com/nasa/openmct.git
synced 2025-06-23 01:18:57 +00:00
ConditionSet view listens to a listener from conditionCollection to display current output.
This commit is contained in:
@ -34,7 +34,7 @@ export default class ConditionManager extends EventEmitter {
|
|||||||
this.initialize();
|
this.initialize();
|
||||||
|
|
||||||
this.stopObservingForChanges = this.openmct.objects.observe(this.conditionSetDomainObject, '*', (newDomainObject) => {
|
this.stopObservingForChanges = this.openmct.objects.observe(this.conditionSetDomainObject, '*', (newDomainObject) => {
|
||||||
this.update(newDomainObject);
|
this.conditionSetDomainObject = newDomainObject;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,15 +48,6 @@ export default class ConditionManager extends EventEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update(newDomainObject) {
|
|
||||||
this.destroy();
|
|
||||||
this.conditionSetDomainObject = newDomainObject;
|
|
||||||
this.stopObservingForChanges = this.openmct.objects.observe(this.conditionSetDomainObject, '*', (newDO) => {
|
|
||||||
this.update(newDO);
|
|
||||||
});
|
|
||||||
this.initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
updateCondition(conditionConfiguration, index) {
|
updateCondition(conditionConfiguration, index) {
|
||||||
let condition = this.conditionClassCollection[index];
|
let condition = this.conditionClassCollection[index];
|
||||||
condition.update(conditionConfiguration);
|
condition.update(conditionConfiguration);
|
||||||
|
@ -121,6 +121,9 @@ export default {
|
|||||||
this.conditionCollection = this.domainObject.configuration.conditionCollection;
|
this.conditionCollection = this.domainObject.configuration.conditionCollection;
|
||||||
this.observeForChanges();
|
this.observeForChanges();
|
||||||
this.conditionManager = new ConditionManager(this.domainObject, this.openmct);
|
this.conditionManager = new ConditionManager(this.domainObject, this.openmct);
|
||||||
|
this.conditionManager.on('conditionSetResultUpdated', (data) => {
|
||||||
|
this.$emit('conditionSetResultUpdated', data);
|
||||||
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
observeForChanges() {
|
observeForChanges() {
|
||||||
|
@ -34,7 +34,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<TestData :is-editing="isEditing" />
|
<TestData :is-editing="isEditing" />
|
||||||
<ConditionCollection :is-editing="isEditing" />
|
<ConditionCollection :is-editing="isEditing"
|
||||||
|
@conditionSetResultUpdated="updateCurrentOutput" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -58,7 +59,6 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.conditionSetIdentifier = this.openmct.objects.makeKeyString(this.domainObject.identifier);
|
this.conditionSetIdentifier = this.openmct.objects.makeKeyString(this.domainObject.identifier);
|
||||||
this.provideTelemetry();
|
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
if (this.stopProvidingTelemetry) {
|
if (this.stopProvidingTelemetry) {
|
||||||
@ -68,13 +68,6 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
updateCurrentOutput(currentConditionResult) {
|
updateCurrentOutput(currentConditionResult) {
|
||||||
this.currentConditionOutput = currentConditionResult.output;
|
this.currentConditionOutput = currentConditionResult.output;
|
||||||
},
|
|
||||||
provideTelemetry() {
|
|
||||||
if (this.stopProvidingTelemetry) {
|
|
||||||
this.stopProvidingTelemetry();
|
|
||||||
}
|
|
||||||
this.stopProvidingTelemetry = this.openmct.telemetry
|
|
||||||
.subscribe(this.domainObject, output => { this.updateCurrentOutput(output); });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user