mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 21:53:08 +00:00
Merge branch 'master' into criterion-delete
This commit is contained in:
commit
53df89aa5d
@ -105,6 +105,14 @@ export default {
|
||||
}
|
||||
},
|
||||
getCriterionDescription(criterion, index) {
|
||||
if (!criterion.telemetry) {
|
||||
let description = `Unknown ${criterion.metadata} ${this.getOperatorText(criterion.operation, criterion.input)}`;
|
||||
this.criterionDescriptions.splice(index, 0, description);
|
||||
} else if (criterion.telemetry === 'all' || criterion.telemetry === 'any') {
|
||||
const telemetryDescription = criterion.telemetry === 'all' ? 'All telemetry' : 'Any telemetry';
|
||||
let description = `${telemetryDescription} ${criterion.metadata} ${this.getOperatorText(criterion.operation, criterion.input)}`;
|
||||
this.criterionDescriptions.splice(index, 0, description);
|
||||
} else {
|
||||
this.openmct.objects.get(criterion.telemetry).then((telemetryObject) => {
|
||||
if (telemetryObject.type === 'unknown') {
|
||||
let description = `Unknown ${criterion.metadata} ${this.getOperatorText(criterion.operation, criterion.input)}`;
|
||||
@ -135,6 +143,7 @@ export default {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
getOperatorText(operationName, values) {
|
||||
const found = OPERATIONS.find((operation) => operation.name === operationName);
|
||||
|
@ -66,6 +66,13 @@ export default {
|
||||
}
|
||||
},
|
||||
getCriterionErrors(criterion, index) {
|
||||
if (!criterion.telemetry) {
|
||||
this.conditionErrors.push({
|
||||
message: ERROR.TELEMETRY_NOT_FOUND,
|
||||
additionalInfo: ''
|
||||
});
|
||||
} else {
|
||||
if (criterion.telemetry !== 'all' && criterion.telemetry !== 'any') {
|
||||
this.openmct.objects.get(criterion.telemetry).then((telemetryObject) => {
|
||||
if (telemetryObject.type === 'unknown') {
|
||||
this.conditionErrors.push({
|
||||
@ -76,5 +83,7 @@ export default {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -137,28 +137,28 @@ export default class TelemetryCriterion extends EventEmitter {
|
||||
return this.formatData({}, options.telemetryObjects);
|
||||
}
|
||||
|
||||
const telemetryRequests = options.telemetryObjects
|
||||
.map(telemetryObject => this.telemetryAPI.request(
|
||||
telemetryObject,
|
||||
let keys = Object.keys(Object.assign({}, options.telemetryObjects));
|
||||
const telemetryRequests = keys
|
||||
.map(key => this.telemetryAPI.request(
|
||||
options.telemetryObjects[key],
|
||||
options
|
||||
));
|
||||
|
||||
return Promise.all(telemetryRequests)
|
||||
.then(telemetryRequestsResults => {
|
||||
let latestDatum;
|
||||
telemetryRequestsResults.forEach((results, index) => {
|
||||
const latestDatum = results.length ? results[results.length - 1] : {};
|
||||
if (index === telemetryRequestsResults.length-1) {
|
||||
//when the last result is computed, we return the result
|
||||
return {
|
||||
id: this.id,
|
||||
data: this.formatData(latestDatum, options.telemetryObjects)
|
||||
};
|
||||
} else {
|
||||
latestDatum = results.length ? results[results.length - 1] : {};
|
||||
if (index < telemetryRequestsResults.length-1) {
|
||||
if (latestDatum) {
|
||||
this.telemetryDataCache[latestDatum.id] = this.computeResult(latestDatum);
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
id: this.id,
|
||||
data: this.formatData(latestDatum, options.telemetryObjects)
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user