From 6ab60ab52e8e908a76b32b4c8227a1fc798fb792 Mon Sep 17 00:00:00 2001 From: Joshi Date: Mon, 16 Mar 2020 15:00:16 -0700 Subject: [PATCH] ConditionSet view listens to a listener from conditionCollection to display current output. --- src/plugins/condition/ConditionManager.js | 11 +---------- .../condition/components/ConditionCollection.vue | 3 +++ src/plugins/condition/components/ConditionSet.vue | 11 ++--------- 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/plugins/condition/ConditionManager.js b/src/plugins/condition/ConditionManager.js index e10237e062..a74ff2230f 100644 --- a/src/plugins/condition/ConditionManager.js +++ b/src/plugins/condition/ConditionManager.js @@ -34,7 +34,7 @@ export default class ConditionManager extends EventEmitter { this.initialize(); 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) { let condition = this.conditionClassCollection[index]; condition.update(conditionConfiguration); diff --git a/src/plugins/condition/components/ConditionCollection.vue b/src/plugins/condition/components/ConditionCollection.vue index af0dfa2a84..a775b4b9d1 100644 --- a/src/plugins/condition/components/ConditionCollection.vue +++ b/src/plugins/condition/components/ConditionCollection.vue @@ -121,6 +121,9 @@ export default { this.conditionCollection = this.domainObject.configuration.conditionCollection; this.observeForChanges(); this.conditionManager = new ConditionManager(this.domainObject, this.openmct); + this.conditionManager.on('conditionSetResultUpdated', (data) => { + this.$emit('conditionSetResultUpdated', data); + }) }, methods: { observeForChanges() { diff --git a/src/plugins/condition/components/ConditionSet.vue b/src/plugins/condition/components/ConditionSet.vue index 653fdd9985..3393707478 100644 --- a/src/plugins/condition/components/ConditionSet.vue +++ b/src/plugins/condition/components/ConditionSet.vue @@ -34,7 +34,8 @@ - + @@ -58,7 +59,6 @@ export default { }, mounted() { this.conditionSetIdentifier = this.openmct.objects.makeKeyString(this.domainObject.identifier); - this.provideTelemetry(); }, beforeDestroy() { if (this.stopProvidingTelemetry) { @@ -68,13 +68,6 @@ export default { methods: { updateCurrentOutput(currentConditionResult) { this.currentConditionOutput = currentConditionResult.output; - }, - provideTelemetry() { - if (this.stopProvidingTelemetry) { - this.stopProvidingTelemetry(); - } - this.stopProvidingTelemetry = this.openmct.telemetry - .subscribe(this.domainObject, output => { this.updateCurrentOutput(output); }); } } };