mirror of
https://github.com/nasa/openmct.git
synced 2024-12-21 06:03:08 +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: [
|
||||
{
|
||||
key: "name",
|
||||
name: "Name"
|
||||
name: "Name",
|
||||
format: "string"
|
||||
},
|
||||
{
|
||||
key: "utc",
|
||||
|
@ -81,6 +81,15 @@ define([
|
||||
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) {
|
||||
|
@ -268,9 +268,7 @@ export default class ConditionManager extends EventEmitter {
|
||||
createNormalizedDatum(telemetryDatum, id) {
|
||||
return Object.values(this.telemetryObjects[id].telemetryMetaData).reduce((normalizedDatum, metadatum) => {
|
||||
const formatter = this.openmct.telemetry.getValueFormatter(metadatum);
|
||||
const data = telemetryDatum[metadatum.source];
|
||||
const parsedValue = formatter.parse(data);
|
||||
normalizedDatum[metadatum.key] = _.isNaN(parsedValue) ? data : parsedValue;
|
||||
normalizedDatum[metadatum.key] = formatter.parse(telemetryDatum[metadatum.source]);
|
||||
return normalizedDatum;
|
||||
}, {});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user