Fixing condition output

This commit is contained in:
Joshi 2020-02-18 16:04:14 -08:00
parent dc08877bbb
commit f4468a8233
4 changed files with 16 additions and 11 deletions
src/plugins/condition

View File

@ -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,

View File

@ -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;
}
},

View File

@ -44,6 +44,7 @@
v-model="criterion.input"
class="t-condition-name-input"
type="text"
@blur="persist"
>
</span>
</span>
@ -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);

View File

@ -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) {