From 4a046b3eea5f0a925235da0e80af422d18808fa7 Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Tue, 17 Jul 2018 13:57:38 -0700 Subject: [PATCH] Adapter consolidation & fix incorrect export to window (#2114) * Merge adapter bundles Merge adapter bundles into consistent location. Update telemetry API to not incorrectly expose the format service on window. * openmct available on window for developers * remove offending comma --- index.html | 1 + src/adapter/bundle.js | 27 ++++++++- .../runs}/LegacyTelemetryProvider.js | 2 +- .../services}/LegacyObjectAPIInterceptor.js | 2 +- src/api/objects/bundle.js | 51 ----------------- src/api/telemetry/bundle.js | 55 ------------------- src/defaultRegistry.js | 4 -- 7 files changed, 28 insertions(+), 114 deletions(-) rename src/{api/telemetry => adapter/runs}/LegacyTelemetryProvider.js (99%) rename src/{api/objects => adapter/services}/LegacyObjectAPIInterceptor.js (99%) delete mode 100644 src/api/objects/bundle.js delete mode 100644 src/api/telemetry/bundle.js diff --git a/index.html b/index.html index d0d98eab71..c03d62a2d3 100644 --- a/index.html +++ b/index.html @@ -73,6 +73,7 @@ openmct.time.clock('local', {start: -THIRTY_MINUTES, end: 0}); openmct.time.timeSystem('utc'); openmct.start(); + window.openmct = openmct; }); diff --git a/src/adapter/bundle.js b/src/adapter/bundle.js index 7a79661926..fef4bd9939 100644 --- a/src/adapter/bundle.js +++ b/src/adapter/bundle.js @@ -32,7 +32,9 @@ define([ './policies/AdaptedViewPolicy', './runs/AlternateCompositionInitializer', './runs/TimeSettingsURLHandler', - './runs/TypeDeprecationChecker' + './runs/TypeDeprecationChecker', + './runs/LegacyTelemetryProvider', + './services/LegacyObjectAPIInterceptor' ], function ( legacyRegistry, ActionDialogDecorator, @@ -45,7 +47,9 @@ define([ AdaptedViewPolicy, AlternateCompositionInitializer, TimeSettingsURLHandler, - TypeDeprecationChecker + TypeDeprecationChecker, + LegacyTelemetryProvider, + LegacyObjectAPIInterceptor ) { legacyRegistry.register('src/adapter', { "extensions": { @@ -94,6 +98,18 @@ define([ provides: "modelService", implementation: MissingModelCompatibilityDecorator, depends: ["openmct"] + }, + { + provides: "objectService", + type: "decorator", + priority: "mandatory", + implementation: LegacyObjectAPIInterceptor, + depends: [ + "openmct", + "roots[]", + "instantiate", + "topic" + ] } ], policies: [ @@ -126,6 +142,13 @@ define([ ); }, depends: ["openmct", "$location", "$rootScope"] + }, + { + implementation: LegacyTelemetryProvider, + depends: [ + "openmct", + "instantiate" + ] } ], licenses: [ diff --git a/src/api/telemetry/LegacyTelemetryProvider.js b/src/adapter/runs/LegacyTelemetryProvider.js similarity index 99% rename from src/api/telemetry/LegacyTelemetryProvider.js rename to src/adapter/runs/LegacyTelemetryProvider.js index d183bbb550..29f5869ccb 100644 --- a/src/api/telemetry/LegacyTelemetryProvider.js +++ b/src/adapter/runs/LegacyTelemetryProvider.js @@ -21,7 +21,7 @@ *****************************************************************************/ define([ - '../objects/object-utils' + '../../api/objects/object-utils' ], function ( utils ) { diff --git a/src/api/objects/LegacyObjectAPIInterceptor.js b/src/adapter/services/LegacyObjectAPIInterceptor.js similarity index 99% rename from src/api/objects/LegacyObjectAPIInterceptor.js rename to src/adapter/services/LegacyObjectAPIInterceptor.js index a04812d237..df8d05afde 100644 --- a/src/api/objects/LegacyObjectAPIInterceptor.js +++ b/src/adapter/services/LegacyObjectAPIInterceptor.js @@ -21,7 +21,7 @@ *****************************************************************************/ define([ - './object-utils' + '../../api/objects/object-utils' ], function ( utils ) { diff --git a/src/api/objects/bundle.js b/src/api/objects/bundle.js deleted file mode 100644 index 5b3769d6c7..0000000000 --- a/src/api/objects/bundle.js +++ /dev/null @@ -1,51 +0,0 @@ -/***************************************************************************** - * Open MCT, Copyright (c) 2014-2018, United States Government - * as represented by the Administrator of the National Aeronautics and Space - * Administration. All rights reserved. - * - * Open MCT 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 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. - *****************************************************************************/ -/*global define*/ - -define([ - './LegacyObjectAPIInterceptor', - 'legacyRegistry' -], function ( - LegacyObjectAPIInterceptor, - legacyRegistry -) { - legacyRegistry.register('src/api/objects', { - name: 'Object API', - description: 'The public Objects API', - extensions: { - components: [ - { - provides: "objectService", - type: "decorator", - priority: "mandatory", - implementation: LegacyObjectAPIInterceptor, - depends: [ - "openmct", - "roots[]", - "instantiate", - "topic" - ] - } - ] - } - }); -}); diff --git a/src/api/telemetry/bundle.js b/src/api/telemetry/bundle.js deleted file mode 100644 index 9e0cd2263a..0000000000 --- a/src/api/telemetry/bundle.js +++ /dev/null @@ -1,55 +0,0 @@ -/***************************************************************************** - * Open MCT, Copyright (c) 2014-2018, United States Government - * as represented by the Administrator of the National Aeronautics and Space - * Administration. All rights reserved. - * - * Open MCT 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 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([ - './TelemetryAPI', - './LegacyTelemetryProvider', - 'legacyRegistry' -], function ( - TelemetryAPI, - LegacyTelemetryProvider, - legacyRegistry -) { - legacyRegistry.register('src/api/telemetry', { - name: 'Telemetry API', - description: 'The public Telemetry API', - extensions: { - runs: [ - { - key: "TelemetryAPI", - implementation: TelemetryAPI, - depends: [ - 'formatService' - ] - }, - { - key: "LegacyTelemetryAdapter", - implementation: LegacyTelemetryProvider, - depends: [ - "openmct", - "instantiate" - ] - } - ] - } - }); -}); diff --git a/src/defaultRegistry.js b/src/defaultRegistry.js index 60e9f634ad..e2ebc0de7e 100644 --- a/src/defaultRegistry.js +++ b/src/defaultRegistry.js @@ -24,8 +24,6 @@ define([ 'legacyRegistry', '../src/adapter/bundle', - '../src/api/objects/bundle', - '../src/api/telemetry/bundle', '../example/builtins/bundle', '../example/composite/bundle', @@ -93,8 +91,6 @@ define([ var DEFAULTS = [ 'src/adapter', - 'src/api/objects', - 'src/api/telemetry', 'platform/framework', 'platform/core', 'platform/representation',