2014-12-02 15:21:26 -08:00
|
|
|
/*global define,moment*/
|
2014-12-02 14:51:48 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Module defining DomainColumn. Created by vwoeltje on 11/18/14.
|
|
|
|
*/
|
|
|
|
define(
|
2014-12-02 15:21:26 -08:00
|
|
|
["../../plot/lib/moment.min"],
|
2014-12-02 14:51:48 -08:00
|
|
|
function () {
|
|
|
|
"use strict";
|
|
|
|
|
2014-12-02 15:21:26 -08:00
|
|
|
// 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";
|
|
|
|
|
2014-12-02 14:51:48 -08:00
|
|
|
/**
|
2014-12-02 15:21:26 -08:00
|
|
|
* A column which will report telemetry domain values
|
|
|
|
* (typically, timestamps.) Used by the ScrollingListController.
|
2014-12-02 14:51:48 -08:00
|
|
|
*
|
|
|
|
* @constructor
|
2014-12-02 15:21:26 -08:00
|
|
|
* @param domainMetadata an object with the machine- and human-
|
|
|
|
* readable names for this domain (in `key` and `name`
|
|
|
|
* fields, respectively.)
|
2014-12-02 14:51:48 -08:00
|
|
|
*/
|
|
|
|
function DomainColumn(domainMetadata) {
|
|
|
|
return {
|
2014-12-02 15:21:26 -08:00
|
|
|
/**
|
|
|
|
* Get the title to display in this column's header.
|
|
|
|
* @returns {string} the title to display
|
|
|
|
*/
|
2014-12-02 14:51:48 -08:00
|
|
|
getTitle: function () {
|
|
|
|
return domainMetadata.name;
|
|
|
|
},
|
2014-12-02 15:21:26 -08:00
|
|
|
/**
|
|
|
|
* Get the text to display inside a row under this
|
|
|
|
* column.
|
|
|
|
* @returns {string} the text to display
|
|
|
|
*/
|
2014-12-02 14:51:48 -08:00
|
|
|
getValue: function (domainObject, data, index) {
|
2014-12-02 15:21:26 -08:00
|
|
|
return moment.utc(data.getDomainValue(
|
2014-12-02 14:51:48 -08:00
|
|
|
index,
|
|
|
|
domainMetadata.key
|
2014-12-02 15:21:26 -08:00
|
|
|
)).format(DATE_FORMAT);
|
2014-12-02 14:51:48 -08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
return DomainColumn;
|
|
|
|
}
|
|
|
|
);
|