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

View File

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