mirror of
https://github.com/nasa/openmct.git
synced 2025-01-29 15:43:52 +00:00
Handle string states (#2019)
* State generator realtime uses strings Change the state generator's realtime data to return string values instead of number values. This exercises an edge case where enumerations could be a string instead of a number. Exposes #2018. * [Telemetry] handle string enumeration value Don't treat all strings as properly formatted enumeration values. Instead, check any input value against known enumerations and if one matches, return it. Otherwise, return input. Fixes #2018
This commit is contained in:
parent
ec8b4db2e5
commit
865b99f445
@ -47,7 +47,9 @@ define([
|
||||
|
||||
var interval = setInterval(function () {
|
||||
var now = Date.now();
|
||||
callback(pointForTimestamp(now, duration, domainObject.name));
|
||||
var datum = pointForTimestamp(now, duration, domainObject.name);
|
||||
datum.value += "";
|
||||
callback(datum);
|
||||
}, duration);
|
||||
|
||||
return function () {
|
||||
|
@ -57,8 +57,8 @@ define([
|
||||
return vm;
|
||||
}, {byValue: {}, byString: {}});
|
||||
this.formatter.format = function (value) {
|
||||
if (typeof value === "number") {
|
||||
return this.enumerations.byValue[value] || value;
|
||||
if (this.enumerations.byValue.hasOwnProperty(value)) {
|
||||
return this.enumerations.byValue[value];
|
||||
}
|
||||
return value;
|
||||
}.bind(this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user