diff --git a/src/plugins/condition/Condition.js b/src/plugins/condition/Condition.js index 97ec1b0f6b..6179674147 100644 --- a/src/plugins/condition/Condition.js +++ b/src/plugins/condition/Condition.js @@ -73,7 +73,7 @@ export default class ConditionClass extends EventEmitter { update(newDomainObject) { this.updateTrigger(newDomainObject.configuration.trigger); - // this.updateCriteria(newDomainObject.configuration.criteria); + this.updateCriteria(newDomainObject.configuration.criteria); } updateTrigger(trigger) { @@ -84,13 +84,14 @@ export default class ConditionClass extends EventEmitter { } generateCriterion(criterionConfiguration) { + console.log('Identifier', criterionConfiguration); return { id: uuid(), telemetry: criterionConfiguration.telemetry || '', operation: criterionConfiguration.operation || '', input: criterionConfiguration.input === undefined ? [] : criterionConfiguration.input, metadata: criterionConfiguration.metadata || '', - key: criterionConfiguration.key || '' + identifier: criterionConfiguration.identifier || '' }; } @@ -187,7 +188,6 @@ export default class ConditionClass extends EventEmitter { if (found) { this.criteria[found.index] = criterion.data; //Most likely don't need this. - console.log('conditiion subscribe') this.subscribe(); this.emitEvent('conditionUpdated', { trigger: this.trigger, diff --git a/src/plugins/condition/components/Condition.vue b/src/plugins/condition/components/Condition.vue index 237ad3330a..a770edb66c 100644 --- a/src/plugins/condition/components/Condition.vue +++ b/src/plugins/condition/components/Condition.vue @@ -144,7 +144,7 @@ import Criterion from '../../condition/components/Criterion.vue'; import uuid from 'uuid'; export default { - inject: ['openmct', 'domainObject'], + inject: ['openmct'], components: { Criterion }, @@ -198,7 +198,7 @@ export default { }, updated() { //validate telemetry exists, update criteria as needed - this.persist(); + // this.persist(); }, methods: { initialize() { @@ -218,16 +218,18 @@ export default { namespace: '', key: uuid() } - } + }; this.domainObject.configuration.criteria.push(criteriaObject); }, dragStart(e) { this.$emit('set-move-index', Number(e.target.getAttribute('data-condition-index'))); }, destroy() { - // this.conditionClass.off('conditionResultUpdated', this.handleConditionResult.bind(this)); - if (this.conditionClass && typeof this.conditionClass.destroy === 'function') { - this.conditionClass.destroy(); + if (this.conditionClass) { + this.conditionClass.off('conditionResultUpdated', this.handleConditionResult.bind(this)); + if (typeof this.conditionClass.destroy === 'function') { + this.conditionClass.destroy(); + } delete this.conditionClass; } }, diff --git a/src/plugins/condition/components/Criterion.vue b/src/plugins/condition/components/Criterion.vue index 71cff9075d..5e876d441c 100644 --- a/src/plugins/condition/components/Criterion.vue +++ b/src/plugins/condition/components/Criterion.vue @@ -44,6 +44,7 @@ v-model="criterion.input" class="t-condition-name-input" type="text" + @blur="persist" > @@ -100,6 +101,7 @@ export default { this.telemetryMetadata = this.openmct.telemetry.getMetadata(telemetryObject).values(); }); } + this.persist(); }, updateOperationInputVisibility() { for (let i=0; i < this.operations.length; i++) { @@ -108,9 +110,10 @@ export default { if (!this.isInputOperation) {this.criterion.input = ''} } } + this.persist(); }, updateMetadataSelection() { - this.comparisonInputValue = ''; + this.updateOperationInputVisibility(); }, persist() { this.$emit('persist', this.criterion); diff --git a/src/plugins/condition/criterion/TelemetryCriterion.js b/src/plugins/condition/criterion/TelemetryCriterion.js index c59c756106..4392191efb 100644 --- a/src/plugins/condition/criterion/TelemetryCriterion.js +++ b/src/plugins/condition/criterion/TelemetryCriterion.js @@ -46,7 +46,7 @@ export default class TelemetryCriterion extends EventEmitter { this.subscription = null; this.telemetryMetadata = null; this.telemetryObjectIdAsString = null; - this.objectAPI.get(this.objectAPI.makeKeyString(telemetryDomainObjectDefinition.key)).then((obj) => this.initialize(obj)); + this.objectAPI.get(this.objectAPI.makeKeyString(this.telemetry)).then((obj) => this.initialize(obj)); } initialize(obj) {