mirror of
https://github.com/nasa/openmct.git
synced 2025-02-24 02:41:25 +00:00
[Conditions] ConditionManager should observe its own mutations (#2748)
* change blur listener to change listener to watch for immediate updates to input * move observe ConditionManager logic into ConditionManager
This commit is contained in:
parent
83c648cc26
commit
41c79c6032
@ -32,6 +32,10 @@ export default class ConditionManager extends EventEmitter {
|
||||
this.timeAPI = this.openmct.time;
|
||||
this.latestTimestamp = {};
|
||||
this.initialize();
|
||||
|
||||
this.stopObservingForChanges = this.openmct.objects.observe(this.conditionSetDomainObject, '*', (newDomainObject) => {
|
||||
this.update(newDomainObject);
|
||||
});
|
||||
}
|
||||
|
||||
initialize() {
|
||||
@ -48,6 +52,9 @@ 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();
|
||||
}
|
||||
|
||||
@ -218,6 +225,9 @@ export default class ConditionManager extends EventEmitter {
|
||||
}
|
||||
|
||||
destroy() {
|
||||
if(this.stopObservingForChanges) {
|
||||
this.stopObservingForChanges();
|
||||
}
|
||||
this.conditionClassCollection.forEach((condition) => {
|
||||
condition.off('conditionResultUpdated', this.handleConditionResult);
|
||||
condition.destroy();
|
||||
|
@ -43,16 +43,9 @@ export default class ConditionSetTelemetryProvider {
|
||||
let conditionManager = new ConditionManager(domainObject, this.openmct);
|
||||
conditionManager.on('conditionSetResultUpdated', callback);
|
||||
|
||||
let stopObservingForChanges = this.openmct.objects.observe(domainObject, '*', (newDomainObject) => {
|
||||
conditionManager.update(newDomainObject);
|
||||
});
|
||||
|
||||
return function unsubscribe() {
|
||||
conditionManager.off('conditionSetResultUpdated');
|
||||
conditionManager.destroy();
|
||||
if (stopObservingForChanges) {
|
||||
stopObservingForChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@
|
||||
<input v-model="criterion.input[inputIndex]"
|
||||
class="c-cdef__control__input"
|
||||
type="text"
|
||||
@blur="persist"
|
||||
@change="persist"
|
||||
>
|
||||
<span v-if="inputIndex < inputCount-1">and</span>
|
||||
</span>
|
||||
|
Loading…
x
Reference in New Issue
Block a user