diff --git a/platform/features/conductor-v2/src/TimeConductorController.js b/platform/features/conductor-v2/src/TimeConductorController.js index d7c4e091bf..571a595543 100644 --- a/platform/features/conductor-v2/src/TimeConductorController.js +++ b/platform/features/conductor-v2/src/TimeConductorController.js @@ -66,6 +66,25 @@ define( $scope.$watch('modeModel.selected', this.switchMode); + $scope.$watch('timeSystem', function (newTimeSystem, oldTimeSystem) { + $scope.modeModel = { + selected: 'fixed', + options: { + 'fixed': { + glyph: '\ue604', + label: 'Fixed', + name: 'Fixed Timespan Mode', + description: 'Query and explore data that falls between two fixed datetimes.' + }, + } + } + newTimeSystem.tickSources().forEach(function (tickSource) { + var option = {}; + $scope.modeModel.options.push({ + }); + }); + }); + $scope.modeModel = { selected: 'fixed', options: { diff --git a/platform/features/conductor-v2/src/timeSystems/LocalClock.js b/platform/features/conductor-v2/src/timeSystems/LocalClock.js index 07996ecae4..e596537384 100644 --- a/platform/features/conductor-v2/src/timeSystems/LocalClock.js +++ b/platform/features/conductor-v2/src/timeSystems/LocalClock.js @@ -22,36 +22,52 @@ define(['./TickSource'], function (TickSource) { /** - * @interface + * @implements TickSource * @constructor */ - function PeriodicTickSource ($timeout, interval) { + function LocalClock ($timeout) { TickSource.call(this); + this.metadata = { + key: 'real-time', + glyph: '\u0043', + label: 'Real-time', + 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.interval = interval; this.$timeout = $timeout; this.timeoutHandle = undefined; } - PeriodicTickSource.prototype = Object.create(TickSource.prototype); + LocalClock.prototype = Object.create(TickSource.prototype); - PeriodicTickSource.prototype.start = function () { + LocalClock.prototype.start = function () { this.timeoutHandle = this.$timeout(this.tick.bind(this), this.interval); }; - PeriodicTickSource.prototype.stop = function () { + LocalClock.prototype.stop = function () { if (this.timeoutHandle) { this.$timeout.cancel(this.timeoutHandle); } }; - PeriodicTickSource.prototype.tick = function () { + LocalClock.prototype.tick = function () { + var now = Date.now(); this.listeners.forEach(function (listener){ - listener(); + listener(now); }); }; - PeriodicTickSource.prototype.listen = function (listener) { + /** + * Register a listener for the local clock. When it ticks, the local + * clock will provide the current local system time + * + * @param listener + * @returns {function} a function for deregistering the provided listener + */ + LocalClock.prototype.listen = function (listener) { this.listeners.push(listener); if (this.listeners.length === 1){ diff --git a/platform/features/conductor-v2/src/timeSystems/UTCTimeSystem.js b/platform/features/conductor-v2/src/timeSystems/UTCTimeSystem.js index 1a93fde598..5ab7c70723 100644 --- a/platform/features/conductor-v2/src/timeSystems/UTCTimeSystem.js +++ b/platform/features/conductor-v2/src/timeSystems/UTCTimeSystem.js @@ -20,17 +20,22 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -define(['./TimeSystem'], function (TimeSystem) { +define([ + './TimeSystem', + './LocalClock', + '../../../../commonUI/formats/src/UTCTimeFormat' +], function (TimeSystem, LocalClock, UTCTimeFormat) { var FIFTEEN_MINUTES = 15 * 60 * 1000; + /** * @implements TimeSystem * @constructor */ - function UTCTimeSystem () { + function UTCTimeSystem ($timeout) { TimeSystem.call(this); - this._formats = []; - this._tickSources = []; + this._formats = [new UTCTimeFormat()]; + this._tickSources = [new LocalClock($timeout)]; } UTCTimeSystem.prototype = Object.create(TimeSystem.prototype);