mirror of
https://github.com/nasa/openmct.git
synced 2025-06-17 06:38:17 +00:00
[Roots] Add new root model provider
...to read roots from the new API's registry.
This commit is contained in:
@ -23,6 +23,7 @@
|
|||||||
define([
|
define([
|
||||||
'legacyRegistry',
|
'legacyRegistry',
|
||||||
'./actions/ActionDialogDecorator',
|
'./actions/ActionDialogDecorator',
|
||||||
|
'./components/NewRootModelProvider',
|
||||||
'./directives/MCTView',
|
'./directives/MCTView',
|
||||||
'./services/Instantiate',
|
'./services/Instantiate',
|
||||||
'./capabilities/APICapabilityDecorator',
|
'./capabilities/APICapabilityDecorator',
|
||||||
@ -32,6 +33,7 @@ define([
|
|||||||
], function (
|
], function (
|
||||||
legacyRegistry,
|
legacyRegistry,
|
||||||
ActionDialogDecorator,
|
ActionDialogDecorator,
|
||||||
|
NewRootModelProvider,
|
||||||
MCTView,
|
MCTView,
|
||||||
Instantiate,
|
Instantiate,
|
||||||
APICapabilityDecorator,
|
APICapabilityDecorator,
|
||||||
@ -77,6 +79,12 @@ define([
|
|||||||
provides: "actionService",
|
provides: "actionService",
|
||||||
implementation: ActionDialogDecorator,
|
implementation: ActionDialogDecorator,
|
||||||
depends: ["openmct"]
|
depends: ["openmct"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"provides": "modelService",
|
||||||
|
"type": "provider",
|
||||||
|
"implementation": NewRootModelProvider,
|
||||||
|
"depends": ["openmct"]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
policies: [
|
policies: [
|
||||||
@ -90,10 +98,6 @@ define([
|
|||||||
{
|
{
|
||||||
implementation: AlternateCompositionInitializer,
|
implementation: AlternateCompositionInitializer,
|
||||||
depends: ["openmct"]
|
depends: ["openmct"]
|
||||||
},
|
|
||||||
{
|
|
||||||
implementation: RootRegistrar,
|
|
||||||
depends: ["openmct", "roots[]"]
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
licenses: [
|
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;
|
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.
|
* Register a new object provider for a particular namespace.
|
||||||
|
Reference in New Issue
Block a user