Fixes to enable testing by third party applications (#2523)

* Initial commit of telemetry table spec

* Fix errors found by running Open MCT app headless

* Do not double install import-export plugin

* Changes to allow Open MCT to be initialized more than once without binding to window.document

* Remove table spec accidentally added
This commit is contained in:
Andrew Henry 2019-10-21 10:24:46 -07:00 committed by Deep Tailor
parent 7477536478
commit 4414161faf
7 changed files with 17 additions and 16 deletions

View File

@ -55,13 +55,13 @@ define([
FrameworkLayer.prototype.initializeApplication = function (
angular,
legacyRegistry,
openmct,
logLevel
) {
var $http = this.$http,
$log = this.$log,
app = angular.module(Constants.MODULE_NAME, ["ngRoute"]),
loader = new BundleLoader($http, $log, legacyRegistry),
loader = new BundleLoader($http, $log, openmct.legacyRegistry),
resolver = new BundleResolver(
new ExtensionResolver(
new ImplementationLoader({}),
@ -77,7 +77,7 @@ define([
),
bootstrapper = new ApplicationBootstrapper(
angular,
window.document,
openmct.element,
$log
),
initializer = new FrameworkInitializer(

View File

@ -41,7 +41,7 @@ define(
function Main() {
}
Main.prototype.run = function (legacyRegistry) {
Main.prototype.run = function (openmct) {
// Get a reference to Angular's injector, so we can get $http and $log
// services, which are useful to the framework layer.
var injector = angular.injector(['ng']);
@ -53,7 +53,7 @@ define(
}
return injector.instantiate(['$http', '$log', FrameworkLayer])
.initializeApplication(angular, legacyRegistry, logLevel());
.initializeApplication(angular, openmct, logLevel());
};
return Main;

View File

@ -72,7 +72,6 @@ define([
]
}
});
openmct.legacyRegistry.enable('platform/import-export');
};
};
});

View File

@ -344,6 +344,8 @@ define([
domElement = document.body;
}
this.element = domElement;
this.legacyExtension('runs', {
depends: ['navigationService'],
implementation: function (navigationService) {
@ -373,7 +375,7 @@ define([
* @event start
* @memberof module:openmct.MCT~
*/
var startPromise = new Main().run(this.legacyRegistry)
var startPromise = new Main().run(this)
.then(function (angular) {
this.$angular = angular;
// OpenMCT Object provider doesn't operate properly unless

View File

@ -21,13 +21,13 @@
*****************************************************************************/
export default function legacyCompositionPolicyAdapter(openmct) {
const instantiate = this.openmct.$injector.get('instantiate');
const policyService = this.openmct.$injector.get('policyService');
const instantiate = openmct.$injector.get('instantiate');
const policyService = openmct.$injector.get('policyService');
openmct.composition.addPolicy((parent, child) => {
let parentId = this.openmct.objects.makeKeyString(parent.identifier);
let childId = this.openmct.objects.makeKeyString(child.identifier);
let parentId = openmct.objects.makeKeyString(parent.identifier);
let childId = openmct.objects.makeKeyString(child.identifier);
let legacyParent = instantiate(parent, parentId);
let legacyChild = instantiate(child, childId);

View File

@ -96,10 +96,10 @@
// 2. Get legacy type from legacy api
// 3. Instantiate create action with type, parent, context
// 4. perform action.
return this.openmct.objects.get(openmct.router.path[0].identifier)
return this.openmct.objects.get(this.openmct.router.path[0].identifier)
.then((currentObject) => {
let legacyContextualParent = this.convertToLegacy(currentObject);
let legacyType = openmct.$injector.get('typeService').getType(item.key);
let legacyType = this.openmct.$injector.get('typeService').getType(item.key);
let context = {
key: "create",
domainObject: legacyContextualParent // should be same as parent object.
@ -116,7 +116,7 @@
convertToLegacy (domainObject) {
let keyString = objectUtils.makeKeyString(domainObject.identifier);
let oldModel = objectUtils.toOldFormat(domainObject);
return openmct.$injector.get('instantiate')(oldModel, keyString);
return this.openmct.$injector.get('instantiate')(oldModel, keyString);
}
},
destroyed () {
@ -126,7 +126,7 @@
let items = [];
this.openmct.types.listKeys().forEach(key => {
let menuItem = openmct.types.get(key).definition;
let menuItem = this.openmct.types.get(key).definition;
if (menuItem.creatable) {
let menuItemTemplate = {

View File

@ -235,7 +235,7 @@
}
},
mounted() {
openmct.notifications.on('notification', this.showNotification);
this.openmct.notifications.on('notification', this.showNotification);
}
}