mirror of
https://github.com/nasa/openmct.git
synced 2025-06-23 01:18:57 +00:00
new-plot import (#1557)
Merge of new plot * Introduces new Plot object and view * Removes Old Plot * Add LAD support and state type to generators * Removes Telemetry Panel Type * Telemetry API Updates * UTCFormat.parse: passthrough numbers * TelemetryAPI: default request arguments * TelemetryAPI: fix enum formatting * Markup and styling to support new plots
This commit is contained in:
committed by
Andrew Henry
parent
6145843e86
commit
5726fe6313
@ -49,7 +49,7 @@ define([
|
||||
this.formatter = numberFormatter;
|
||||
}
|
||||
|
||||
if (valueMetadata.type === 'enum') {
|
||||
if (valueMetadata.format === 'enum') {
|
||||
this.formatter = {};
|
||||
this.enumerations = valueMetadata.enumerations.reduce(function (vm, e) {
|
||||
vm.byValue[e.value] = e.string;
|
||||
@ -57,11 +57,16 @@ define([
|
||||
return vm;
|
||||
}, {byValue: {}, byString: {}});
|
||||
this.formatter.format = function (value) {
|
||||
return this.enumerations.byValue[value];
|
||||
if (typeof value === "number") {
|
||||
return this.enumerations.byValue[value] || value;
|
||||
}
|
||||
return value;
|
||||
}.bind(this);
|
||||
this.formatter.parse = function (string) {
|
||||
if (typeof string === "string" && this.enumerations.hasOwnProperty(string)) {
|
||||
return this.enumerations.byString[string];
|
||||
if (typeof string === "string") {
|
||||
if (this.enumerations.byString.hasOwnProperty(string)) {
|
||||
return this.enumerations.byString[string];
|
||||
}
|
||||
}
|
||||
return Number(string);
|
||||
}.bind(this);
|
||||
|
Reference in New Issue
Block a user