mirror of
https://github.com/nasa/openmct.git
synced 2025-04-09 04:14:32 +00:00
[Roots] Add new root model provider
...to read roots from the new API's registry.
This commit is contained in:
parent
7b0506bbdb
commit
650824574c
@ -23,6 +23,7 @@
|
||||
define([
|
||||
'legacyRegistry',
|
||||
'./actions/ActionDialogDecorator',
|
||||
'./components/NewRootModelProvider',
|
||||
'./directives/MCTView',
|
||||
'./services/Instantiate',
|
||||
'./capabilities/APICapabilityDecorator',
|
||||
@ -32,6 +33,7 @@ define([
|
||||
], function (
|
||||
legacyRegistry,
|
||||
ActionDialogDecorator,
|
||||
NewRootModelProvider,
|
||||
MCTView,
|
||||
Instantiate,
|
||||
APICapabilityDecorator,
|
||||
@ -77,6 +79,12 @@ define([
|
||||
provides: "actionService",
|
||||
implementation: ActionDialogDecorator,
|
||||
depends: ["openmct"]
|
||||
},
|
||||
{
|
||||
"provides": "modelService",
|
||||
"type": "provider",
|
||||
"implementation": NewRootModelProvider,
|
||||
"depends": ["openmct"]
|
||||
}
|
||||
],
|
||||
policies: [
|
||||
@ -90,10 +98,6 @@ define([
|
||||
{
|
||||
implementation: AlternateCompositionInitializer,
|
||||
depends: ["openmct"]
|
||||
},
|
||||
{
|
||||
implementation: RootRegistrar,
|
||||
depends: ["openmct", "roots[]"]
|
||||
}
|
||||
],
|
||||
licenses: [
|
||||
|
37
src/adapter/components/NewRootModelProvider.js
Normal file
37
src/adapter/components/NewRootModelProvider.js
Normal file
@ -0,0 +1,37 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2016, 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 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(['../../api/objects/object-utils'], function (utils) {
|
||||
function NewRootModelProvider(openmct) {
|
||||
this.openmct = openmct;
|
||||
}
|
||||
|
||||
NewRootModelProvider.prototype.getModels = function (ids) {
|
||||
return this.openmct.objects.getRoot().then(function (root) {
|
||||
return {
|
||||
ROOT: utils.toOldFormat(root)
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
return NewRootModelProvider;
|
||||
});
|
@ -60,6 +60,13 @@ define([
|
||||
return this.providers[key.namespace] || this.fallbackProvider;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the root-level object.
|
||||
* @returns {Promise.<DomainObject>} a promise for the root object
|
||||
*/
|
||||
ObjectAPI.prototype.getRoot = function () {
|
||||
return this.rootProvider.get();
|
||||
};
|
||||
|
||||
/**
|
||||
* Register a new object provider for a particular namespace.
|
||||
|
Loading…
x
Reference in New Issue
Block a user