Removed LAD and Realtime modes

This commit is contained in:
Henry 2016-07-27 11:55:12 -04:00
parent c1bbc4f01d
commit 8e59072537
9 changed files with 78 additions and 159 deletions

View File

@ -22,15 +22,15 @@
<div class="contents"> <div class="contents">
<div class="pane left menu-items"> <div class="pane left menu-items">
<ul> <ul>
<li ng-repeat="option in ngModel.options" <li ng-repeat="(key, metadata) in ngModel.options"
ng-click="ngModel.selected=option"> ng-click="ngModel.selectedKey=key">
<a <a
ng-mouseover="representation.activeMetadata = option.metadata" ng-mouseover="representation.activeMetadata = metadata"
ng-mouseleave="representation.activeMetadata = undefined"> ng-mouseleave="representation.activeMetadata = undefined">
<span class="ui-symbol icon type-icon"> <span class="ui-symbol icon type-icon">
{{option.metadata.glyph}} {{metadata.glyph}}
</span> </span>
{{option.metadata.name}} {{metadata.name}}
</a> </a>
</li> </li>
</ul> </ul>

View File

@ -22,7 +22,8 @@
<span ng-controller="ClickAwayController as modeController"> <span ng-controller="ClickAwayController as modeController">
<div class="s-menu-btn" <div class="s-menu-btn"
ng-click="modeController.toggle()"> ng-click="modeController.toggle()">
<span class="title-label">{{ngModel.selected.metadata.label}}</span> <span class="title-label">{{ngModel.options[ngModel.selectedKey]
.label}}</span>
</div> </div>
<div class="menu super-menu mini mode-selector-menu" <div class="menu super-menu mini mode-selector-menu"
ng-show="modeController.isActive()"> ng-show="modeController.isActive()">

View File

@ -1,6 +1,6 @@
<!-- Parent holder for time conductor. follow-mode | fixed-mode --> <!-- Parent holder for time conductor. follow-mode | fixed-mode -->
<div ng-controller="TimeConductorController as tcController" <div ng-controller="TimeConductorController as tcController"
class="holder grows flex-elem l-flex-row l-time-conductor {{modeModel.selected.metadata.key}}-mode {{timeSystemModel.selected.metadata.key}}-time-system"> class="holder grows flex-elem l-flex-row l-time-conductor {{modeModel.selectedKey}}-mode {{timeSystemModel.selected.metadata.key}}-time-system">
<div class="flex-elem holder time-conductor-icon"> <div class="flex-elem holder time-conductor-icon">
<div class="hand-little"></div> <div class="hand-little"></div>
@ -27,7 +27,7 @@
</mct-control> </mct-control>
</span> </span>
<span class="l-time-range-input-w time-delta start-delta" <span class="l-time-range-input-w time-delta start-delta"
ng-class="{'hide':(modeModel.selected.metadata.key === 'fixed')}"> ng-class="{'hide':(modeModel.selectedKey === 'fixed')}">
- -
<mct-control key="'datetime-field'" <mct-control key="'datetime-field'"
structure="{ structure="{
@ -57,7 +57,7 @@
</mct-control> </mct-control>
</span> </span>
<span class="l-time-range-input-w time-delta end-delta" <span class="l-time-range-input-w time-delta end-delta"
ng-class="{'hide':(modeModel.selected.metadata.key === 'fixed')}"> ng-class="{'hide':(modeModel.selectedKey === 'fixed')}">
+ +
<mct-control key="'datetime-field'" <mct-control key="'datetime-field'"
structure="{ structure="{

View File

@ -23,11 +23,10 @@
define( define(
[ [
'./modes/FixedMode', './modes/FixedMode',
'./modes/RealtimeMode', './modes/FollowMode',
'./modes/LADMode',
'./TimeConductorValidation' './TimeConductorValidation'
], ],
function (FixedMode, RealtimeMode, LADMode, TimeConductorValidation) { function (FixedMode, FollowMode, TimeConductorValidation) {
function TimeConductorController($scope, conductor, timeSystems) { function TimeConductorController($scope, conductor, timeSystems) {
@ -45,12 +44,28 @@ define(
this.timeSystems = timeSystems.map(function (timeSystemConstructor){ this.timeSystems = timeSystems.map(function (timeSystemConstructor){
return timeSystemConstructor(); return timeSystemConstructor();
}); });
// Populate a list of modes supported by the time conductor
this.modes = [ this.modes = {
new FixedMode(this.conductor, this.timeSystems), 'fixed': {
new RealtimeMode(this.conductor, this.timeSystems), glyph: '\ue604',
new LADMode(this.conductor, this.timeSystems) label: 'Fixed',
]; name: 'Fixed Timespan Mode',
description: 'Query and explore data that falls between two fixed datetimes.'
},
'latest': {
glyph: '\u0044',
label: 'LAD',
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.'
},
'realtime': {
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.selectedMode = undefined;
this.validation = new TimeConductorValidation(conductor); this.validation = new TimeConductorValidation(conductor);
this.$scope = $scope; this.$scope = $scope;
@ -63,14 +78,14 @@ define(
//Set the time conductor mode to the first one in the list, //Set the time conductor mode to the first one in the list,
// effectively initializing the time conductor // effectively initializing the time conductor
this.setMode(this.modes[0]); this.setMode('fixed');
} }
/** /**
* @private * @private
*/ */
TimeConductorController.prototype.initializeScope = function ($scope) { TimeConductorController.prototype.initializeScope = function ($scope) {
var self = this;
/* /*
Represents the various time system options, and the currently Represents the various time system options, and the currently
selected time system in the view. Additionally holds the selected time system in the view. Additionally holds the
@ -87,7 +102,7 @@ define(
selected mode in the view selected mode in the view
*/ */
$scope.modeModel = { $scope.modeModel = {
selected: undefined, selectedKey: undefined,
options: this.modes options: this.modes
}; };
/* /*
@ -98,13 +113,12 @@ define(
end: 0 end: 0
}; };
$scope.$watch('modeModel.selected', this.setMode); $scope.$watch('modeModel.selectedKey', this.setMode);
$scope.$watch('timeSystem', this.setTimeSystem); $scope.$watch('timeSystem', this.setTimeSystem);
$scope.$on('$destroy', function() { $scope.$on('$destroy', function() {
var mode = $scope.modeModel.selected; if (self.selectedMode) {
if (mode && mode.destroy) { self.selectedMode.destroy();
mode.destroy();
} }
}); });
}; };
@ -142,7 +156,7 @@ define(
* @see TimeConductorMode * @see TimeConductorMode
*/ */
TimeConductorController.prototype.updateDeltasFromForm = function (formModel) { TimeConductorController.prototype.updateDeltasFromForm = function (formModel) {
var mode = this.$scope.modeModel.selected, var mode = this.selectedMode,
deltas = mode.deltas(); deltas = mode.deltas();
if (deltas !== undefined && this.validation.validateDeltas(formModel)) { if (deltas !== undefined && this.validation.validateDeltas(formModel)) {
@ -160,17 +174,42 @@ define(
*/ */
TimeConductorController.prototype.setMode = function (newMode, oldMode) { TimeConductorController.prototype.setMode = function (newMode, oldMode) {
if (newMode !== oldMode) { if (newMode !== oldMode) {
if (oldMode) { this.$scope.modeModel.selectedKey = newMode;
oldMode.destroy();
if (this.selectedMode) {
this.selectedMode.destroy();
} }
newMode.initialize(); switch (newMode) {
case 'fixed':
this.selectedMode = new FixedMode(this.conductor, this.timeSystems);
break;
case 'realtime':
// Filter time systems to only those with clock tick
// sources
var realtimeSystems = this.timeSystems.filter(function (timeSystem){
return timeSystem.tickSources().some(function (tickSource){
return tickSource.type() === 'clock';
});
});
this.selectedMode = new FollowMode(this.conductor, realtimeSystems);
break;
case 'latest':
// Filter time systems to only those with clock tick
// sources
var ladSystems = this.timeSystems.filter(function (timeSystem){
return timeSystem.tickSources().some(function (tickSource){
return tickSource.type() === 'data';
});
});
this.selectedMode = new FollowMode(this.conductor, ladSystems);
break;
}
this.selectedMode.initialize();
var timeSystem = newMode.selectedTimeSystem(); var timeSystem = this.selectedMode.selectedTimeSystem();
this.$scope.modeModel.selected = newMode;
//Synchronize scope with time system on mode //Synchronize scope with time system on mode
this.$scope.timeSystemModel.options = newMode.timeSystems().map(function (timeSystem) { this.$scope.timeSystemModel.options = this.selectedMode.timeSystems().map(function (timeSystem) {
return timeSystem.metadata; return timeSystem.metadata;
}); });
this.$scope.timeSystemModel.selected = timeSystem; this.$scope.timeSystemModel.selected = timeSystem;
@ -221,7 +260,7 @@ define(
TimeConductorController.prototype.setTimeSystem = function (newTimeSystem) { TimeConductorController.prototype.setTimeSystem = function (newTimeSystem) {
if (newTimeSystem && newTimeSystem !== this.$scope.timeSystemModel.selected) { if (newTimeSystem && newTimeSystem !== this.$scope.timeSystemModel.selected) {
this.$scope.timeSystemModel.selected = newTimeSystem; this.$scope.timeSystemModel.selected = newTimeSystem;
var mode = this.$scope.modeModel.selected; var mode = this.selectedMode;
mode.selectedTimeSystem(newTimeSystem); mode.selectedTimeSystem(newTimeSystem);
this.setDeltasFromTimeSystem(newTimeSystem); this.setDeltasFromTimeSystem(newTimeSystem);
} }

View File

@ -33,15 +33,7 @@ define(
* @constructor * @constructor
*/ */
function FixedMode(conductor, timeSystems) { function FixedMode(conductor, timeSystems) {
var metadata = { TimeConductorMode.call(this, conductor, timeSystems);
key: 'fixed',
glyph: '\ue604',
label: 'Fixed',
name: 'Fixed Timespan Mode',
description: 'Query and explore data that falls between two fixed datetimes.'
};
TimeConductorMode.call(this, metadata, conductor, timeSystems);
} }
FixedMode.prototype = Object.create(TimeConductorMode.prototype); FixedMode.prototype = Object.create(TimeConductorMode.prototype);

View File

@ -33,8 +33,8 @@ define(
* the mode relevant, with both offsets defined relative to it. * the mode relevant, with both offsets defined relative to it.
* @constructor * @constructor
*/ */
function FollowMode(metadata, conductor, timeSystems) { function FollowMode(conductor, timeSystems) {
TimeConductorMode.call(this, metadata, conductor, timeSystems); TimeConductorMode.call(this, conductor, timeSystems);
this._deltas = undefined; this._deltas = undefined;
} }

View File

@ -1,56 +0,0 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
['./FollowMode'],
function (FollowMode) {
/**
* Supports the 'Latest Available Data' mode of the time conductor.
* This is a special case of FollowMode that advances on 'data' type
* tick sources.
* @param conductor
* @param timeSystems
* @constructor
*/
function LADMode(conductor, timeSystems) {
var metadata = {
key: 'latest',
glyph: '\u0044',
label: 'LAD',
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.'
};
var filteredTimeSystems = timeSystems.filter(function (timeSystem){
return timeSystem.tickSources().some(function (tickSource){
return tickSource.type() === 'data';
});
});
FollowMode.call(this, metadata, conductor, filteredTimeSystems);
}
LADMode.prototype = Object.create(FollowMode.prototype);
return LADMode;
}
);

View File

@ -1,55 +0,0 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
['./FollowMode'],
function (FollowMode) {
/**
* Class representing the 'realtime' mode of the time conductor.
* This is a special case of FollowMode that only supports 'clock'
* type tick sources.
* @param conductor
* @param timeSystems
* @constructor
*/
function RealtimeMode(conductor, timeSystems) {
var metadata = {
key: 'realtime',
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.'
};
var filteredTimeSystems = timeSystems.filter(function (timeSystem){
return timeSystem.tickSources().some(function (tickSource){
return tickSource.type() === 'clock';
});
});
FollowMode.call(this, metadata, conductor, filteredTimeSystems);
}
RealtimeMode.prototype = Object.create(FollowMode.prototype);
return RealtimeMode;
}
);

View File

@ -33,9 +33,7 @@ define(
* @constructor * @constructor
* @param {TimeConductorMetadata} metadata * @param {TimeConductorMetadata} metadata
*/ */
function TimeConductorMode(metadata, conductor, timeSystems) { function TimeConductorMode(conductor, timeSystems) {
this.metadata = metadata;
this.conductor = conductor; this.conductor = conductor;
this._timeSystems = timeSystems; this._timeSystems = timeSystems;
} }