mirror of
https://github.com/nasa/openmct.git
synced 2025-02-21 09:52:04 +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",
|
"key": "utc",
|
||||||
"implementation": "UTCTimeFormat.js"
|
"implementation": "UTCTimeFormat.js"
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"constants": [
|
||||||
|
{
|
||||||
|
"key": "DEFAULT_TIME_FORMAT",
|
||||||
|
"value": "utc"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
{
|
{
|
||||||
"key": "telemetryFormatter",
|
"key": "telemetryFormatter",
|
||||||
"implementation": "TelemetryFormatter.js",
|
"implementation": "TelemetryFormatter.js",
|
||||||
"depends": [ "formatService" ]
|
"depends": [ "formatService", "DEFAULT_TIME_FORMAT", "$log" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "telemetrySubscriber",
|
"key": "telemetrySubscriber",
|
||||||
|
@ -37,8 +37,10 @@ define(
|
|||||||
* @memberof platform/telemetry
|
* @memberof platform/telemetry
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function TelemetryFormatter(formatService) {
|
function TelemetryFormatter(formatService, defaultFormatKey, $log) {
|
||||||
this.formatService = formatService;
|
this.formatService = formatService;
|
||||||
|
this.defaultFormat = formatService.getFormat(defaultFormatKey);
|
||||||
|
this.$log = $log;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,9 +53,11 @@ define(
|
|||||||
* data and time, suitable for display.
|
* data and time, suitable for display.
|
||||||
*/
|
*/
|
||||||
TelemetryFormatter.prototype.formatDomainValue = function (v, key) {
|
TelemetryFormatter.prototype.formatDomainValue = function (v, key) {
|
||||||
var formatter = this.formatService.getFormat(key) ||
|
var formatter = (key === undefined) ?
|
||||||
this.formatService.getFormat('utc');
|
this.defaultFormat :
|
||||||
return isNaN(v) ? "" : formatter.format(v);
|
this.formatService.getFormat(key);
|
||||||
|
|
||||||
|
return isNaN(v) ? "" : formatter ? formatter.format(v) : String(v);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user