mirror of
https://github.com/nasa/openmct.git
synced 2025-03-10 22:43:55 +00:00
add condition no errors
This commit is contained in:
parent
7ac7a40b1b
commit
096d6371f1
@ -67,26 +67,21 @@
|
|||||||
:condition-index="index"
|
:condition-index="index"
|
||||||
:telemetry="telemetryObjs"
|
:telemetry="telemetryObjs"
|
||||||
@update-current-condition="updateCurrentCondition"
|
@update-current-condition="updateCurrentCondition"
|
||||||
@remove-condition="removeCondition"
|
@removeCondition="removeCondition"
|
||||||
@condition-result-updated="handleConditionResult"
|
@conditionResultUpdated="handleConditionResult"
|
||||||
@set-move-index="setMoveIndex"
|
@setMoveIndex="setMoveIndex"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<Condition :condition-identifier="conditionIdentifier"
|
<Condition :condition-identifier="conditionIdentifier"
|
||||||
:current-condition-identifier="currentConditionIdentifier"
|
:current-condition-identifier="currentConditionIdentifier"
|
||||||
@update-current-condition="updateCurrentCondition"
|
@updateCurrentCondition="updateCurrentCondition"
|
||||||
@remove-condition="removeCondition"
|
@removeCondition="removeCondition"
|
||||||
@condition-result-updated="handleConditionResult"
|
@conditionResultUpdated="handleConditionResult"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
</li>
|
||||||
<Condition :condition-identifier="conditionIdentifier"
|
</ul>
|
||||||
:current-condition-identifier="currentConditionIdentifier"
|
|
||||||
@condition-result-updated="handleConditionResult"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@ -110,6 +105,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
expanded: true,
|
expanded: true,
|
||||||
|
telemetryObjs: this.telemetryObjs,
|
||||||
parentKeyString: this.openmct.objects.makeKeyString(this.domainObject.identifier),
|
parentKeyString: this.openmct.objects.makeKeyString(this.domainObject.identifier),
|
||||||
conditionCollection: [],
|
conditionCollection: [],
|
||||||
conditions: [],
|
conditions: [],
|
||||||
@ -127,6 +123,7 @@ export default {
|
|||||||
this.instantiate = this.openmct.$injector.get('instantiate');
|
this.instantiate = this.openmct.$injector.get('instantiate');
|
||||||
this.composition = this.openmct.composition.get(this.domainObject);
|
this.composition = this.openmct.composition.get(this.domainObject);
|
||||||
this.composition.on('add', this.addTelemetry);
|
this.composition.on('add', this.addTelemetry);
|
||||||
|
this.composition.on('remove', this.removeTelemetry);
|
||||||
this.composition.load();
|
this.composition.load();
|
||||||
this.conditionCollection = this.domainObject.configuration ? this.domainObject.configuration.conditionCollection : [];
|
this.conditionCollection = this.domainObject.configuration ? this.domainObject.configuration.conditionCollection : [];
|
||||||
if (!this.conditionCollection.length) {
|
if (!this.conditionCollection.length) {
|
||||||
@ -202,6 +199,16 @@ export default {
|
|||||||
addTelemetry(telemetryDomainObject) {
|
addTelemetry(telemetryDomainObject) {
|
||||||
this.telemetryObjs.push(telemetryDomainObject);
|
this.telemetryObjs.push(telemetryDomainObject);
|
||||||
},
|
},
|
||||||
|
removeTelemetry(telemetryDomainObjectIdentifier) {
|
||||||
|
let index = _.findIndex(this.telemetryObjs, (obj) => {
|
||||||
|
let objId = this.openmct.objects.makeKeyString(obj.identifier);
|
||||||
|
let id = this.openmct.objects.makeKeyString(telemetryDomainObjectIdentifier);
|
||||||
|
return objId === id;
|
||||||
|
});
|
||||||
|
if (index > -1) {
|
||||||
|
this.telemetryObjs.splice(index, 1);
|
||||||
|
}
|
||||||
|
},
|
||||||
addCondition(event, isDefault) {
|
addCondition(event, isDefault) {
|
||||||
let conditionDomainObject = this.getConditionDomainObject(!!isDefault);
|
let conditionDomainObject = this.getConditionDomainObject(!!isDefault);
|
||||||
//persist the condition domain object so that we can do an openmct.objects.get on it and only persist the identifier in the conditionCollection of conditionSet
|
//persist the condition domain object so that we can do an openmct.objects.get on it and only persist the identifier in the conditionCollection of conditionSet
|
||||||
@ -226,8 +233,8 @@ export default {
|
|||||||
criteria: isDefault ? [] : [{
|
criteria: isDefault ? [] : [{
|
||||||
operation: '',
|
operation: '',
|
||||||
input: '',
|
input: '',
|
||||||
metaDataKey: this.openmct.telemetry.getMetadata(this.telemetryObjs[0]).values()[0].key,
|
metaDataKey: '',
|
||||||
key: this.telemetryObjs.length ? this.openmct.objects.makeKeyString(this.telemetryObjs[0].identifier) : null
|
key: ''
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
summary: 'summary description'
|
summary: 'summary description'
|
||||||
|
@ -187,6 +187,7 @@ export default {
|
|||||||
condition: this.condition,
|
condition: this.condition,
|
||||||
currentCriteria: this.currentCriteria,
|
currentCriteria: this.currentCriteria,
|
||||||
expanded: true,
|
expanded: true,
|
||||||
|
trigger: 'any',
|
||||||
telemetryObject: this.telemetryObject,
|
telemetryObject: this.telemetryObject,
|
||||||
telemetryMetadata: this.telemetryMetadata,
|
telemetryMetadata: this.telemetryMetadata,
|
||||||
operations: OPERATIONS,
|
operations: OPERATIONS,
|
||||||
@ -196,7 +197,7 @@ export default {
|
|||||||
selectedOutputKey: '',
|
selectedOutputKey: '',
|
||||||
stringOutputField: false,
|
stringOutputField: false,
|
||||||
comparisonValueField: false,
|
comparisonValueField: false,
|
||||||
operationValue: {},
|
operationValue: this.operationValue,
|
||||||
outputOptions: [
|
outputOptions: [
|
||||||
{
|
{
|
||||||
key: 'false',
|
key: 'false',
|
||||||
@ -245,18 +246,17 @@ export default {
|
|||||||
this.$emit('set-move-index', Number(e.target.getAttribute('data-condition-index')));
|
this.$emit('set-move-index', Number(e.target.getAttribute('data-condition-index')));
|
||||||
},
|
},
|
||||||
initialize() {
|
initialize() {
|
||||||
//if (!this.condition.definition.criteria.length) {
|
if (this.condition.definition.criteria.length) {
|
||||||
this.setCurrentCriterion();
|
this.setCurrentCriterion(0);
|
||||||
//}
|
|
||||||
this.setOutput();
|
this.setOutput();
|
||||||
this.setOperation();
|
this.setOperation();
|
||||||
this.updateTelemetry();
|
this.updateTelemetry();
|
||||||
this.conditionClass = new ConditionClass(this.condition, this.openmct);
|
this.conditionClass = new ConditionClass(this.condition, this.openmct);
|
||||||
this.conditionClass.on('conditionResultUpdated', this.handleConditionResult.bind(this));
|
this.conditionClass.on('conditionResultUpdated', this.handleConditionResult.bind(this));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setCurrentCriterion(index) {
|
setCurrentCriterion(index) {
|
||||||
this.currentCriteria = this.condition.definition.criteria;
|
this.currentCriteria = this.condition.definition.criteria[index];
|
||||||
console.log('setCurrentCriterion() this.currentCriteria', this.currentCriteria[0].key);
|
|
||||||
},
|
},
|
||||||
destroy() {
|
destroy() {
|
||||||
this.conditionClass.off('conditionResultUpdated', this.handleConditionResult.bind(this));
|
this.conditionClass.off('conditionResultUpdated', this.handleConditionResult.bind(this));
|
||||||
@ -321,17 +321,14 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateTelemetry() {
|
updateTelemetry() {
|
||||||
// console.log('this.hasTelemetry()', this.hasTelemetry())
|
|
||||||
if (this.hasTelemetry()) {
|
if (this.hasTelemetry()) {
|
||||||
this.openmct.objects.get(this.currentCriteria.key).then((obj) => {
|
this.openmct.objects.get(this.currentCriteria.key).then((obj) => {
|
||||||
|
console.log('this.openmct.telemetry.getMetadata(this.telemetryObject).values()', this.openmct.telemetry.getMetadata(this.telemetryObject).values());
|
||||||
this.telemetryObject = obj;
|
this.telemetryObject = obj;
|
||||||
this.telemetryMetadata[this.currentCriteria.key.key] = this.openmct.telemetry.getMetadata(this.telemetryObject).values();
|
this.telemetryMetadata[this.currentCriteria.key] = this.openmct.telemetry.getMetadata(this.telemetryObject).values();
|
||||||
this.selectedMetaDataKey[this.currentCriteria.key.key] = this.getTelemetryMetadataKey();
|
this.selectedMetaDataKey[this.currentCriteria.key] = this.getTelemetryMetadataKey();
|
||||||
this.selectedTelemetryKey[this.currentCriteria.key.key] = this.getTelemetryKey();
|
this.selectedTelemetryKey[this.currentCriteria.key] = this.getTelemetryKey();
|
||||||
// console.log('selectedTelemetryKey', this.selectedTelemetryKey);
|
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
this.telemetryObject = null;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getTelemetryMetadataKey() {
|
getTelemetryMetadataKey() {
|
||||||
@ -358,8 +355,6 @@ export default {
|
|||||||
return this.telemetry.length && index > -1 ? this.telemetry[index].identifier : '';
|
return this.telemetry.length && index > -1 ? this.telemetry[index].identifier : '';
|
||||||
},
|
},
|
||||||
hasTelemetry() {
|
hasTelemetry() {
|
||||||
// console.log('hasTelemetry() this.currentCriteria', this.currentCriteria)
|
|
||||||
// return this.currentCriteria && this.currentCriteria.key;
|
|
||||||
return this.currentCriteria && this.currentCriteria.key;
|
return this.currentCriteria && this.currentCriteria.key;
|
||||||
},
|
},
|
||||||
updateConditionCriteria() {
|
updateConditionCriteria() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user