mirror of
https://github.com/nasa/openmct.git
synced 2025-02-22 18:12:57 +00:00
Time Conductor state retained on navigation
This commit is contained in:
parent
34c62ba405
commit
b9c41107c1
@ -39,7 +39,7 @@ define([
|
|||||||
"key": "conductorService",
|
"key": "conductorService",
|
||||||
"implementation": ConductorService,
|
"implementation": ConductorService,
|
||||||
"depends": [
|
"depends": [
|
||||||
"timeConductor"
|
"timeConductorService"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -47,7 +47,7 @@ define([
|
|||||||
{
|
{
|
||||||
"implementation": ConductorRepresenter,
|
"implementation": ConductorRepresenter,
|
||||||
"depends": [
|
"depends": [
|
||||||
"timeConductor"
|
"timeConductorService"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -57,7 +57,7 @@ define([
|
|||||||
"provides": "telemetryService",
|
"provides": "telemetryService",
|
||||||
"implementation": ConductorTelemetryDecorator,
|
"implementation": ConductorTelemetryDecorator,
|
||||||
"depends": [
|
"depends": [
|
||||||
"timeConductor"
|
"timeConductorService"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -37,11 +37,11 @@ define(
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function ConductorRepresenter(
|
function ConductorRepresenter(
|
||||||
conductor,
|
conductorService,
|
||||||
scope,
|
scope,
|
||||||
element
|
element
|
||||||
) {
|
) {
|
||||||
this.conductor = conductor;
|
this.conductor = conductorService.conductor();
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
this.element = element;
|
this.element = element;
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@ define([
|
|||||||
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
function Conductor(timeConductor) {
|
function Conductor(timeConductorService) {
|
||||||
this.timeConductor = timeConductor;
|
this.timeConductor = timeConductorService.conductor();
|
||||||
}
|
}
|
||||||
|
|
||||||
Conductor.prototype.displayStart = function () {
|
Conductor.prototype.displayStart = function () {
|
||||||
|
@ -36,8 +36,8 @@ define(
|
|||||||
* the service which exposes the global time conductor
|
* the service which exposes the global time conductor
|
||||||
* @param {TelemetryService} telemetryService the decorated service
|
* @param {TelemetryService} telemetryService the decorated service
|
||||||
*/
|
*/
|
||||||
function ConductorTelemetryDecorator(conductor, telemetryService) {
|
function ConductorTelemetryDecorator(conductorService, telemetryService) {
|
||||||
this.conductor = conductor;
|
this.conductor = conductorService.conductor();
|
||||||
this.telemetryService = telemetryService;
|
this.telemetryService = telemetryService;
|
||||||
|
|
||||||
this.amendRequests = ConductorTelemetryDecorator.prototype.amendRequests.bind(this);
|
this.amendRequests = ConductorTelemetryDecorator.prototype.amendRequests.bind(this);
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
define([
|
define([
|
||||||
"./src/TimeConductor",
|
"./src/ui/TimeConductorService",
|
||||||
"./src/ui/TimeConductorController",
|
"./src/ui/TimeConductorController",
|
||||||
"./src/ui/MCTConductorAxis",
|
"./src/ui/MCTConductorAxis",
|
||||||
"text!./res/templates/time-conductor.html",
|
"text!./res/templates/time-conductor.html",
|
||||||
@ -29,7 +29,7 @@ define([
|
|||||||
"text!./res/templates/mode-selector/mode-menu.html",
|
"text!./res/templates/mode-selector/mode-menu.html",
|
||||||
'legacyRegistry'
|
'legacyRegistry'
|
||||||
], function (
|
], function (
|
||||||
TimeConductor,
|
TimeConductorService,
|
||||||
TimeConductorController,
|
TimeConductorController,
|
||||||
MCTConductorAxis,
|
MCTConductorAxis,
|
||||||
timeConductorTemplate,
|
timeConductorTemplate,
|
||||||
@ -42,8 +42,8 @@ define([
|
|||||||
"extensions": {
|
"extensions": {
|
||||||
"services": [
|
"services": [
|
||||||
{
|
{
|
||||||
"key": "timeConductor",
|
"key": "timeConductorService",
|
||||||
"implementation": TimeConductor
|
"implementation": TimeConductorService
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"controllers": [
|
"controllers": [
|
||||||
@ -52,7 +52,7 @@ define([
|
|||||||
"implementation": TimeConductorController,
|
"implementation": TimeConductorController,
|
||||||
"depends": [
|
"depends": [
|
||||||
"$scope",
|
"$scope",
|
||||||
"timeConductor",
|
"timeConductorService",
|
||||||
"timeSystems[]"
|
"timeSystems[]"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ define([
|
|||||||
"key": "mctConductorAxis",
|
"key": "mctConductorAxis",
|
||||||
"implementation": MCTConductorAxis,
|
"implementation": MCTConductorAxis,
|
||||||
"depends": [
|
"depends": [
|
||||||
"timeConductor",
|
"timeConductorService",
|
||||||
"formatService"
|
"formatService"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@
|
|||||||
class="holder flex-elem menus-up time-system"
|
class="holder flex-elem menus-up time-system"
|
||||||
structure="{
|
structure="{
|
||||||
text: timeSystemModel.selected.metadata.name,
|
text: timeSystemModel.selected.metadata.name,
|
||||||
click: tcController.selectTimeSystem,
|
click: tcController.selectTimeSystemByKey,
|
||||||
options: timeSystemModel.options
|
options: timeSystemModel.options
|
||||||
}">
|
}">
|
||||||
</mct-control>
|
</mct-control>
|
||||||
|
@ -32,7 +32,8 @@ define(
|
|||||||
* labelled 'ticks'. It requires 'start' and 'end' integer values to
|
* labelled 'ticks'. It requires 'start' and 'end' integer values to
|
||||||
* be specified as attributes.
|
* be specified as attributes.
|
||||||
*/
|
*/
|
||||||
function MCTConductorAxis(conductor, formatService) {
|
function MCTConductorAxis(conductorService, formatService) {
|
||||||
|
var conductor = conductorService.conductor();
|
||||||
|
|
||||||
function link(scope, element, attrs, ngModelController) {
|
function link(scope, element, attrs, ngModelController) {
|
||||||
var target = element[0].firstChild,
|
var target = element[0].firstChild,
|
||||||
|
@ -28,7 +28,7 @@ define(
|
|||||||
],
|
],
|
||||||
function (FixedMode, FollowMode, TimeConductorValidation) {
|
function (FixedMode, FollowMode, TimeConductorValidation) {
|
||||||
|
|
||||||
function TimeConductorController($scope, conductor, timeSystems) {
|
function TimeConductorController($scope, conductorService, timeSystems) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
@ -39,7 +39,14 @@ define(
|
|||||||
self[key] = self[key].bind(self);
|
self[key] = self[key].bind(self);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.conductor = conductor;
|
this.conductorService = conductorService;
|
||||||
|
this.conductor = conductorService.conductor();
|
||||||
|
|
||||||
|
this.conductor.on('bounds', this.setBounds);
|
||||||
|
this.conductor.on('follow', function (follow){
|
||||||
|
$scope.followMode = follow;
|
||||||
|
});
|
||||||
|
|
||||||
// Construct the provided time system definitions
|
// Construct the provided time system definitions
|
||||||
this._timeSystems = timeSystems.map(function (timeSystemConstructor){
|
this._timeSystems = timeSystems.map(function (timeSystemConstructor){
|
||||||
return timeSystemConstructor();
|
return timeSystemConstructor();
|
||||||
@ -61,7 +68,7 @@ define(
|
|||||||
label: 'Real-time',
|
label: 'Real-time',
|
||||||
name: 'Real-time Mode',
|
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.'
|
description: 'Monitor real-time streaming data as it comes in. The Time Conductor and displays will automatically advance themselves based on a UTC clock.'
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
//Only show 'real-time mode' if a clock source is available
|
//Only show 'real-time mode' if a clock source is available
|
||||||
@ -71,66 +78,54 @@ define(
|
|||||||
label: 'LAD',
|
label: 'LAD',
|
||||||
name: 'LAD Mode',
|
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.'
|
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.selectedMode = undefined;
|
this.validation = new TimeConductorValidation(this.conductor);
|
||||||
|
|
||||||
this.validation = new TimeConductorValidation(conductor);
|
|
||||||
this.$scope = $scope;
|
this.$scope = $scope;
|
||||||
this.initializeScope($scope);
|
|
||||||
|
|
||||||
conductor.on('bounds', this.setBounds);
|
|
||||||
conductor.on('follow', function (follow){
|
|
||||||
$scope.followMode = follow;
|
|
||||||
});
|
|
||||||
|
|
||||||
//Set the time conductor mode to the first one in the list,
|
|
||||||
// effectively initializing the time conductor
|
|
||||||
this.setMode('fixed');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
TimeConductorController.prototype.initializeScope = function ($scope) {
|
|
||||||
var self = this;
|
|
||||||
/*
|
/*
|
||||||
Represents the various time system options, and the currently
|
Set time Conductor bounds in the form
|
||||||
selected time system in the view. Additionally holds the
|
|
||||||
default format from the selected time system for convenience
|
|
||||||
of access from the template.
|
|
||||||
*/
|
*/
|
||||||
$scope.timeSystemModel = {
|
$scope.formModel = this.conductor.bounds();
|
||||||
selected: undefined,
|
|
||||||
format: undefined,
|
/*
|
||||||
options: []
|
Represents the various time system options, and the currently
|
||||||
};
|
selected time system in the view. Additionally holds the
|
||||||
|
default format from the selected time system for convenience
|
||||||
|
of access from the template.
|
||||||
|
*/
|
||||||
|
$scope.timeSystemModel = {};
|
||||||
|
if (this.conductor.timeSystem()) {
|
||||||
|
$scope.timeSystemModel.selected = this.conductor.timeSystem();
|
||||||
|
$scope.timeSystemModel.format = this.conductor.timeSystem().formats()[0];
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Represents the various modes, and the currently
|
Represents the various modes, and the currently
|
||||||
selected mode in the view
|
selected mode in the view
|
||||||
*/
|
*/
|
||||||
$scope.modeModel = {
|
$scope.modeModel = {
|
||||||
selectedKey: undefined,
|
|
||||||
options: this.modes
|
options: this.modes
|
||||||
};
|
};
|
||||||
/*
|
|
||||||
Time Conductor bounds in the form
|
var mode = conductorService.mode();
|
||||||
*/
|
if (mode) {
|
||||||
$scope.formModel = {
|
$scope.modeModel.selectedKey = mode.key();
|
||||||
start: 0,
|
var deltas = mode.deltas && mode.deltas();
|
||||||
end: 0
|
if (deltas) {
|
||||||
};
|
$scope.formModel.startDelta = deltas.start;
|
||||||
|
$scope.formModel.endDelta = deltas.end;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Default to fixed mode
|
||||||
|
this.setMode('fixed');
|
||||||
|
}
|
||||||
|
|
||||||
$scope.$watch('modeModel.selectedKey', this.setMode);
|
$scope.$watch('modeModel.selectedKey', this.setMode);
|
||||||
$scope.$watch('timeSystem', this.setTimeSystem);
|
$scope.$watch('timeSystem', this.setTimeSystem);
|
||||||
|
|
||||||
$scope.$on('$destroy', function() {
|
}
|
||||||
if (self.selectedMode) {
|
|
||||||
self.selectedMode.destroy();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the bounds change in the time conductor. Synchronizes
|
* Called when the bounds change in the time conductor. Synchronizes
|
||||||
@ -165,7 +160,7 @@ define(
|
|||||||
* @see TimeConductorMode
|
* @see TimeConductorMode
|
||||||
*/
|
*/
|
||||||
TimeConductorController.prototype.updateDeltasFromForm = function (formModel) {
|
TimeConductorController.prototype.updateDeltasFromForm = function (formModel) {
|
||||||
var mode = this.selectedMode,
|
var mode = this.conductorService.mode(),
|
||||||
deltas = mode.deltas();
|
deltas = mode.deltas();
|
||||||
|
|
||||||
if (deltas !== undefined && this.validation.validateDeltas(formModel)) {
|
if (deltas !== undefined && this.validation.validateDeltas(formModel)) {
|
||||||
@ -193,37 +188,39 @@ define(
|
|||||||
* Change the selected Time Conductor mode. This will call destroy
|
* Change the selected Time Conductor mode. This will call destroy
|
||||||
* and initialization functions on the relevant modes, setting
|
* and initialization functions on the relevant modes, setting
|
||||||
* default values for bound and deltas in the form.
|
* default values for bound and deltas in the form.
|
||||||
* @param newMode
|
* @param newModeKey
|
||||||
* @param oldMode
|
* @param oldModeKey
|
||||||
*/
|
*/
|
||||||
TimeConductorController.prototype.setMode = function (newMode, oldMode) {
|
TimeConductorController.prototype.setMode = function (newModeKey, oldModeKey) {
|
||||||
if (newMode !== oldMode) {
|
if (newModeKey !== oldModeKey) {
|
||||||
this.$scope.modeModel.selectedKey = newMode;
|
var newMode = undefined;
|
||||||
|
this.$scope.modeModel.selectedKey = newModeKey;
|
||||||
|
|
||||||
if (this.selectedMode) {
|
if (this.conductorService.mode()) {
|
||||||
this.selectedMode.destroy();
|
this.conductorService.mode().destroy();
|
||||||
}
|
}
|
||||||
switch (newMode) {
|
|
||||||
|
switch (newModeKey) {
|
||||||
case 'fixed':
|
case 'fixed':
|
||||||
this.selectedMode = new FixedMode(this.conductor, this._timeSystems);
|
newMode = new FixedMode(this.conductor, this._timeSystems, newModeKey);
|
||||||
break;
|
break;
|
||||||
case 'realtime':
|
case 'realtime':
|
||||||
// Filter time systems to only those with clock tick
|
// Filter time systems to only those with clock tick
|
||||||
// sources
|
// sources
|
||||||
this.selectedMode = new FollowMode(this.conductor, this.timeSystemsForSourceType('clock'));
|
newMode = new FollowMode(this.conductor, this.timeSystemsForSourceType('clock'), newModeKey);
|
||||||
break;
|
break;
|
||||||
case 'latest':
|
case 'latest':
|
||||||
// Filter time systems to only those with data tick
|
// Filter time systems to only those with data tick
|
||||||
// sources
|
// sources
|
||||||
this.selectedMode = new FollowMode(this.conductor, this.timeSystemsForSourceType('data'));
|
newMode = new FollowMode(this.conductor, this.timeSystemsForSourceType('data'), newModeKey);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.selectedMode.initialize();
|
newMode.initialize();
|
||||||
|
this.conductorService.mode(newMode);
|
||||||
var timeSystem = this.selectedMode.selectedTimeSystem();
|
var timeSystem = newMode.selectedTimeSystem();
|
||||||
|
|
||||||
//Synchronize scope with time system on mode
|
//Synchronize scope with time system on mode
|
||||||
this.$scope.timeSystemModel.options = this.selectedMode.timeSystems().map(function (timeSystem) {
|
this.$scope.timeSystemModel.options = newMode.timeSystems().map(function (timeSystem) {
|
||||||
return timeSystem.metadata;
|
return timeSystem.metadata;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -257,7 +254,7 @@ define(
|
|||||||
* @param key
|
* @param key
|
||||||
* @see TimeConductorController#setTimeSystem
|
* @see TimeConductorController#setTimeSystem
|
||||||
*/
|
*/
|
||||||
TimeConductorController.prototype.selectTimeSystem = function(key){
|
TimeConductorController.prototype.selectTimeSystemByKey = function(key){
|
||||||
var selected = this._timeSystems.find(function (timeSystem){
|
var selected = this._timeSystems.find(function (timeSystem){
|
||||||
return timeSystem.metadata.key === key;
|
return timeSystem.metadata.key === key;
|
||||||
});
|
});
|
||||||
@ -273,7 +270,7 @@ define(
|
|||||||
if (newTimeSystem && newTimeSystem !== this.$scope.timeSystemModel.selected) {
|
if (newTimeSystem && newTimeSystem !== this.$scope.timeSystemModel.selected) {
|
||||||
this.$scope.timeSystemModel.selected = newTimeSystem;
|
this.$scope.timeSystemModel.selected = newTimeSystem;
|
||||||
this.$scope.timeSystemModel.format = newTimeSystem.formats()[0];
|
this.$scope.timeSystemModel.format = newTimeSystem.formats()[0];
|
||||||
var mode = this.selectedMode;
|
var mode = this.conductorService.mode();
|
||||||
mode.selectedTimeSystem(newTimeSystem);
|
mode.selectedTimeSystem(newTimeSystem);
|
||||||
this.setDeltasFromTimeSystem(newTimeSystem);
|
this.setDeltasFromTimeSystem(newTimeSystem);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* 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(
|
||||||
|
['../TimeConductor'],
|
||||||
|
function (TimeConductor) {
|
||||||
|
|
||||||
|
function TimeConductorService() {
|
||||||
|
this._conductor = new TimeConductor();
|
||||||
|
this._mode = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
TimeConductorService.prototype.mode = function (mode) {
|
||||||
|
if (arguments.length === 1) {
|
||||||
|
this._mode = mode;
|
||||||
|
}
|
||||||
|
return this._mode;
|
||||||
|
};
|
||||||
|
|
||||||
|
TimeConductorService.prototype.conductor = function () {
|
||||||
|
return this._conductor;
|
||||||
|
};
|
||||||
|
|
||||||
|
return TimeConductorService;
|
||||||
|
}
|
||||||
|
);
|
@ -32,8 +32,8 @@ define(
|
|||||||
* @param timeSystems
|
* @param timeSystems
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function FixedMode(conductor, timeSystems) {
|
function FixedMode(conductor, timeSystems, key) {
|
||||||
TimeConductorMode.call(this, conductor, timeSystems);
|
TimeConductorMode.call(this, conductor, timeSystems, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
FixedMode.prototype = Object.create(TimeConductorMode.prototype);
|
FixedMode.prototype = Object.create(TimeConductorMode.prototype);
|
||||||
|
@ -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(conductor, timeSystems) {
|
function FollowMode(conductor, timeSystems, key) {
|
||||||
TimeConductorMode.call(this, conductor, timeSystems);
|
TimeConductorMode.call(this, conductor, timeSystems, key);
|
||||||
|
|
||||||
this._deltas = undefined;
|
this._deltas = undefined;
|
||||||
}
|
}
|
||||||
|
@ -33,9 +33,10 @@ define(
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @param {TimeConductorMetadata} metadata
|
* @param {TimeConductorMetadata} metadata
|
||||||
*/
|
*/
|
||||||
function TimeConductorMode(conductor, timeSystems) {
|
function TimeConductorMode(conductor, timeSystems, key) {
|
||||||
this.conductor = conductor;
|
this.conductor = conductor;
|
||||||
this._timeSystems = timeSystems;
|
this._timeSystems = timeSystems;
|
||||||
|
this._key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,6 +73,10 @@ define(
|
|||||||
return this._selectedTimeSystem;
|
return this._selectedTimeSystem;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TimeConductorMode.prototype.key = function () {
|
||||||
|
return this._key;
|
||||||
|
};
|
||||||
|
|
||||||
TimeConductorMode.prototype.destroy = function () {
|
TimeConductorMode.prototype.destroy = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user