mirror of
https://github.com/nasa/openmct.git
synced 2024-12-21 14:07:50 +00:00
Adds parse treatment for string format.
Adds format property to sine wave generator's name metadata
This commit is contained in:
parent
6f500d0d0b
commit
dc7f83754a
@ -9,7 +9,8 @@ define([
|
|||||||
values: [
|
values: [
|
||||||
{
|
{
|
||||||
key: "name",
|
key: "name",
|
||||||
name: "Name"
|
name: "Name",
|
||||||
|
format: "string"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "utc",
|
key: "utc",
|
||||||
|
@ -81,6 +81,15 @@ define([
|
|||||||
return printj.sprintf(formatString, baseFormat.call(this, value));
|
return printj.sprintf(formatString, baseFormat.call(this, value));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if (valueMetadata.format === 'string') {
|
||||||
|
this.formatter.parse = function (value) {
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
return value;
|
||||||
|
} else {
|
||||||
|
return value.toString();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TelemetryValueFormatter.prototype.parse = function (datum) {
|
TelemetryValueFormatter.prototype.parse = function (datum) {
|
||||||
|
@ -268,9 +268,7 @@ export default class ConditionManager extends EventEmitter {
|
|||||||
createNormalizedDatum(telemetryDatum, id) {
|
createNormalizedDatum(telemetryDatum, id) {
|
||||||
return Object.values(this.telemetryObjects[id].telemetryMetaData).reduce((normalizedDatum, metadatum) => {
|
return Object.values(this.telemetryObjects[id].telemetryMetaData).reduce((normalizedDatum, metadatum) => {
|
||||||
const formatter = this.openmct.telemetry.getValueFormatter(metadatum);
|
const formatter = this.openmct.telemetry.getValueFormatter(metadatum);
|
||||||
const data = telemetryDatum[metadatum.source];
|
normalizedDatum[metadatum.key] = formatter.parse(telemetryDatum[metadatum.source]);
|
||||||
const parsedValue = formatter.parse(data);
|
|
||||||
normalizedDatum[metadatum.key] = _.isNaN(parsedValue) ? data : parsedValue;
|
|
||||||
return normalizedDatum;
|
return normalizedDatum;
|
||||||
}, {});
|
}, {});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user