mirror of
https://github.com/nasa/openmct.git
synced 2025-06-19 23:53:49 +00:00
[Telemetry] Use telemetryFormatter in scrolling list
Use the injected telemetryFormatter in scrolling list views, instead of replicating this functionality. WTD-599.
This commit is contained in:
@ -4,14 +4,10 @@
|
||||
* Module defining DomainColumn. Created by vwoeltje on 11/18/14.
|
||||
*/
|
||||
define(
|
||||
["../../plot/lib/moment.min"],
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
// Date format to use for domain values; in particular,
|
||||
// use day-of-year instead of month/day
|
||||
var DATE_FORMAT = "YYYY-DDD HH:mm:ss";
|
||||
|
||||
/**
|
||||
* A column which will report telemetry domain values
|
||||
* (typically, timestamps.) Used by the ScrollingListController.
|
||||
@ -20,8 +16,10 @@ define(
|
||||
* @param domainMetadata an object with the machine- and human-
|
||||
* readable names for this domain (in `key` and `name`
|
||||
* fields, respectively.)
|
||||
* @param {TelemetryFormatter} telemetryFormatter the telemetry
|
||||
* formatting service, for making values human-readable.
|
||||
*/
|
||||
function DomainColumn(domainMetadata) {
|
||||
function DomainColumn(domainMetadata, telemetryFormatter) {
|
||||
return {
|
||||
/**
|
||||
* Get the title to display in this column's header.
|
||||
@ -36,10 +34,9 @@ define(
|
||||
* @returns {string} the text to display
|
||||
*/
|
||||
getValue: function (domainObject, data, index) {
|
||||
return moment.utc(data.getDomainValue(
|
||||
index,
|
||||
domainMetadata.key
|
||||
)).format(DATE_FORMAT);
|
||||
return telemetryFormatter.formatDomainValue(
|
||||
data.getDomainValue(index, domainMetadata.key)
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user