mirror of
https://github.com/nasa/openmct.git
synced 2025-01-18 18:57:01 +00:00
Remove telemetry from criteria when not editing a condition set (#2933)
This commit is contained in:
parent
7dd81beb03
commit
83c273b976
@ -70,7 +70,7 @@ export default class ConditionManager extends EventEmitter {
|
||||
this.subscriptions[id]();
|
||||
delete this.subscriptions[id];
|
||||
delete this.telemetryObjects[id];
|
||||
this.updateConditionTelemetry();
|
||||
this.removeConditionTelemetry();
|
||||
}
|
||||
|
||||
initialize() {
|
||||
@ -86,6 +86,27 @@ export default class ConditionManager extends EventEmitter {
|
||||
this.conditionClassCollection.forEach((condition) => condition.updateTelemetry());
|
||||
}
|
||||
|
||||
removeConditionTelemetry() {
|
||||
let conditionsChanged = false;
|
||||
this.conditionSetDomainObject.configuration.conditionCollection.forEach((conditionConfiguration) => {
|
||||
conditionConfiguration.configuration.criteria.forEach((criterion, index) => {
|
||||
const found = Object.values(this.telemetryObjects).find((telemetryObject) => {
|
||||
return this.openmct.objects.areIdsEqual(telemetryObject.identifier, criterion.telemetry);
|
||||
});
|
||||
if (!found) {
|
||||
criterion.telemetry = '';
|
||||
criterion.metadata = '';
|
||||
criterion.input = [];
|
||||
criterion.operation = '';
|
||||
conditionsChanged = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
if (conditionsChanged) {
|
||||
this.persistConditions();
|
||||
}
|
||||
}
|
||||
|
||||
updateCondition(conditionConfiguration, index) {
|
||||
let condition = this.conditionClassCollection[index];
|
||||
condition.update(conditionConfiguration);
|
||||
|
Loading…
Reference in New Issue
Block a user