From 4a39ddf42552d4ca45981273693d5f967ae54146 Mon Sep 17 00:00:00 2001 From: Shefali Joshi Date: Thu, 16 Apr 2020 15:01:14 -0700 Subject: [PATCH] Check for any and all criteria (#2948) --- src/plugins/condition/ConditionManager.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/plugins/condition/ConditionManager.js b/src/plugins/condition/ConditionManager.js index e29e9d3ffd..ee8c9cc10e 100644 --- a/src/plugins/condition/ConditionManager.js +++ b/src/plugins/condition/ConditionManager.js @@ -90,15 +90,18 @@ export default class ConditionManager extends EventEmitter { 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; + const isAnyAllTelemetry = criterion.telemetry && (criterion.telemetry === 'any' || criterion.telemetry === 'all'); + if (!isAnyAllTelemetry) { + 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; + } } }); });