From 7af5875dd523b01dc8e205761577d5454ed8751f Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 6 Sep 2016 10:04:29 -0700 Subject: [PATCH] [Time Conductor] #933 Fixed code style errors --- .../commonUI/formats/src/UTCTimeFormat.js | 34 ++++++++---- .../src/ConductorTelemetryDecorator.js | 2 +- .../conductor/src/TimeConductor.js | 2 +- .../conductor/src/timeSystems/LocalClock.js | 6 +-- .../conductor/src/timeSystems/TickSource.js | 2 +- .../conductor/src/timeSystems/TimeSystem.js | 3 +- .../conductor/src/ui/MctConductorAxis.js | 4 +- .../conductor/src/ui/MctConductorAxisSpec.js | 4 +- .../conductor/src/ui/NumberFormat.js | 2 +- .../conductor/src/ui/NumberFormatSpec.js | 4 +- .../src/ui/TimeConductorController.js | 19 +++---- .../src/ui/TimeConductorControllerSpec.js | 12 ++--- .../conductor/src/ui/TimeConductorMode.js | 52 +++++++++---------- .../conductor/src/ui/TimeConductorModeSpec.js | 24 ++++----- .../src/ui/TimeConductorValidationSpec.js | 2 +- .../src/ui/TimeConductorViewService.js | 43 ++++++++------- .../src/ui/TimeConductorViewServiceSpec.js | 6 +-- .../utcTimeSystem/src/UTCTimeSystem.js | 10 ++-- platform/features/plot/src/PlotController.js | 2 +- .../features/plot/test/PlotControllerSpec.js | 2 +- .../controllers/HistoricalTableController.js | 2 +- 21 files changed, 124 insertions(+), 113 deletions(-) diff --git a/platform/commonUI/formats/src/UTCTimeFormat.js b/platform/commonUI/formats/src/UTCTimeFormat.js index 7a61338bd9..3faab7a620 100644 --- a/platform/commonUI/formats/src/UTCTimeFormat.js +++ b/platform/commonUI/formats/src/UTCTimeFormat.js @@ -56,7 +56,7 @@ define([ * the threshold required. * @private */ - function getScaledFormat (d) { + function getScaledFormat(d) { var momentified = moment.utc(d); /** * Uses logic from d3 Time-Scales, v3 of the API. See @@ -65,20 +65,32 @@ define([ * Licensed */ return [ - [".SSS", function(m) { return m.milliseconds(); }], - [":ss", function(m) { return m.seconds(); }], - ["HH:mm", function(m) { return m.minutes(); }], - ["HH", function(m) { return m.hours(); }], - ["ddd DD", function(m) { + [".SSS", function (m) { + return m.milliseconds(); + }], + [":ss", function (m) { + return m.seconds(); + }], + ["HH:mm", function (m) { + return m.minutes(); + }], + ["HH", function (m) { + return m.hours(); + }], + ["ddd DD", function (m) { return m.days() && m.date() !== 1; }], - ["MMM DD", function(m) { return m.date() !== 1; }], - ["MMMM", function(m) { + ["MMM DD", function (m) { + return m.date() !== 1; + }], + ["MMMM", function (m) { return m.month(); }], - ["YYYY", function() { return true; }] - ].filter(function (row){ + ["YYYY", function () { + return true; + }] + ].filter(function (row) { return row[1](momentified); })[0][0]; } @@ -91,7 +103,7 @@ define([ * @returns {string} the formatted date */ UTCTimeFormat.prototype.format = function (value, scale) { - if (scale !== undefined){ + if (scale !== undefined) { var scaledFormat = getScaledFormat(value, scale); if (scaledFormat) { return moment.utc(value).format(scaledFormat); diff --git a/platform/features/conductor-v2/compatibility/src/ConductorTelemetryDecorator.js b/platform/features/conductor-v2/compatibility/src/ConductorTelemetryDecorator.js index 908fc21267..10d8c4b8c1 100644 --- a/platform/features/conductor-v2/compatibility/src/ConductorTelemetryDecorator.js +++ b/platform/features/conductor-v2/compatibility/src/ConductorTelemetryDecorator.js @@ -76,7 +76,7 @@ define( } conductor.on('bounds', amendRequests); - return function() { + return function () { unsubscribeFunc(); conductor.off('bounds', amendRequests); }; diff --git a/platform/features/conductor-v2/conductor/src/TimeConductor.js b/platform/features/conductor-v2/conductor/src/TimeConductor.js index 787e0c7d7c..2c2194b5a0 100644 --- a/platform/features/conductor-v2/conductor/src/TimeConductor.js +++ b/platform/features/conductor-v2/conductor/src/TimeConductor.js @@ -112,7 +112,7 @@ define(['EventEmitter'], function (EventEmitter) { TimeConductor.prototype.bounds = function (newBounds) { if (arguments.length > 0) { var validationResult = this.validateBounds(newBounds); - if (validationResult !== true){ + if (validationResult !== true) { throw new Error(validationResult); } //Create a copy to avoid direct mutation of conductor bounds diff --git a/platform/features/conductor-v2/conductor/src/timeSystems/LocalClock.js b/platform/features/conductor-v2/conductor/src/timeSystems/LocalClock.js index b577a111cd..09ddd35612 100644 --- a/platform/features/conductor-v2/conductor/src/timeSystems/LocalClock.js +++ b/platform/features/conductor-v2/conductor/src/timeSystems/LocalClock.js @@ -25,7 +25,7 @@ define(['./TickSource'], function (TickSource) { * @implements TickSource * @constructor */ - function LocalClock ($timeout, period) { + function LocalClock($timeout, period) { TickSource.call(this); this.metadata = { @@ -56,7 +56,7 @@ define(['./TickSource'], function (TickSource) { LocalClock.prototype.tick = function () { var now = Date.now(); - this.listeners.forEach(function (listener){ + this.listeners.forEach(function (listener) { listener(now); }); this.timeoutHandle = this.$timeout(this.tick.bind(this), this.period); @@ -73,7 +73,7 @@ define(['./TickSource'], function (TickSource) { var listeners = this.listeners; listeners.push(listener); - if (listeners.length === 1){ + if (listeners.length === 1) { this.start(); } diff --git a/platform/features/conductor-v2/conductor/src/timeSystems/TickSource.js b/platform/features/conductor-v2/conductor/src/timeSystems/TickSource.js index 389a9baedb..8cb9fd308d 100644 --- a/platform/features/conductor-v2/conductor/src/timeSystems/TickSource.js +++ b/platform/features/conductor-v2/conductor/src/timeSystems/TickSource.js @@ -30,7 +30,7 @@ define([], function () { * @interface * @constructor */ - function TickSource () { + function TickSource() { this.listeners = []; } diff --git a/platform/features/conductor-v2/conductor/src/timeSystems/TimeSystem.js b/platform/features/conductor-v2/conductor/src/timeSystems/TimeSystem.js index 71efc12933..652ea9ed0f 100644 --- a/platform/features/conductor-v2/conductor/src/timeSystems/TimeSystem.js +++ b/platform/features/conductor-v2/conductor/src/timeSystems/TimeSystem.js @@ -25,7 +25,7 @@ define([], function () { * @interface * @constructor */ - function TimeSystem () { + function TimeSystem() { /** * @typedef TimeSystemMetadata * @property {string} key @@ -35,7 +35,6 @@ define([], function () { * @type {TimeSystemMetadata} */ this.metadata = undefined; - this._tickSources = []; } /** diff --git a/platform/features/conductor-v2/conductor/src/ui/MctConductorAxis.js b/platform/features/conductor-v2/conductor/src/ui/MctConductorAxis.js index bb641ed383..88bfc5f2a8 100644 --- a/platform/features/conductor-v2/conductor/src/ui/MctConductorAxis.js +++ b/platform/features/conductor-v2/conductor/src/ui/MctConductorAxis.js @@ -87,7 +87,7 @@ define( //Define a custom format function this.xAxis.tickFormat(function (tickValue) { // Normalize date representations to numbers - if (tickValue instanceof Date){ + if (tickValue instanceof Date) { tickValue = tickValue.getTime(); } return format.format(tickValue, { @@ -127,7 +127,7 @@ define( } }; - return function(conductor, formatService) { + return function (conductor, formatService) { return new MCTConductorAxis(conductor, formatService); }; } diff --git a/platform/features/conductor-v2/conductor/src/ui/MctConductorAxisSpec.js b/platform/features/conductor-v2/conductor/src/ui/MctConductorAxisSpec.js index e99300083b..5c45521ea4 100644 --- a/platform/features/conductor-v2/conductor/src/ui/MctConductorAxisSpec.js +++ b/platform/features/conductor-v2/conductor/src/ui/MctConductorAxisSpec.js @@ -71,7 +71,7 @@ define(['./MctConductorAxis'], function (MctConductorAxis) { "range" ]; d3 = jasmine.createSpyObj("d3", d3Functions); - d3Functions.forEach(function(func) { + d3Functions.forEach(function (func) { d3[func].andReturn(d3); }); @@ -89,7 +89,7 @@ define(['./MctConductorAxis'], function (MctConductorAxis) { var mockTimeSystem; var mockFormat; - beforeEach(function() { + beforeEach(function () { mockTimeSystem = jasmine.createSpyObj("timeSystem", [ "formats", "isUTCBased" diff --git a/platform/features/conductor-v2/conductor/src/ui/NumberFormat.js b/platform/features/conductor-v2/conductor/src/ui/NumberFormat.js index 4b0e85ac15..ac3f40cb7b 100644 --- a/platform/features/conductor-v2/conductor/src/ui/NumberFormat.js +++ b/platform/features/conductor-v2/conductor/src/ui/NumberFormat.js @@ -34,7 +34,7 @@ define([], function () { } NumberFormat.prototype.format = function (value) { - if (isNaN(value)){ + if (isNaN(value)) { return ''; } else { return '' + value; diff --git a/platform/features/conductor-v2/conductor/src/ui/NumberFormatSpec.js b/platform/features/conductor-v2/conductor/src/ui/NumberFormatSpec.js index 521ed506e2..f56c6e67d3 100644 --- a/platform/features/conductor-v2/conductor/src/ui/NumberFormatSpec.js +++ b/platform/features/conductor-v2/conductor/src/ui/NumberFormatSpec.js @@ -30,13 +30,13 @@ define(['./NumberFormat'], function (NumberFormat) { it("The format function takes a string and produces a number", function () { var text = format.format(1); expect(text).toBe("1"); - expect(typeof(text)).toBe("string"); + expect(typeof text).toBe("string"); }); it("The parse function takes a string and produces a number", function () { var number = format.parse("1"); expect(number).toBe(1); - expect(typeof(number)).toBe("number"); + expect(typeof number).toBe("number"); }); it("validates that the input is a number", function () { diff --git a/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js b/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js index 6e42fd9918..c0964061aa 100644 --- a/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js +++ b/platform/features/conductor-v2/conductor/src/ui/TimeConductorController.js @@ -45,7 +45,7 @@ define( this.validation = new TimeConductorValidation(this.conductor); // Construct the provided time system definitions - this.timeSystems = timeSystems.map(function (timeSystemConstructor){ + this.timeSystems = timeSystems.map(function (timeSystemConstructor) { return timeSystemConstructor(); }); @@ -53,7 +53,7 @@ define( this.initializeScope(); this.conductor.on('bounds', this.setFormFromBounds); - this.conductor.on('follow', function (follow){ + this.conductor.on('follow', function (follow) { $scope.followMode = follow; }); this.conductor.on('timeSystem', this.changeTimeSystem); @@ -67,7 +67,7 @@ define( /** * @private */ - TimeConductorController.prototype.initializeScope = function() { + TimeConductorController.prototype.initializeScope = function () { //Set time Conductor bounds in the form this.$scope.boundsModel = this.conductor.bounds(); @@ -126,10 +126,11 @@ define( TimeConductorController.prototype.setFormFromMode = function (mode) { this.$scope.modeModel.selectedKey = mode; //Synchronize scope with time system on mode - this.$scope.timeSystemModel.options = this.conductorViewService.availableTimeSystems() + this.$scope.timeSystemModel.options = + this.conductorViewService.availableTimeSystems() .map(function (t) { return t.metadata; - }); + }); }; /** @@ -204,13 +205,13 @@ define( * @param key * @see TimeConductorController#setTimeSystem */ - TimeConductorController.prototype.selectTimeSystemByKey = function(key){ - var selected = this.timeSystems.filter(function (timeSystem){ + TimeConductorController.prototype.selectTimeSystemByKey = function (key) { + var selected = this.timeSystems.filter(function (timeSystem) { return timeSystem.metadata.key === key; })[0]; this.conductor.timeSystem(selected, selected.defaults().bounds); }; - + /** * Handles time system change from time conductor * @@ -222,7 +223,7 @@ define( */ TimeConductorController.prototype.changeTimeSystem = function (newTimeSystem) { if (newTimeSystem && (newTimeSystem !== this.$scope.timeSystemModel.selected)) { - if (newTimeSystem.defaults()){ + if (newTimeSystem.defaults()) { var deltas = newTimeSystem.defaults().deltas || {start: 0, end: 0}; var bounds = newTimeSystem.defaults().bounds || {start: 0, end: 0}; diff --git a/platform/features/conductor-v2/conductor/src/ui/TimeConductorControllerSpec.js b/platform/features/conductor-v2/conductor/src/ui/TimeConductorControllerSpec.js index 3dd5b47d10..7d1457eafe 100644 --- a/platform/features/conductor-v2/conductor/src/ui/TimeConductorControllerSpec.js +++ b/platform/features/conductor-v2/conductor/src/ui/TimeConductorControllerSpec.js @@ -58,13 +58,13 @@ define(['./TimeConductorController'], function (TimeConductorController) { }); function getListener(name) { - return mockTimeConductor.on.calls.filter(function (call){ + return mockTimeConductor.on.calls.filter(function (call) { return call.args[0] === name; })[0].args[1]; } - describe("", function (){ - beforeEach(function() { + describe("", function () { + beforeEach(function () { controller = new TimeConductorController( mockScope, mockWindow, @@ -183,7 +183,7 @@ define(['./TimeConductorController'], function (TimeConductorController) { var ts2Metadata; var ts3Metadata; var mockTimeSystemConstructors; - + beforeEach(function () { mode = "realtime"; ts1Metadata = { @@ -304,7 +304,7 @@ define(['./TimeConductorController'], function (TimeConductorController) { metadata: { key: 'testTimeSystem' }, - defaults: function() { + defaults: function () { return { bounds: defaultBounds }; @@ -313,7 +313,7 @@ define(['./TimeConductorController'], function (TimeConductorController) { mockTimeSystems = [ // Wrap as constructor function - function() { + function () { return timeSystem; } ]; diff --git a/platform/features/conductor-v2/conductor/src/ui/TimeConductorMode.js b/platform/features/conductor-v2/conductor/src/ui/TimeConductorMode.js index 4fed0610a8..1f9d3656af 100644 --- a/platform/features/conductor-v2/conductor/src/ui/TimeConductorMode.js +++ b/platform/features/conductor-v2/conductor/src/ui/TimeConductorMode.js @@ -33,12 +33,12 @@ define( function TimeConductorMode(metadata, conductor, timeSystems) { this.conductor = conductor; - this._metadata = metadata; - this._deltas = undefined; - this._tickSource = undefined; - this._tickSourceUnlisten = undefined; - this._timeSystems = timeSystems; - this._availableTickSources = undefined; + this.mdata = metadata; + this.dlts = undefined; + this.source = undefined; + this.sourceUnlisten = undefined; + this.systems = timeSystems; + this.availableSources = undefined; this.changeTimeSystem = this.changeTimeSystem.bind(this); this.tick = this.tick.bind(this); @@ -52,9 +52,9 @@ define( if (metadata.key === 'fixed') { //Fixed automatically supports all time systems - this._availableTimeSystems = timeSystems; + this.availableSystems = timeSystems; } else { - this._availableTimeSystems = timeSystems.filter(function (timeSystem) { + this.availableSystems = timeSystems.filter(function (timeSystem) { //Only include time systems that have tick sources that // support the current mode return timeSystem.tickSources().some(function (tickSource) { @@ -86,10 +86,10 @@ define( this.deltas(defaults.deltas); // Tick sources are mode-specific, so restrict tick sources to only those supported by the current mode. - var key = this._metadata.key; + var key = this.mdata.key; var tickSources = timeSystem.tickSources(); if (tickSources) { - this._availableTickSources = tickSources.filter(function (source){ + this.availableSources = tickSources.filter(function (source) { return source.metadata.mode === key; }); } @@ -102,11 +102,11 @@ define( * @returns {ModeMetadata} */ TimeConductorMode.prototype.metadata = function () { - return this._metadata; + return this.mdata; }; TimeConductorMode.prototype.availableTimeSystems = function () { - return this._availableTimeSystems; + return this.availableSystems; }; /** @@ -115,7 +115,7 @@ define( * @returns {Array.} */ TimeConductorMode.prototype.availableTickSources = function (timeSystem) { - return this._availableTickSources; + return this.availableSources; }; /** @@ -126,26 +126,26 @@ define( */ TimeConductorMode.prototype.tickSource = function (tickSource) { if (arguments.length > 0) { - if (this._tickSourceUnlisten) { - this._tickSourceUnlisten(); + if (this.sourceUnlisten) { + this.sourceUnlisten(); } - this._tickSource = tickSource; + this.source = tickSource; if (tickSource) { - this._tickSourceUnlisten = tickSource.listen(this.tick); + this.sourceUnlisten = tickSource.listen(this.tick); //Now following a tick source this.conductor.follow(true); } else { this.conductor.follow(false); } } - return this._tickSource; + return this.source; }; TimeConductorMode.prototype.destroy = function () { this.conductor.off('timeSystem', this.changeTimeSystem); - if (this._tickSourceUnlisten) { - this._tickSourceUnlisten(); + if (this.sourceUnlisten) { + this.sourceUnlisten(); } }; @@ -179,21 +179,21 @@ define( if (arguments.length !== 0) { var oldEnd = this.conductor.bounds().end; - if (this._deltas && this._deltas.end !== undefined){ + if (this.dlts && this.dlts.end !== undefined) { //Calculate the previous raw end value (without delta) - oldEnd = oldEnd - this._deltas.end; + oldEnd = oldEnd - this.dlts.end; } - this._deltas = deltas; + this.dlts = deltas; var newBounds = { - start: oldEnd - this._deltas.start, - end: oldEnd + this._deltas.end + start: oldEnd - this.dlts.start, + end: oldEnd + this.dlts.end }; this.conductor.bounds(newBounds); } - return this._deltas; + return this.dlts; }; return TimeConductorMode; diff --git a/platform/features/conductor-v2/conductor/src/ui/TimeConductorModeSpec.js b/platform/features/conductor-v2/conductor/src/ui/TimeConductorModeSpec.js index 23541ebfa0..6ea5ce79c2 100644 --- a/platform/features/conductor-v2/conductor/src/ui/TimeConductorModeSpec.js +++ b/platform/features/conductor-v2/conductor/src/ui/TimeConductorModeSpec.js @@ -118,7 +118,7 @@ define(['./TimeConductorMode'], function (TimeConductorMode) { fixedTimeSystem.defaults.andReturn(defaults); }); - it ("sets defaults from new time system", function() { + it ("sets defaults from new time system", function () { mode = new TimeConductorMode(fixedModeMetaData, mockTimeConductor, mockTimeSystems); spyOn(mode, "deltas"); mode.deltas.andCallThrough(); @@ -127,7 +127,7 @@ define(['./TimeConductorMode'], function (TimeConductorMode) { expect(mockTimeConductor.bounds).toHaveBeenCalledWith(defaults.bounds); expect(mode.deltas).toHaveBeenCalledWith(defaults.deltas); }); - it ("If a tick source is available, sets the tick source", function() { + it ("If a tick source is available, sets the tick source", function () { mode = new TimeConductorMode(realtimeModeMetaData, mockTimeConductor, mockTimeSystems); mode.changeTimeSystem(realtimeTimeSystem); @@ -139,7 +139,7 @@ define(['./TimeConductorMode'], function (TimeConductorMode) { describe("Setting a tick source", function () { var mockUnlistener; - beforeEach(function() { + beforeEach(function () { mockUnlistener = jasmine.createSpy("unlistener"); mockTickSource.listen.andReturn(mockUnlistener); @@ -147,31 +147,31 @@ define(['./TimeConductorMode'], function (TimeConductorMode) { mode.tickSource(mockTickSource); }); - it ("Unlistens from old tick source", function() { + it ("Unlistens from old tick source", function () { mode.tickSource(mockTickSource); expect(mockUnlistener).toHaveBeenCalled(); }); - it ("Listens to new tick source", function() { + it ("Listens to new tick source", function () { expect(mockTickSource.listen).toHaveBeenCalledWith(mode.tick); }); - it ("Sets 'follow' state on time conductor", function() { + it ("Sets 'follow' state on time conductor", function () { expect(mockTimeConductor.follow).toHaveBeenCalledWith(true); }); - it ("on destroy, unlistens from tick source", function() { + it ("on destroy, unlistens from tick source", function () { mode.destroy(); expect(mockUnlistener).toHaveBeenCalled(); }); }); describe("setting deltas", function () { - beforeEach(function() { + beforeEach(function () { mode = new TimeConductorMode(realtimeModeMetaData, mockTimeConductor, mockTimeSystems); }); it ("sets the bounds on the time conductor based on new delta" + - " values", function() { + " values", function () { var deltas = { start: 20, end: 10 @@ -187,10 +187,10 @@ define(['./TimeConductorMode'], function (TimeConductorMode) { }); describe("ticking", function () { - beforeEach(function() { + beforeEach(function () { mode = new TimeConductorMode(realtimeModeMetaData, mockTimeConductor, mockTimeSystems); }); - it ("sets bounds based on current delta values", function() { + it ("sets bounds based on current delta values", function () { var deltas = { start: 20, end: 10 @@ -202,7 +202,7 @@ define(['./TimeConductorMode'], function (TimeConductorMode) { expect(mockTimeConductor.bounds).toHaveBeenCalledWith({ start: time - deltas.start, - end:time + deltas.end + end: time + deltas.end }); }); }); diff --git a/platform/features/conductor-v2/conductor/src/ui/TimeConductorValidationSpec.js b/platform/features/conductor-v2/conductor/src/ui/TimeConductorValidationSpec.js index 4dc954d38c..833ba30993 100644 --- a/platform/features/conductor-v2/conductor/src/ui/TimeConductorValidationSpec.js +++ b/platform/features/conductor-v2/conductor/src/ui/TimeConductorValidationSpec.js @@ -34,7 +34,7 @@ define(['./TimeConductorValidation'], function (TimeConductorValidation) { }); describe("Validates start and end values using Time Conductor", function () { - beforeEach(function() { + beforeEach(function () { var mockBounds = { start: 10, end: 20 diff --git a/platform/features/conductor-v2/conductor/src/ui/TimeConductorViewService.js b/platform/features/conductor-v2/conductor/src/ui/TimeConductorViewService.js index 4e4a02ebcb..00f49b2269 100644 --- a/platform/features/conductor-v2/conductor/src/ui/TimeConductorViewService.js +++ b/platform/features/conductor-v2/conductor/src/ui/TimeConductorViewService.js @@ -36,13 +36,12 @@ define( * @constructor */ function TimeConductorViewService(conductor, timeSystems) { - this._timeSystems = timeSystems.map( - function (timeSystemConstructor) { - return timeSystemConstructor(); + this.systems = timeSystems.map(function (timeSystemConstructor) { + return timeSystemConstructor(); }); - this._conductor = conductor; - this._mode = undefined; + this.conductor = conductor; + this.currentMode = undefined; /** * @typedef {object} ModeMetadata @@ -53,7 +52,7 @@ define( * @property {string} name A longer name for the mode * @property {string} description A description of the mode */ - this._availableModes = { + this.availModes = { 'fixed': { key: 'fixed', cssclass: 'icon-calendar', @@ -64,17 +63,17 @@ define( }; function hasTickSource(sourceType, timeSystem) { - return timeSystem.tickSources().some(function (tickSource){ + return timeSystem.tickSources().some(function (tickSource) { return tickSource.metadata.mode === sourceType; }); } var timeSystemsForMode = function (sourceType) { - return this._timeSystems.filter(hasTickSource.bind(this, sourceType)); + return this.systems.filter(hasTickSource.bind(this, sourceType)); }.bind(this); //Only show 'real-time mode' if appropriate time systems available - if (timeSystemsForMode('realtime').length > 0 ) { + if (timeSystemsForMode('realtime').length > 0) { var realtimeMode = { key: 'realtime', cssclass: 'icon-clock', @@ -82,7 +81,7 @@ define( name: 'Real-time Mode', description: 'Monitor real-time streaming data as it comes in. The Time Conductor and displays will automatically advance themselves based on a UTC clock.' }; - this._availableModes[realtimeMode.key] = realtimeMode; + this.availModes[realtimeMode.key] = realtimeMode; } //Only show 'LAD mode' if appropriate time systems available @@ -94,7 +93,7 @@ define( name: 'LAD Mode', description: 'Latest Available Data mode monitors real-time streaming data as it comes in. The Time Conductor and displays will only advance when data becomes available.' }; - this._availableModes[ladMode.key] = ladMode; + this.availModes[ladMode.key] = ladMode; } } @@ -125,23 +124,23 @@ define( } if (arguments.length === 1) { - var timeSystem = this._conductor.timeSystem(); + var timeSystem = this.conductor.timeSystem(); var modes = this.availableModes(); var modeMetaData = modes[newModeKey]; - if (this._mode) { - this._mode.destroy(); + if (this.currentMode) { + this.currentMode.destroy(); } - this._mode = new TimeConductorMode(modeMetaData, this._conductor, this._timeSystems); + this.currentMode = new TimeConductorMode(modeMetaData, this.conductor, this.systems); // If no time system set on time conductor, or the currently selected time system is not available in // the new mode, default to first available time system - if (!timeSystem || !contains(this._mode.availableTimeSystems(), timeSystem)) { - timeSystem = this._mode.availableTimeSystems()[0]; - this._conductor.timeSystem(timeSystem, timeSystem.defaults().bounds); + if (!timeSystem || !contains(this.currentMode.availableTimeSystems(), timeSystem)) { + timeSystem = this.currentMode.availableTimeSystems()[0]; + this.conductor.timeSystem(timeSystem, timeSystem.defaults().bounds); } } - return this._mode ? this._mode.metadata().key : undefined; + return this.currentMode ? this.currentMode.metadata().key : undefined; }; /** @@ -176,7 +175,7 @@ define( */ TimeConductorViewService.prototype.deltas = function () { //Deltas stored on mode. Use .apply to preserve arguments - return this._mode.deltas.apply(this._mode, arguments); + return this.currentMode.deltas.apply(this.currentMode, arguments); }; /** @@ -187,7 +186,7 @@ define( * @returns {ModeMetadata[]} */ TimeConductorViewService.prototype.availableModes = function () { - return this._availableModes; + return this.availModes; }; /** @@ -195,7 +194,7 @@ define( * mode. Time systems and tick sources are mode dependent */ TimeConductorViewService.prototype.availableTimeSystems = function () { - return this._mode.availableTimeSystems(); + return this.currentMode.availableTimeSystems(); }; return TimeConductorViewService; diff --git a/platform/features/conductor-v2/conductor/src/ui/TimeConductorViewServiceSpec.js b/platform/features/conductor-v2/conductor/src/ui/TimeConductorViewServiceSpec.js index 13ec9f8022..62ad29de9b 100644 --- a/platform/features/conductor-v2/conductor/src/ui/TimeConductorViewServiceSpec.js +++ b/platform/features/conductor-v2/conductor/src/ui/TimeConductorViewServiceSpec.js @@ -133,7 +133,7 @@ define(['./TimeConductorViewService'], function (TimeConductorViewService) { ]); viewService = new TimeConductorViewService(mockTimeConductor, mockTimeSystems); - viewService._mode = oldMode; + viewService.currentMode = oldMode; viewService.mode('fixed'); expect(oldMode.destroy).toHaveBeenCalled(); }); @@ -145,7 +145,7 @@ define(['./TimeConductorViewService'], function (TimeConductorViewService) { metadata: { mode: 'realtime' }, - listen: function() {} + listen: function () {} }; tickingTimeSystem.tickSources.andReturn([mockRealtimeTickSource]); @@ -165,7 +165,7 @@ define(['./TimeConductorViewService'], function (TimeConductorViewService) { metadata: { mode: 'realtime' }, - listen: function() {} + listen: function () {} }; tickingTimeSystem.tickSources.andReturn([mockRealtimeTickSource]); diff --git a/platform/features/conductor-v2/utcTimeSystem/src/UTCTimeSystem.js b/platform/features/conductor-v2/utcTimeSystem/src/UTCTimeSystem.js index 4412c55822..b6e969c3eb 100644 --- a/platform/features/conductor-v2/utcTimeSystem/src/UTCTimeSystem.js +++ b/platform/features/conductor-v2/utcTimeSystem/src/UTCTimeSystem.js @@ -32,7 +32,7 @@ define([ * @implements TimeSystem * @constructor */ - function UTCTimeSystem ($timeout) { + function UTCTimeSystem($timeout) { TimeSystem.call(this); /** @@ -46,14 +46,14 @@ define([ 'cssclass': 'icon-clock' }; - this._formats = ['utc']; - this._tickSources = [new LocalClock($timeout, DEFAULT_PERIOD)]; + this.fmts = ['utc']; + this.sources = [new LocalClock($timeout, DEFAULT_PERIOD)]; } UTCTimeSystem.prototype = Object.create(TimeSystem.prototype); UTCTimeSystem.prototype.formats = function () { - return this._formats; + return this.fmts; }; UTCTimeSystem.prototype.deltaFormat = function () { @@ -61,7 +61,7 @@ define([ }; UTCTimeSystem.prototype.tickSources = function () { - return this._tickSources; + return this.sources; }; UTCTimeSystem.prototype.defaults = function (key) { diff --git a/platform/features/plot/src/PlotController.js b/platform/features/plot/src/PlotController.js index 8e2749aa5a..0ad0223a90 100644 --- a/platform/features/plot/src/PlotController.js +++ b/platform/features/plot/src/PlotController.js @@ -229,7 +229,7 @@ define( // Respond to a display bounds change (requery for data) function changeDisplayBounds(event, bounds, follow) { //'hack' for follow mode - if (follow === true){ + if (follow === true) { setBasePanZoom(bounds); } else { var domainAxis = $scope.axes[0]; diff --git a/platform/features/plot/test/PlotControllerSpec.js b/platform/features/plot/test/PlotControllerSpec.js index c7bc8fd594..8d1a305065 100644 --- a/platform/features/plot/test/PlotControllerSpec.js +++ b/platform/features/plot/test/PlotControllerSpec.js @@ -239,7 +239,7 @@ define( it("sets status when plot becomes detached from time conductor", function () { mockScope.$watch.mostRecentCall.args[1](mockDomainObject); - function boundsEvent(){ + function boundsEvent() { fireEvent("telemetry:display:bounds", [ {}, { start: 10, end: 100 }, diff --git a/platform/features/table/src/controllers/HistoricalTableController.js b/platform/features/table/src/controllers/HistoricalTableController.js index 06568073ce..d8af8060de 100644 --- a/platform/features/table/src/controllers/HistoricalTableController.js +++ b/platform/features/table/src/controllers/HistoricalTableController.js @@ -80,7 +80,7 @@ define( HistoricalTableController.prototype.boundsChange = function (event, bounds, follow) { // If in follow mode, don't bother re-subscribing, data will be // received from existing subscription. - if (follow!==true) { + if (follow !== true) { this.subscribe(); } };