[Tables] #733 Made code style changes for conformance with style guide
This commit is contained in:
@@ -47,7 +47,7 @@ define(
|
||||
* @param metadata Metadata describing the domains and ranges available
|
||||
* @returns {TableConfiguration} This object
|
||||
*/
|
||||
TableConfiguration.prototype.buildColumns = function(metadata) {
|
||||
TableConfiguration.prototype.buildColumns = function (metadata) {
|
||||
var self = this;
|
||||
|
||||
this.columns = [];
|
||||
@@ -57,10 +57,12 @@ define(
|
||||
metadata.forEach(function (metadatum) {
|
||||
//Push domains first
|
||||
(metadatum.domains || []).forEach(function (domainMetadata) {
|
||||
self.addColumn(new DomainColumn(domainMetadata, self.telemetryFormatter));
|
||||
self.addColumn(new DomainColumn(domainMetadata,
|
||||
self.telemetryFormatter));
|
||||
});
|
||||
(metadatum.ranges || []).forEach(function (rangeMetadata) {
|
||||
self.addColumn(new RangeColumn(rangeMetadata, self.telemetryFormatter));
|
||||
self.addColumn(new RangeColumn(rangeMetadata,
|
||||
self.telemetryFormatter));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -98,7 +100,7 @@ define(
|
||||
* Get a simple list of column titles
|
||||
* @returns {Array} The titles of the columns
|
||||
*/
|
||||
TableConfiguration.prototype.getHeaders = function() {
|
||||
TableConfiguration.prototype.getHeaders = function () {
|
||||
var self = this;
|
||||
return this.columns.map(function (column, i){
|
||||
return self.getColumnTitle(column) || 'Column ' + (i + 1);
|
||||
@@ -113,9 +115,9 @@ define(
|
||||
* @returns {Object} Key value pairs where the key is the column
|
||||
* title, and the value is the formatted value from the provided datum.
|
||||
*/
|
||||
TableConfiguration.prototype.getRowValues = function(telemetryObject, datum) {
|
||||
TableConfiguration.prototype.getRowValues = function (telemetryObject, datum) {
|
||||
var self = this;
|
||||
return this.columns.reduce(function(rowObject, column, i){
|
||||
return this.columns.reduce(function (rowObject, column, i){
|
||||
var columnTitle = self.getColumnTitle(column) || 'Column ' + (i + 1),
|
||||
columnValue = column.getValue(telemetryObject, datum);
|
||||
|
||||
@@ -125,7 +127,9 @@ define(
|
||||
// Don't replace something with nothing.
|
||||
// This occurs when there are multiple columns with the
|
||||
// column title
|
||||
if (rowObject[columnTitle] === undefined || rowObject[columnTitle].text === undefined || rowObject[columnTitle].text.length === 0) {
|
||||
if (rowObject[columnTitle] === undefined ||
|
||||
rowObject[columnTitle].text === undefined ||
|
||||
rowObject[columnTitle].text.length === 0) {
|
||||
rowObject[columnTitle] = columnValue;
|
||||
}
|
||||
return rowObject;
|
||||
@@ -136,7 +140,8 @@ define(
|
||||
* @private
|
||||
*/
|
||||
TableConfiguration.prototype.defaultColumnConfiguration = function () {
|
||||
return ((this.domainObject.getModel().configuration || {}).table || {}).columns || {};
|
||||
return ((this.domainObject.getModel().configuration || {}).table ||
|
||||
{}).columns || {};
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -158,7 +163,7 @@ define(
|
||||
* pairs where the key is the column title, and the value is a
|
||||
* boolean indicating whether the column should be shown.
|
||||
*/
|
||||
TableConfiguration.prototype.getColumnConfiguration = function() {
|
||||
TableConfiguration.prototype.getColumnConfiguration = function () {
|
||||
var configuration = {},
|
||||
//Use existing persisted config, or default it
|
||||
defaultConfig = this.defaultColumnConfiguration();
|
||||
@@ -168,8 +173,10 @@ define(
|
||||
* specifying whether the column is visible or not. Default to
|
||||
* existing (persisted) configuration if available
|
||||
*/
|
||||
this.getHeaders().forEach(function(columnTitle) {
|
||||
configuration[columnTitle] = typeof defaultConfig[columnTitle] === 'undefined' ? true : defaultConfig[columnTitle];
|
||||
this.getHeaders().forEach(function (columnTitle) {
|
||||
configuration[columnTitle] =
|
||||
typeof defaultConfig[columnTitle] === 'undefined' ? true :
|
||||
defaultConfig[columnTitle];
|
||||
});
|
||||
|
||||
return configuration;
|
||||
|
||||
Reference in New Issue
Block a user