[API] Fix dependency issues with Composition

This commit is contained in:
Victor Woeltjen 2016-09-30 15:18:51 -07:00
parent 08e28018c1
commit dd7d8d2642
2 changed files with 11 additions and 7 deletions

View File

@ -24,17 +24,16 @@
* Module defining AlternateCompositionCapability. Created by vwoeltje on 11/7/14.
*/
define([
'../../api/objects/object-utils',
'../../api/composition/CompositionAPI'
], function (objectUtils, CompositionAPI) {
'../../api/objects/object-utils'
], function (objectUtils) {
function AlternateCompositionCapability($injector, domainObject) {
this.domainObject = domainObject;
this.getDependencies = function () {
this.instantiate = $injector.get("instantiate");
this.contextualize = $injector.get("contextualize");
this.getDependencies = undefined;
this.openmct = $injector.get("openmct");
}.bind(this);
}
@ -85,7 +84,12 @@ define([
this.domainObject.getModel(),
this.domainObject.getId()
);
var collection = CompositionAPI(newFormatDO);
if (this.getDependencies) {
this.getDependencies();
}
var collection = this.openmct.composition.get(newFormatDO);
return collection.load()
.then(function (children) {
collection.destroy();
@ -94,7 +98,7 @@ define([
};
AlternateCompositionCapability.appliesTo = function (model) {
return !!CompositionAPI(objectUtils.toNewFormat(model, model.id));
return true;
};
return AlternateCompositionCapability;

View File

@ -297,7 +297,7 @@ define([
* @memberof module:openmct.TelemetryAPI~TelemetryProvider#
*/
_.forEach({
request: Promise.reject("No such provider"),
request: undefined,
subscribe: undefined,
properties: [],
formatter: undefined,