From 502d29dd250da558c4a4966a2e7fce7f1b23d3e0 Mon Sep 17 00:00:00 2001 From: Joshi Date: Thu, 26 Mar 2020 16:44:44 -0700 Subject: [PATCH] Add all and any options for telemetry --- src/plugins/condition/Condition.js | 8 +- .../condition/components/Criterion.vue | 102 +++++++++++------- .../criterion/AllTelemetryCriterion.js | 43 ++++---- 3 files changed, 95 insertions(+), 58 deletions(-) diff --git a/src/plugins/condition/Condition.js b/src/plugins/condition/Condition.js index 3eaa568add..79f8133512 100644 --- a/src/plugins/condition/Condition.js +++ b/src/plugins/condition/Condition.js @@ -25,6 +25,7 @@ import uuid from 'uuid'; import TelemetryCriterion from "./criterion/TelemetryCriterion"; import { TRIGGER } from "./utils/constants"; import {computeCondition} from "./utils/evaluator"; +import AllTelemetryCriterion from "@/plugins/condition/criterion/AllTelemetryCriterion"; /* * conditionConfiguration = { @@ -124,8 +125,13 @@ export default class ConditionClass extends EventEmitter { * adds criterion to the condition. */ addCriterion(criterionConfiguration) { + let criterion; let criterionConfigurationWithId = this.generateCriterion(criterionConfiguration || null); - let criterion = new TelemetryCriterion(criterionConfigurationWithId, this.openmct); + if (criterionConfiguration.telemetry && (criterionConfiguration.telemetry === 'any' || criterionConfiguration.telemetry === 'all')) { + criterion = new AllTelemetryCriterion(criterionConfigurationWithId, this.openmct); + } else { + criterion = new TelemetryCriterion(criterionConfigurationWithId, this.openmct); + } criterion.on('criterionUpdated', (obj) => this.handleCriterionUpdated(obj)); criterion.on('criterionResultUpdated', (obj) => this.handleCriterionResult(obj)); if (!this.criteria) { diff --git a/src/plugins/condition/components/Criterion.vue b/src/plugins/condition/components/Criterion.vue index e5fc6ab15d..dd76bc4df9 100644 --- a/src/plugins/condition/components/Criterion.vue +++ b/src/plugins/condition/components/Criterion.vue @@ -9,6 +9,8 @@ @change="updateMetadataOptions" > + +