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="pane left menu-items">
<ul>
<li ng-repeat="option in ngModel.options"
ng-click="ngModel.selected=option">
<li ng-repeat="(key, metadata) in ngModel.options"
ng-click="ngModel.selectedKey=key">
<a
ng-mouseover="representation.activeMetadata = option.metadata"
ng-mouseover="representation.activeMetadata = metadata"
ng-mouseleave="representation.activeMetadata = undefined">
<span class="ui-symbol icon type-icon">
{{option.metadata.glyph}}
{{metadata.glyph}}
</span>
{{option.metadata.name}}
{{metadata.name}}
</a>
</li>
</ul>

View File

@ -22,7 +22,8 @@
<span ng-controller="ClickAwayController as modeController">
<div class="s-menu-btn"
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 class="menu super-menu mini mode-selector-menu"
ng-show="modeController.isActive()">

View File

@ -1,6 +1,6 @@
<!-- Parent holder for time conductor. follow-mode | fixed-mode -->
<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="hand-little"></div>
@ -27,7 +27,7 @@
</mct-control>
</span>
<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'"
structure="{
@ -57,7 +57,7 @@
</mct-control>
</span>
<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'"
structure="{

View File

@ -23,11 +23,10 @@
define(
[
'./modes/FixedMode',
'./modes/RealtimeMode',
'./modes/LADMode',
'./modes/FollowMode',
'./TimeConductorValidation'
],
function (FixedMode, RealtimeMode, LADMode, TimeConductorValidation) {
function (FixedMode, FollowMode, TimeConductorValidation) {
function TimeConductorController($scope, conductor, timeSystems) {
@ -45,12 +44,28 @@ define(
this.timeSystems = timeSystems.map(function (timeSystemConstructor){
return timeSystemConstructor();
});
// Populate a list of modes supported by the time conductor
this.modes = [
new FixedMode(this.conductor, this.timeSystems),
new RealtimeMode(this.conductor, this.timeSystems),
new LADMode(this.conductor, this.timeSystems)
];
this.modes = {
'fixed': {
glyph: '\ue604',
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.$scope = $scope;
@ -63,14 +78,14 @@ define(
//Set the time conductor mode to the first one in the list,
// effectively initializing the time conductor
this.setMode(this.modes[0]);
this.setMode('fixed');
}
/**
* @private
*/
TimeConductorController.prototype.initializeScope = function ($scope) {
var self = this;
/*
Represents the various time system options, and the currently
selected time system in the view. Additionally holds the
@ -87,7 +102,7 @@ define(
selected mode in the view
*/
$scope.modeModel = {
selected: undefined,
selectedKey: undefined,
options: this.modes
};
/*
@ -98,13 +113,12 @@ define(
end: 0
};
$scope.$watch('modeModel.selected', this.setMode);
$scope.$watch('modeModel.selectedKey', this.setMode);
$scope.$watch('timeSystem', this.setTimeSystem);
$scope.$on('$destroy', function() {
var mode = $scope.modeModel.selected;
if (mode && mode.destroy) {
mode.destroy();
if (self.selectedMode) {
self.selectedMode.destroy();
}
});
};
@ -142,7 +156,7 @@ define(
* @see TimeConductorMode
*/
TimeConductorController.prototype.updateDeltasFromForm = function (formModel) {
var mode = this.$scope.modeModel.selected,
var mode = this.selectedMode,
deltas = mode.deltas();
if (deltas !== undefined && this.validation.validateDeltas(formModel)) {
@ -160,17 +174,42 @@ define(
*/
TimeConductorController.prototype.setMode = function (newMode, oldMode) {
if (newMode !== oldMode) {
if (oldMode) {
oldMode.destroy();
this.$scope.modeModel.selectedKey = newMode;
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();
this.$scope.modeModel.selected = newMode;
var timeSystem = this.selectedMode.selectedTimeSystem();
//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;
});
this.$scope.timeSystemModel.selected = timeSystem;
@ -221,7 +260,7 @@ define(
TimeConductorController.prototype.setTimeSystem = function (newTimeSystem) {
if (newTimeSystem && newTimeSystem !== this.$scope.timeSystemModel.selected) {
this.$scope.timeSystemModel.selected = newTimeSystem;
var mode = this.$scope.modeModel.selected;
var mode = this.selectedMode;
mode.selectedTimeSystem(newTimeSystem);
this.setDeltasFromTimeSystem(newTimeSystem);
}

View File

@ -33,15 +33,7 @@ define(
* @constructor
*/
function FixedMode(conductor, timeSystems) {
var metadata = {
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);
TimeConductorMode.call(this, conductor, timeSystems);
}
FixedMode.prototype = Object.create(TimeConductorMode.prototype);

View File

@ -33,8 +33,8 @@ define(
* the mode relevant, with both offsets defined relative to it.
* @constructor
*/
function FollowMode(metadata, conductor, timeSystems) {
TimeConductorMode.call(this, metadata, conductor, timeSystems);
function FollowMode(conductor, timeSystems) {
TimeConductorMode.call(this, conductor, timeSystems);
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
* @param {TimeConductorMetadata} metadata
*/
function TimeConductorMode(metadata, conductor, timeSystems) {
this.metadata = metadata;
function TimeConductorMode(conductor, timeSystems) {
this.conductor = conductor;
this._timeSystems = timeSystems;
}