From 2a193943346dd921794ba938c510df805dd10ae8 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 19 Jul 2016 19:54:52 -0700 Subject: [PATCH 1/3] Added compatibility layer to support existing plots and historical tables --- main.js | 1 + .../conductor-v2-compatibility/bundle.js | 55 ++++++++++++++ .../src/ConductorRepresenter.js | 75 +++++++++++++++++++ .../src/ConductorTelemetryDecorator.js | 71 ++++++++++++++++++ platform/features/plot/src/PlotController.js | 17 +++-- .../controllers/HistoricalTableController.js | 22 ++++++ .../controllers/TelemetryTableController.js | 5 -- 7 files changed, 235 insertions(+), 11 deletions(-) create mode 100644 platform/features/conductor-v2-compatibility/bundle.js create mode 100644 platform/features/conductor-v2-compatibility/src/ConductorRepresenter.js create mode 100644 platform/features/conductor-v2-compatibility/src/ConductorTelemetryDecorator.js diff --git a/main.js b/main.js index 5873209ade..19ad4c6118 100644 --- a/main.js +++ b/main.js @@ -91,6 +91,7 @@ define([ './platform/features/plot/bundle', './platform/features/timeline/bundle', './platform/features/conductor-v2/bundle', + './platform/features/conductor-v2-compatibility/bundle', './platform/features/table/bundle', './platform/forms/bundle', './platform/identity/bundle', diff --git a/platform/features/conductor-v2-compatibility/bundle.js b/platform/features/conductor-v2-compatibility/bundle.js new file mode 100644 index 0000000000..967a189488 --- /dev/null +++ b/platform/features/conductor-v2-compatibility/bundle.js @@ -0,0 +1,55 @@ +/***************************************************************************** + * 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([ + "./src/ConductorTelemetryDecorator", + "./src/ConductorRepresenter", + 'legacyRegistry' +], function ( + ConductorTelemetryDecorator, + ConductorRepresenter, + legacyRegistry +) { + + legacyRegistry.register("platform/features/conductor-v2-compatibility", { + "extensions": { + "representers": [ + { + "implementation": ConductorRepresenter, + "depends": [ + "timeConductor" + ] + } + ], + "components": [ + { + "type": "decorator", + "provides": "telemetryService", + "implementation": ConductorTelemetryDecorator, + "depends": [ + "timeConductor" + ] + } + ] + } + }); +}); diff --git a/platform/features/conductor-v2-compatibility/src/ConductorRepresenter.js b/platform/features/conductor-v2-compatibility/src/ConductorRepresenter.js new file mode 100644 index 0000000000..973a0e8ba4 --- /dev/null +++ b/platform/features/conductor-v2-compatibility/src/ConductorRepresenter.js @@ -0,0 +1,75 @@ +/***************************************************************************** + * 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( + [], + function () { + + function ConductorRepresenter( + conductor, + scope, + element + ) { + this.conductor = conductor; + this.scope = scope; + this.element = element; + + this.boundsListener = this.boundsListener.bind(this); + this.timeSystemListener = this.timeSystemListener.bind(this); + } + + ConductorRepresenter.prototype.boundsListener = function (bounds) { + this.scope.$broadcast('telemetry:display:bounds', { + start: bounds.start, + end: bounds.end, + domain: this.conductor.timeSystem().metadata.key + }, this.conductor.follow()); + }; + + ConductorRepresenter.prototype.timeSystemListener = function (timeSystem) { + var bounds = this.conductor.bounds(); + this.scope.$broadcast('telemetry:display:bounds', { + start: bounds.start, + end: bounds.end, + domain: timeSystem.metadata.key + }); + }; + + // Handle a specific representation of a specific domain object + ConductorRepresenter.prototype.represent = function represent(representation) { + if (representation.key === 'browse-object') { + this.destroy(); + + this.conductor.on("bounds", this.boundsListener); + this.conductor.on("timeSystem", this.timeSystemListener); + } + }; + + ConductorRepresenter.prototype.destroy = function destroy() { + this.conductor.off("bounds", this.boundsListener); + this.conductor.off("timeSystem", this.timeSystemListener); + }; + + return ConductorRepresenter; + } +); + diff --git a/platform/features/conductor-v2-compatibility/src/ConductorTelemetryDecorator.js b/platform/features/conductor-v2-compatibility/src/ConductorTelemetryDecorator.js new file mode 100644 index 0000000000..e661091b54 --- /dev/null +++ b/platform/features/conductor-v2-compatibility/src/ConductorTelemetryDecorator.js @@ -0,0 +1,71 @@ +/***************************************************************************** + * 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( + function () { + + /** + * Decorates the `telemetryService` such that requests are + * mediated by the time conductor. This is a modified version of the + * decorator used in the old TimeConductor that integrates with the + * new TimeConductor API. + * + * @constructor + * @memberof platform/features/conductor + * @implements {TelemetryService} + * @param {platform/features/conductor.TimeConductor} conductor + * the service which exposes the global time conductor + * @param {TelemetryService} telemetryService the decorated service + */ + function ConductorTelemetryDecorator(conductor, telemetryService) { + this.conductor = conductor; + this.telemetryService = telemetryService; + } + + ConductorTelemetryDecorator.prototype.amendRequests = function (requests) { + var bounds = this.conductor.bounds(), + timeSystem = this.conductor.timeSystem(); + + function amendRequest(request) { + request = request || {}; + request.start = bounds.start; + request.end = bounds.end; + request.domain = timeSystem.metadata.key; + return request; + } + + return (requests || []).map(amendRequest); + }; + + ConductorTelemetryDecorator.prototype.requestTelemetry = function (requests) { + return this.telemetryService + .requestTelemetry(this.amendRequests(requests)); + }; + + ConductorTelemetryDecorator.prototype.subscribe = function (callback, requests) { + return this.telemetryService + .subscribe(callback, requests); + }; + + return ConductorTelemetryDecorator; + } +); diff --git a/platform/features/plot/src/PlotController.js b/platform/features/plot/src/PlotController.js index 2525657501..1168c7b573 100644 --- a/platform/features/plot/src/PlotController.js +++ b/platform/features/plot/src/PlotController.js @@ -227,13 +227,18 @@ define( } // Respond to a display bounds change (requery for data) - function changeDisplayBounds(event, bounds) { - var domainAxis = $scope.axes[0]; + function changeDisplayBounds(event, bounds, follow) { + //'hack' for follow mode + if (follow === true){ + setBasePanZoom(bounds); + } else { + var domainAxis = $scope.axes[0]; - domainAxis.chooseOption(bounds.domain); - updateDomainFormat(); - setBasePanZoom(bounds); - requery(); + domainAxis.chooseOption(bounds.domain); + updateDomainFormat(); + setBasePanZoom(bounds); + requery(); + } } this.modeOptions = new PlotModeOptions([], subPlotFactory); diff --git a/platform/features/table/src/controllers/HistoricalTableController.js b/platform/features/table/src/controllers/HistoricalTableController.js index 5441d5587f..c6b05ba536 100644 --- a/platform/features/table/src/controllers/HistoricalTableController.js +++ b/platform/features/table/src/controllers/HistoricalTableController.js @@ -63,6 +63,28 @@ define( this.$scope.loading = false; }; + /** + * @private + */ + HistoricalTableController.prototype.registerChangeListeners = function () { + TableController.prototype.registerChangeListeners.call(this); + //Change of bounds in time conductor + this.changeListeners.push(this.$scope.$on('telemetry:display:bounds', + this.boundsChange.bind(this)) + ); + }; + + /** + * @private + */ + 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) { + this.subscribe(); + } + }; + /** * Processes an array of objects, formatting the telemetry available * for them and setting it on scope when done diff --git a/platform/features/table/src/controllers/TelemetryTableController.js b/platform/features/table/src/controllers/TelemetryTableController.js index 459a61c8b0..6145155a66 100644 --- a/platform/features/table/src/controllers/TelemetryTableController.js +++ b/platform/features/table/src/controllers/TelemetryTableController.js @@ -96,11 +96,6 @@ define( } }) ); - - //Change of bounds in time conductor - this.changeListeners.push(this.$scope.$on('telemetry:display:bounds', - this.subscribe.bind(this)) - ); }; /** From ea1defac28800f9b7219b4189cdc332e29f3a4f0 Mon Sep 17 00:00:00 2001 From: Charles Hacskaylo Date: Tue, 19 Jul 2016 18:33:24 -0700 Subject: [PATCH 2/3] [Frontend] Renew support for Time Conductor v1 Fixes #933 Time Conductors v1 and v2 now build and load their own isolated CSS files. All previous styling for TCv1 should be re-enabled. Note that Conductor v2 mobile is not complete yet. --- .../commonUI/general/res/sass/_constants.scss | 1 - platform/commonUI/general/res/sass/_main.scss | 1 - .../templates/controls/time-controller.html | 4 +- platform/features/conductor-v2/bundle.js | 5 + .../res/sass/time-conductor.scss} | 41 ++- platform/features/conductor/bundle.js | 5 + .../conductor/res/sass/time-conductor.scss | 298 ++++++++++++++++++ 7 files changed, 347 insertions(+), 8 deletions(-) rename platform/{commonUI/general/res/sass/controls/_time-conductor.scss => features/conductor-v2/res/sass/time-conductor.scss} (84%) create mode 100644 platform/features/conductor/res/sass/time-conductor.scss diff --git a/platform/commonUI/general/res/sass/_constants.scss b/platform/commonUI/general/res/sass/_constants.scss index 3946d4f706..8b537bbbad 100644 --- a/platform/commonUI/general/res/sass/_constants.scss +++ b/platform/commonUI/general/res/sass/_constants.scss @@ -48,7 +48,6 @@ $uePaneMiniTabW: 10px; $uePaneMiniTabCollapsedW: 11px; $ueEditLeftPaneW: 75%; $treeSearchInputBarH: 25px; -$ueTimeControlH: (25px, 6px, 20px); /*************** Panes */ $ueBrowseLeftPaneTreeMinW: 150px; $ueBrowseLeftPaneTreeMaxW: 35%; diff --git a/platform/commonUI/general/res/sass/_main.scss b/platform/commonUI/general/res/sass/_main.scss index e000578868..c348403335 100644 --- a/platform/commonUI/general/res/sass/_main.scss +++ b/platform/commonUI/general/res/sass/_main.scss @@ -41,7 +41,6 @@ @import "controls/lists"; @import "controls/menus"; @import "controls/messages"; -@import "controls/time-conductor"; @import "mobile/controls/menus"; /********************************* FORMS */ diff --git a/platform/commonUI/general/res/templates/controls/time-controller.html b/platform/commonUI/general/res/templates/controls/time-controller.html index ed532029b2..98c5de38e8 100644 --- a/platform/commonUI/general/res/templates/controls/time-controller.html +++ b/platform/commonUI/general/res/templates/controls/time-controller.html @@ -20,7 +20,7 @@ at runtime from the About dialog for additional information. -->
-
C @@ -86,7 +86,7 @@
-
+
Date: Tue, 19 Jul 2016 20:17:06 -0700 Subject: [PATCH 3/3] Modified main.js --- main.js | 1 + 1 file changed, 1 insertion(+) diff --git a/main.js b/main.js index 19ad4c6118..f2b0395f3e 100644 --- a/main.js +++ b/main.js @@ -90,6 +90,7 @@ define([ './platform/features/pages/bundle', './platform/features/plot/bundle', './platform/features/timeline/bundle', + //'./platform/features/conductor/bundle', './platform/features/conductor-v2/bundle', './platform/features/conductor-v2-compatibility/bundle', './platform/features/table/bundle',