mirror of
https://github.com/nasa/openmct.git
synced 2025-02-20 09:26:45 +00:00
[Time Conductor] Use default format
...from TelemetryFormatter, and log when a requested format is unavailable.
This commit is contained in:
parent
6db7f056dc
commit
4f9a65a5fe
@ -15,6 +15,12 @@
|
||||
"key": "utc",
|
||||
"implementation": "UTCTimeFormat.js"
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
{
|
||||
"key": "DEFAULT_TIME_FORMAT",
|
||||
"value": "utc"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@
|
||||
{
|
||||
"key": "telemetryFormatter",
|
||||
"implementation": "TelemetryFormatter.js",
|
||||
"depends": [ "formatService" ]
|
||||
"depends": [ "formatService", "DEFAULT_TIME_FORMAT", "$log" ]
|
||||
},
|
||||
{
|
||||
"key": "telemetrySubscriber",
|
||||
|
@ -37,8 +37,10 @@ define(
|
||||
* @memberof platform/telemetry
|
||||
* @constructor
|
||||
*/
|
||||
function TelemetryFormatter(formatService) {
|
||||
function TelemetryFormatter(formatService, defaultFormatKey, $log) {
|
||||
this.formatService = formatService;
|
||||
this.defaultFormat = formatService.getFormat(defaultFormatKey);
|
||||
this.$log = $log;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -51,9 +53,11 @@ define(
|
||||
* data and time, suitable for display.
|
||||
*/
|
||||
TelemetryFormatter.prototype.formatDomainValue = function (v, key) {
|
||||
var formatter = this.formatService.getFormat(key) ||
|
||||
this.formatService.getFormat('utc');
|
||||
return isNaN(v) ? "" : formatter.format(v);
|
||||
var formatter = (key === undefined) ?
|
||||
this.defaultFormat :
|
||||
this.formatService.getFormat(key);
|
||||
|
||||
return isNaN(v) ? "" : formatter ? formatter.format(v) : String(v);
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user