Skip to content

Commit 9b58aa0

Browse files
author
Pete Richards
committed
[TCv2] Add conductorService for compatibility
Add conductor service for compatibility with old plugins that depend on the conductor service.
1 parent ce5d0ef commit 9b58aa0

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed

platform/features/conductor-v2/compatibility/bundle.js

+11
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,26 @@
2323
define([
2424
"./src/ConductorTelemetryDecorator",
2525
"./src/ConductorRepresenter",
26+
"./src/ConductorService",
2627
'legacyRegistry'
2728
], function (
2829
ConductorTelemetryDecorator,
2930
ConductorRepresenter,
31+
ConductorService,
3032
legacyRegistry
3133
) {
3234

3335
legacyRegistry.register("platform/features/conductor-v2/compatibility", {
3436
"extensions": {
37+
"services": [
38+
{
39+
"key": "conductorService",
40+
"implementation": ConductorService,
41+
"depends": [
42+
"timeConductor"
43+
]
44+
}
45+
],
3546
"representers": [
3647
{
3748
"implementation": ConductorRepresenter,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*****************************************************************************
2+
* Open MCT Web, Copyright (c) 2014-2015, United States Government
3+
* as represented by the Administrator of the National Aeronautics and Space
4+
* Administration. All rights reserved.
5+
*
6+
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
* http://www.apache.org/licenses/LICENSE-2.0.
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
* License for the specific language governing permissions and limitations
15+
* under the License.
16+
*
17+
* Open MCT Web includes source code licensed under additional open source
18+
* licenses. See the Open Source Licenses file (LICENSES.md) included with
19+
* this source code distribution or the Licensing information page available
20+
* at runtime from the About dialog for additional information.
21+
*****************************************************************************/
22+
23+
define([
24+
25+
], function (
26+
27+
) {
28+
29+
function Conductor(timeConductor) {
30+
this.timeConductor = timeConductor;
31+
}
32+
33+
Conductor.prototype.displayStart = function () {
34+
return this.timeConductor.bounds().start;
35+
};
36+
37+
Conductor.prototype.displayEnd = function () {
38+
return this.timeConductor.bounds().end;
39+
};
40+
41+
Conductor.prototype.domainOptions = function () {
42+
throw new Error([
43+
'domainOptions not implemented in compatibility layer,',
44+
' you must be using some crazy unknown code'
45+
].join(''));
46+
};
47+
48+
Conductor.prototype.domain = function () {
49+
var system = this.timeConductor.timeSystem();
50+
return {
51+
key: system.metadata.key,
52+
name: system.metadata.name,
53+
format: system.formats()[0]
54+
};
55+
};
56+
57+
/**
58+
* Small compatibility layer that implements old conductor service by
59+
* wrapping new time conductor. This allows views that previously depended
60+
* directly on the conductor service to continue to do so without
61+
* modification.
62+
*/
63+
function ConductorService(timeConductor) {
64+
this.tc = new Conductor(timeConductor);
65+
}
66+
67+
ConductorService.prototype.getConductor = function () {
68+
return this.tc;
69+
}
70+
71+
return ConductorService;
72+
});

0 commit comments

Comments
 (0)