-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added compatibility layer to support existing plots and historical ta…
…bles
- Loading branch information
Showing
7 changed files
with
236 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
] | ||
} | ||
] | ||
} | ||
}); | ||
}); |
75 changes: 75 additions & 0 deletions
75
platform/features/conductor-v2-compatibility/src/ConductorRepresenter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
); | ||
|
71 changes: 71 additions & 0 deletions
71
platform/features/conductor-v2-compatibility/src/ConductorTelemetryDecorator.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters