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-24 11:23:59 -08:00
|
|
|
[],
|
2014-12-02 14:51:48 -08:00
|
|
|
function () {
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
/**
|
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-24 11:23:59 -08:00
|
|
|
* @param {TelemetryFormatter} telemetryFormatter the telemetry
|
|
|
|
* formatting service, for making values human-readable.
|
2014-12-02 14:51:48 -08:00
|
|
|
*/
|
2014-12-24 11:23:59 -08:00
|
|
|
function DomainColumn(domainMetadata, telemetryFormatter) {
|
2014-12-02 14:51:48 -08:00
|
|
|
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-24 11:23:59 -08:00
|
|
|
return telemetryFormatter.formatDomainValue(
|
|
|
|
data.getDomainValue(index, domainMetadata.key)
|
|
|
|
);
|
2014-12-02 14:51:48 -08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
return DomainColumn;
|
|
|
|
}
|
|
|
|
);
|