[Tables] #733 Made code style changes for conformance with style guide

This commit is contained in:
Henry
2016-03-14 11:25:26 -07:00
parent c5de90a951
commit fc08df4f6f
7 changed files with 122 additions and 92 deletions

View File

@ -54,7 +54,8 @@ define(
this.handle = undefined;
//this.pending = false;
this.telemetryHandler = telemetryHandler;
this.table = new TableConfiguration($scope.domainObject, telemetryFormatter);
this.table = new TableConfiguration($scope.domainObject,
telemetryFormatter);
this.changeListeners = [];
$scope.rows = undefined;
@ -77,17 +78,19 @@ define(
* available in order to avoid race conditions
* @private
*/
TelemetryTableController.prototype.registerChangeListeners = function() {
TelemetryTableController.prototype.registerChangeListeners = function () {
this.changeListeners.forEach(function (listener) {
return listener && listener();
});
this.changeListeners = [];
// When composition changes, re-subscribe to the various
// telemetry subscriptions
this.changeListeners.push(this.$scope.$watchCollection('domainObject.getModel().composition', this.subscribe.bind(this)));
this.changeListeners.push(this.$scope.$watchCollection(
'domainObject.getModel().composition', this.subscribe.bind(this)));
//Change of bounds in time conductor
this.changeListeners.push(this.$scope.$on('telemetry:display:bounds', this.subscribe.bind(this)));
this.changeListeners.push(this.$scope.$on('telemetry:display:bounds',
this.subscribe.bind(this)));
};
/**
@ -105,7 +108,7 @@ define(
change default behaviour (which is to retrieve historical telemetry
only).
*/
TelemetryTableController.prototype.subscribe = function() {
TelemetryTableController.prototype.subscribe = function () {
var self = this;
if (this.handle) {
@ -131,17 +134,18 @@ define(
* Populates historical data on scope when it becomes available
* @private
*/
TelemetryTableController.prototype.addHistoricalData = function() {
TelemetryTableController.prototype.addHistoricalData = function () {
var rowData = [],
self = this;
this.handle.getTelemetryObjects().forEach(function(telemetryObject){
this.handle.getTelemetryObjects().forEach(function (telemetryObject){
var series = self.handle.getSeries(telemetryObject) || {},
pointCount = series.getPointCount ? series.getPointCount() : 0,
i = 0;
for (; i < pointCount; i++) {
rowData.push(self.table.getRowValues(telemetryObject, self.handle.makeDatum(telemetryObject, series, i)));
rowData.push(self.table.getRowValues(telemetryObject,
self.handle.makeDatum(telemetryObject, series, i)));
}
});
@ -151,13 +155,13 @@ define(
/**
* Setup table columns based on domain object metadata
*/
TelemetryTableController.prototype.setup = function() {
TelemetryTableController.prototype.setup = function () {
var handle = this.handle,
table = this.table,
self = this;
if (handle) {
handle.promiseTelemetryObjects().then(function (objects) {
handle.promiseTelemetryObjects().then(function () {
table.buildColumns(handle.getMetadata());
self.filterColumns();
@ -193,7 +197,7 @@ define(
this.table.saveColumnConfiguration(columnConfig);
}
//Populate headers with visible columns (determined by configuration)
this.$scope.headers = Object.keys(columnConfig).filter(function(column) {
this.$scope.headers = Object.keys(columnConfig).filter(function (column) {
return columnConfig[column];
});
};