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

View File

@ -41,7 +41,7 @@ define(
function Main() { 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 // Get a reference to Angular's injector, so we can get $http and $log
// services, which are useful to the framework layer. // services, which are useful to the framework layer.
var injector = angular.injector(['ng']); var injector = angular.injector(['ng']);
@ -53,7 +53,7 @@ define(
} }
return injector.instantiate(['$http', '$log', FrameworkLayer]) return injector.instantiate(['$http', '$log', FrameworkLayer])
.initializeApplication(angular, legacyRegistry, logLevel()); .initializeApplication(angular, openmct, logLevel());
}; };
return Main; 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; domElement = document.body;
} }
this.element = domElement;
this.legacyExtension('runs', { this.legacyExtension('runs', {
depends: ['navigationService'], depends: ['navigationService'],
implementation: function (navigationService) { implementation: function (navigationService) {
@ -373,7 +375,7 @@ define([
* @event start * @event start
* @memberof module:openmct.MCT~ * @memberof module:openmct.MCT~
*/ */
var startPromise = new Main().run(this.legacyRegistry) var startPromise = new Main().run(this)
.then(function (angular) { .then(function (angular) {
this.$angular = angular; this.$angular = angular;
// OpenMCT Object provider doesn't operate properly unless // OpenMCT Object provider doesn't operate properly unless

View File

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

View File

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

View File

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