mirror of
https://github.com/nasa/openmct.git
synced 2024-12-21 14:07:50 +00:00
Ensure that datum that is of type array is formatted as such (#6467)
* Ensure that datum that is of type array is formatted as such * Ensure the requestEnded event is emitted even when historicalData is empty.
This commit is contained in:
parent
a3c5450205
commit
1b7fb9b952
@ -130,9 +130,6 @@ export default class TelemetryCollection extends EventEmitter {
|
||||
this.emit('requestStarted');
|
||||
const modifiedOptions = await this.openmct.telemetry.applyRequestInterceptors(this.domainObject, options);
|
||||
historicalData = await historicalProvider.request(this.domainObject, modifiedOptions);
|
||||
if (!historicalData || !historicalData.length) {
|
||||
return;
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.name !== 'AbortError') {
|
||||
console.error('Error requesting telemetry data...');
|
||||
@ -143,6 +140,10 @@ export default class TelemetryCollection extends EventEmitter {
|
||||
this.emit('requestEnded');
|
||||
this.requestAbort = undefined;
|
||||
|
||||
if (!historicalData || !historicalData.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._processNewTelemetry(historicalData);
|
||||
|
||||
}
|
||||
|
@ -121,8 +121,9 @@ define([
|
||||
}
|
||||
|
||||
TelemetryValueFormatter.prototype.parse = function (datum) {
|
||||
const isDatumArray = Array.isArray(datum);
|
||||
if (_.isObject(datum)) {
|
||||
const objectDatum = datum[this.valueMetadata.source];
|
||||
const objectDatum = isDatumArray ? datum : datum[this.valueMetadata.source];
|
||||
if (Array.isArray(objectDatum)) {
|
||||
return objectDatum.map((item) => {
|
||||
return this.formatter.parse(item);
|
||||
@ -136,8 +137,9 @@ define([
|
||||
};
|
||||
|
||||
TelemetryValueFormatter.prototype.format = function (datum) {
|
||||
const isDatumArray = Array.isArray(datum);
|
||||
if (_.isObject(datum)) {
|
||||
const objectDatum = datum[this.valueMetadata.source];
|
||||
const objectDatum = isDatumArray ? datum : datum[this.valueMetadata.source];
|
||||
if (Array.isArray(objectDatum)) {
|
||||
return objectDatum.map((item) => {
|
||||
return this.formatter.format(item);
|
||||
|
Loading…
Reference in New Issue
Block a user