mirror of
https://github.com/nasa/openmct.git
synced 2025-02-24 10:45:02 +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.timeAPI = this.openmct.time;
|
||||||
this.latestTimestamp = {};
|
this.latestTimestamp = {};
|
||||||
this.initialize();
|
this.initialize();
|
||||||
|
|
||||||
|
this.stopObservingForChanges = this.openmct.objects.observe(this.conditionSetDomainObject, '*', (newDomainObject) => {
|
||||||
|
this.update(newDomainObject);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
initialize() {
|
initialize() {
|
||||||
@ -48,6 +52,9 @@ export default class ConditionManager extends EventEmitter {
|
|||||||
update(newDomainObject) {
|
update(newDomainObject) {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
this.conditionSetDomainObject = newDomainObject;
|
this.conditionSetDomainObject = newDomainObject;
|
||||||
|
this.stopObservingForChanges = this.openmct.objects.observe(this.conditionSetDomainObject, '*', (newDO) => {
|
||||||
|
this.update(newDO);
|
||||||
|
});
|
||||||
this.initialize();
|
this.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,6 +225,9 @@ export default class ConditionManager extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
|
if(this.stopObservingForChanges) {
|
||||||
|
this.stopObservingForChanges();
|
||||||
|
}
|
||||||
this.conditionClassCollection.forEach((condition) => {
|
this.conditionClassCollection.forEach((condition) => {
|
||||||
condition.off('conditionResultUpdated', this.handleConditionResult);
|
condition.off('conditionResultUpdated', this.handleConditionResult);
|
||||||
condition.destroy();
|
condition.destroy();
|
||||||
|
@ -43,16 +43,9 @@ export default class ConditionSetTelemetryProvider {
|
|||||||
let conditionManager = new ConditionManager(domainObject, this.openmct);
|
let conditionManager = new ConditionManager(domainObject, this.openmct);
|
||||||
conditionManager.on('conditionSetResultUpdated', callback);
|
conditionManager.on('conditionSetResultUpdated', callback);
|
||||||
|
|
||||||
let stopObservingForChanges = this.openmct.objects.observe(domainObject, '*', (newDomainObject) => {
|
|
||||||
conditionManager.update(newDomainObject);
|
|
||||||
});
|
|
||||||
|
|
||||||
return function unsubscribe() {
|
return function unsubscribe() {
|
||||||
conditionManager.off('conditionSetResultUpdated');
|
conditionManager.off('conditionSetResultUpdated');
|
||||||
conditionManager.destroy();
|
conditionManager.destroy();
|
||||||
if (stopObservingForChanges) {
|
|
||||||
stopObservingForChanges();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
<input v-model="criterion.input[inputIndex]"
|
<input v-model="criterion.input[inputIndex]"
|
||||||
class="c-cdef__control__input"
|
class="c-cdef__control__input"
|
||||||
type="text"
|
type="text"
|
||||||
@blur="persist"
|
@change="persist"
|
||||||
>
|
>
|
||||||
<span v-if="inputIndex < inputCount-1">and</span>
|
<span v-if="inputIndex < inputCount-1">and</span>
|
||||||
</span>
|
</span>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user