mirror of
https://github.com/nasa/openmct.git
synced 2025-01-02 19:36:41 +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');
|
this.emit('requestStarted');
|
||||||
const modifiedOptions = await this.openmct.telemetry.applyRequestInterceptors(this.domainObject, options);
|
const modifiedOptions = await this.openmct.telemetry.applyRequestInterceptors(this.domainObject, options);
|
||||||
historicalData = await historicalProvider.request(this.domainObject, modifiedOptions);
|
historicalData = await historicalProvider.request(this.domainObject, modifiedOptions);
|
||||||
if (!historicalData || !historicalData.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.name !== 'AbortError') {
|
if (error.name !== 'AbortError') {
|
||||||
console.error('Error requesting telemetry data...');
|
console.error('Error requesting telemetry data...');
|
||||||
@ -143,6 +140,10 @@ export default class TelemetryCollection extends EventEmitter {
|
|||||||
this.emit('requestEnded');
|
this.emit('requestEnded');
|
||||||
this.requestAbort = undefined;
|
this.requestAbort = undefined;
|
||||||
|
|
||||||
|
if (!historicalData || !historicalData.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this._processNewTelemetry(historicalData);
|
this._processNewTelemetry(historicalData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -121,8 +121,9 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
TelemetryValueFormatter.prototype.parse = function (datum) {
|
TelemetryValueFormatter.prototype.parse = function (datum) {
|
||||||
|
const isDatumArray = Array.isArray(datum);
|
||||||
if (_.isObject(datum)) {
|
if (_.isObject(datum)) {
|
||||||
const objectDatum = datum[this.valueMetadata.source];
|
const objectDatum = isDatumArray ? datum : datum[this.valueMetadata.source];
|
||||||
if (Array.isArray(objectDatum)) {
|
if (Array.isArray(objectDatum)) {
|
||||||
return objectDatum.map((item) => {
|
return objectDatum.map((item) => {
|
||||||
return this.formatter.parse(item);
|
return this.formatter.parse(item);
|
||||||
@ -136,8 +137,9 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
TelemetryValueFormatter.prototype.format = function (datum) {
|
TelemetryValueFormatter.prototype.format = function (datum) {
|
||||||
|
const isDatumArray = Array.isArray(datum);
|
||||||
if (_.isObject(datum)) {
|
if (_.isObject(datum)) {
|
||||||
const objectDatum = datum[this.valueMetadata.source];
|
const objectDatum = isDatumArray ? datum : datum[this.valueMetadata.source];
|
||||||
if (Array.isArray(objectDatum)) {
|
if (Array.isArray(objectDatum)) {
|
||||||
return objectDatum.map((item) => {
|
return objectDatum.map((item) => {
|
||||||
return this.formatter.format(item);
|
return this.formatter.format(item);
|
||||||
|
Loading…
Reference in New Issue
Block a user