mirror of
https://github.com/nasa/openmct.git
synced 2025-06-27 11:32:13 +00:00
Compare commits
18 Commits
notebook-e
...
unload-ope
Author | SHA1 | Date | |
---|---|---|---|
b062615c25 | |||
e784242379 | |||
da8dbf25bf | |||
a5571eec05 | |||
19802ce2cc | |||
e83735a927 | |||
c9a47a411a | |||
a6e55fd493 | |||
76f35a0bcd | |||
b6930ef7cd | |||
57b9cbd42f | |||
17901147ef | |||
58b8f90682 | |||
d06cbc8975 | |||
553b18587c | |||
590dc74e45 | |||
3557ed4b4c | |||
41cc52d50a |
@ -41,11 +41,6 @@ define([
|
|||||||
"$scope"
|
"$scope"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"routes": [
|
|
||||||
{
|
|
||||||
"templateUrl": "templates/exampleForm.html"
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,5 +96,9 @@ define([
|
|||||||
return this.workerInterface.subscribe(workerRequest, callback);
|
return this.workerInterface.subscribe(workerRequest, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GeneratorProvider.prototype.destroy = function () {
|
||||||
|
this.workerInterface.destroy();
|
||||||
|
};
|
||||||
|
|
||||||
return GeneratorProvider;
|
return GeneratorProvider;
|
||||||
});
|
});
|
||||||
|
@ -40,6 +40,11 @@ define([
|
|||||||
this.callbacks = {};
|
this.callbacks = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WorkerInterface.prototype.destroy = function () {
|
||||||
|
delete this.worker.onmessage;
|
||||||
|
this.worker.terminate();
|
||||||
|
};
|
||||||
|
|
||||||
WorkerInterface.prototype.onMessage = function (message) {
|
WorkerInterface.prototype.onMessage = function (message) {
|
||||||
message = message.data;
|
message = message.data;
|
||||||
var callback = this.callbacks[message.id];
|
var callback = this.callbacks[message.id];
|
||||||
|
@ -181,7 +181,11 @@ define([
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
openmct.telemetry.addProvider(new GeneratorProvider());
|
const generatorProvider = new GeneratorProvider();
|
||||||
|
openmct.once('destroy', () => {
|
||||||
|
generatorProvider.destroy();
|
||||||
|
});
|
||||||
|
openmct.telemetry.addProvider(generatorProvider);
|
||||||
openmct.telemetry.addProvider(new GeneratorMetadataProvider());
|
openmct.telemetry.addProvider(new GeneratorMetadataProvider());
|
||||||
openmct.telemetry.addProvider(new SinewaveLimitProvider());
|
openmct.telemetry.addProvider(new SinewaveLimitProvider());
|
||||||
};
|
};
|
||||||
|
@ -164,16 +164,6 @@ define([
|
|||||||
"license": "license-apache",
|
"license": "license-apache",
|
||||||
"link": "http://logging.apache.org/log4net/license.html"
|
"link": "http://logging.apache.org/log4net/license.html"
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"routes": [
|
|
||||||
{
|
|
||||||
"when": "/licenses",
|
|
||||||
"template": licensesTemplate
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"when": "/licenses-md",
|
|
||||||
"template": licensesExportMdTemplate
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,8 +50,6 @@ define([
|
|||||||
name: "platform/commonUI/browse",
|
name: "platform/commonUI/browse",
|
||||||
definition: {
|
definition: {
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"routes": [
|
|
||||||
],
|
|
||||||
"constants": [
|
"constants": [
|
||||||
{
|
{
|
||||||
"key": "DEFAULT_PATH",
|
"key": "DEFAULT_PATH",
|
||||||
|
@ -39,9 +39,6 @@ define(
|
|||||||
this.callbacks = [];
|
this.callbacks = [];
|
||||||
this.checks = [];
|
this.checks = [];
|
||||||
this.$window = $window;
|
this.$window = $window;
|
||||||
|
|
||||||
this.oldUnload = $window.onbeforeunload;
|
|
||||||
$window.onbeforeunload = this.onBeforeUnload.bind(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,7 +71,8 @@ define([
|
|||||||
"implementation": TickerService,
|
"implementation": TickerService,
|
||||||
"depends": [
|
"depends": [
|
||||||
"$timeout",
|
"$timeout",
|
||||||
"now"
|
"now",
|
||||||
|
"$rootScope"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -32,8 +32,13 @@ define(
|
|||||||
* @param $timeout Angular's $timeout
|
* @param $timeout Angular's $timeout
|
||||||
* @param {Function} now function to provide the current time in ms
|
* @param {Function} now function to provide the current time in ms
|
||||||
*/
|
*/
|
||||||
function TickerService($timeout, now) {
|
function TickerService($timeout, now, $rootScope) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
var timeoutId;
|
||||||
|
|
||||||
|
$rootScope.$on('$destroy', function () {
|
||||||
|
$timeout.cancel(timeoutId);
|
||||||
|
});
|
||||||
|
|
||||||
function tick() {
|
function tick() {
|
||||||
var timestamp = now(),
|
var timestamp = now(),
|
||||||
@ -48,7 +53,7 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to update at exactly the next second
|
// Try to update at exactly the next second
|
||||||
$timeout(tick, 1000 - millis, true);
|
timeoutId = $timeout(tick, 1000 - millis, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
tick();
|
tick();
|
||||||
|
@ -30,16 +30,18 @@ define(
|
|||||||
var mockTimeout,
|
var mockTimeout,
|
||||||
mockNow,
|
mockNow,
|
||||||
mockCallback,
|
mockCallback,
|
||||||
tickerService;
|
tickerService,
|
||||||
|
mockRootScope;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockTimeout = jasmine.createSpy('$timeout');
|
mockTimeout = jasmine.createSpy('$timeout');
|
||||||
mockNow = jasmine.createSpy('now');
|
mockNow = jasmine.createSpy('now');
|
||||||
mockCallback = jasmine.createSpy('callback');
|
mockCallback = jasmine.createSpy('callback');
|
||||||
|
mockRootScope = jasmine.createSpyObj('rootScope', ['$on']);
|
||||||
|
|
||||||
mockNow.and.returnValue(TEST_TIMESTAMP);
|
mockNow.and.returnValue(TEST_TIMESTAMP);
|
||||||
|
|
||||||
tickerService = new TickerService(mockTimeout, mockNow);
|
tickerService = new TickerService(mockTimeout, mockNow, mockRootScope);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("notifies listeners of clock ticks", function () {
|
it("notifies listeners of clock ticks", function () {
|
||||||
|
@ -58,7 +58,7 @@ define([
|
|||||||
) {
|
) {
|
||||||
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, []),
|
||||||
loader = new BundleLoader($http, $log, openmct.legacyRegistry),
|
loader = new BundleLoader($http, $log, openmct.legacyRegistry),
|
||||||
resolver = new BundleResolver(
|
resolver = new BundleResolver(
|
||||||
new ExtensionResolver(
|
new ExtensionResolver(
|
||||||
|
@ -28,8 +28,7 @@
|
|||||||
define(
|
define(
|
||||||
[
|
[
|
||||||
'./FrameworkLayer',
|
'./FrameworkLayer',
|
||||||
'angular',
|
'angular'
|
||||||
'angular-route'
|
|
||||||
],
|
],
|
||||||
function (
|
function (
|
||||||
FrameworkLayer,
|
FrameworkLayer,
|
||||||
|
@ -138,34 +138,6 @@ define(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom registration function for extensions of category "route"
|
|
||||||
function registerRoute(extension) {
|
|
||||||
var app = this.app,
|
|
||||||
$log = this.$log,
|
|
||||||
route = Object.create(extension);
|
|
||||||
|
|
||||||
// Adjust path for bundle
|
|
||||||
if (route.templateUrl) {
|
|
||||||
route.templateUrl = [
|
|
||||||
route.bundle.path,
|
|
||||||
route.bundle.resources,
|
|
||||||
route.templateUrl
|
|
||||||
].join(Constants.SEPARATOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log the registration
|
|
||||||
$log.info("Registering route: " + (route.key || route.when));
|
|
||||||
|
|
||||||
// Register the route with Angular
|
|
||||||
app.config(['$routeProvider', function ($routeProvider) {
|
|
||||||
if (route.when) {
|
|
||||||
$routeProvider.when(route.when, route);
|
|
||||||
} else {
|
|
||||||
$routeProvider.otherwise(route);
|
|
||||||
}
|
|
||||||
}]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle service compositing
|
// Handle service compositing
|
||||||
function registerComponents(components) {
|
function registerComponents(components) {
|
||||||
var app = this.app,
|
var app = this.app,
|
||||||
@ -194,13 +166,6 @@ define(
|
|||||||
CustomRegistrars.prototype.constants =
|
CustomRegistrars.prototype.constants =
|
||||||
mapUpon(registerConstant);
|
mapUpon(registerConstant);
|
||||||
|
|
||||||
/**
|
|
||||||
* Register Angular routes.
|
|
||||||
* @param {Array} extensions the resolved extensions
|
|
||||||
*/
|
|
||||||
CustomRegistrars.prototype.routes =
|
|
||||||
mapUpon(registerRoute);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register Angular directives.
|
* Register Angular directives.
|
||||||
* @param {Array} extensions the resolved extensions
|
* @param {Array} extensions the resolved extensions
|
||||||
|
@ -57,7 +57,6 @@ define(
|
|||||||
expect(customRegistrars.directives).toBeTruthy();
|
expect(customRegistrars.directives).toBeTruthy();
|
||||||
expect(customRegistrars.controllers).toBeTruthy();
|
expect(customRegistrars.controllers).toBeTruthy();
|
||||||
expect(customRegistrars.services).toBeTruthy();
|
expect(customRegistrars.services).toBeTruthy();
|
||||||
expect(customRegistrars.routes).toBeTruthy();
|
|
||||||
expect(customRegistrars.constants).toBeTruthy();
|
expect(customRegistrars.constants).toBeTruthy();
|
||||||
expect(customRegistrars.runs).toBeTruthy();
|
expect(customRegistrars.runs).toBeTruthy();
|
||||||
});
|
});
|
||||||
@ -139,47 +138,6 @@ define(
|
|||||||
expect(mockLog.warn.calls.count()).toEqual(0);
|
expect(mockLog.warn.calls.count()).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("allows routes to be registered", function () {
|
|
||||||
var mockRouteProvider = jasmine.createSpyObj(
|
|
||||||
"$routeProvider",
|
|
||||||
["when", "otherwise"]
|
|
||||||
),
|
|
||||||
bundle = {
|
|
||||||
path: "test/bundle",
|
|
||||||
resources: "res"
|
|
||||||
},
|
|
||||||
routes = [
|
|
||||||
{
|
|
||||||
when: "foo",
|
|
||||||
templateUrl: "templates/test.html",
|
|
||||||
bundle: bundle
|
|
||||||
},
|
|
||||||
{
|
|
||||||
templateUrl: "templates/default.html",
|
|
||||||
bundle: bundle
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
customRegistrars.routes(routes);
|
|
||||||
|
|
||||||
// Give it the route provider based on its config call
|
|
||||||
mockApp.config.calls.all().forEach(function (call) {
|
|
||||||
// Invoke the provided callback
|
|
||||||
call.args[0][1](mockRouteProvider);
|
|
||||||
});
|
|
||||||
|
|
||||||
// The "when" clause should have been mapped to the when method...
|
|
||||||
expect(mockRouteProvider.when).toHaveBeenCalled();
|
|
||||||
expect(mockRouteProvider.when.calls.mostRecent().args[0]).toEqual("foo");
|
|
||||||
expect(mockRouteProvider.when.calls.mostRecent().args[1].templateUrl)
|
|
||||||
.toEqual("test/bundle/res/templates/test.html");
|
|
||||||
|
|
||||||
// ...while the other should have been treated as a default route
|
|
||||||
expect(mockRouteProvider.otherwise).toHaveBeenCalled();
|
|
||||||
expect(mockRouteProvider.otherwise.calls.mostRecent().args[0].templateUrl)
|
|
||||||
.toEqual("test/bundle/res/templates/default.html");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("accepts components for service compositing", function () {
|
it("accepts components for service compositing", function () {
|
||||||
// Most relevant code will be exercised in service compositor spec
|
// Most relevant code will be exercised in service compositor spec
|
||||||
expect(customRegistrars.components).toBeTruthy();
|
expect(customRegistrars.components).toBeTruthy();
|
||||||
|
@ -110,8 +110,15 @@ define([
|
|||||||
worker = workerService.run('bareBonesSearchWorker');
|
worker = workerService.run('bareBonesSearchWorker');
|
||||||
}
|
}
|
||||||
|
|
||||||
worker.addEventListener('message', function (messageEvent) {
|
function handleWorkerMessage(messageEvent) {
|
||||||
provider.onWorkerMessage(messageEvent);
|
provider.onWorkerMessage(messageEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
worker.addEventListener('message', handleWorkerMessage);
|
||||||
|
|
||||||
|
this.openmct.once('destroy', () => {
|
||||||
|
worker.removeEventListener('message', handleWorkerMessage);
|
||||||
|
worker.terminate();
|
||||||
});
|
});
|
||||||
|
|
||||||
return worker;
|
return worker;
|
||||||
|
42
src/MCT.js
42
src/MCT.js
@ -31,7 +31,6 @@ define([
|
|||||||
'objectUtils',
|
'objectUtils',
|
||||||
'./plugins/plugins',
|
'./plugins/plugins',
|
||||||
'./adapter/indicators/legacy-indicators-plugin',
|
'./adapter/indicators/legacy-indicators-plugin',
|
||||||
'./plugins/buildInfo/plugin',
|
|
||||||
'./ui/registries/ViewRegistry',
|
'./ui/registries/ViewRegistry',
|
||||||
'./plugins/imagery/plugin',
|
'./plugins/imagery/plugin',
|
||||||
'./ui/registries/InspectorViewRegistry',
|
'./ui/registries/InspectorViewRegistry',
|
||||||
@ -40,6 +39,7 @@ define([
|
|||||||
'./ui/router/Browse',
|
'./ui/router/Browse',
|
||||||
'../platform/framework/src/Main',
|
'../platform/framework/src/Main',
|
||||||
'./ui/layout/Layout.vue',
|
'./ui/layout/Layout.vue',
|
||||||
|
'./ui/inspector/styles/StylesManager',
|
||||||
'../platform/core/src/objects/DomainObjectImpl',
|
'../platform/core/src/objects/DomainObjectImpl',
|
||||||
'../platform/core/src/capabilities/ContextualDomainObject',
|
'../platform/core/src/capabilities/ContextualDomainObject',
|
||||||
'./ui/preview/plugin',
|
'./ui/preview/plugin',
|
||||||
@ -60,7 +60,6 @@ define([
|
|||||||
objectUtils,
|
objectUtils,
|
||||||
plugins,
|
plugins,
|
||||||
LegacyIndicatorsPlugin,
|
LegacyIndicatorsPlugin,
|
||||||
buildInfoPlugin,
|
|
||||||
ViewRegistry,
|
ViewRegistry,
|
||||||
ImageryPlugin,
|
ImageryPlugin,
|
||||||
InspectorViewRegistry,
|
InspectorViewRegistry,
|
||||||
@ -69,6 +68,7 @@ define([
|
|||||||
Browse,
|
Browse,
|
||||||
Main,
|
Main,
|
||||||
Layout,
|
Layout,
|
||||||
|
stylesManager,
|
||||||
DomainObjectImpl,
|
DomainObjectImpl,
|
||||||
ContextualDomainObject,
|
ContextualDomainObject,
|
||||||
PreviewPlugin,
|
PreviewPlugin,
|
||||||
@ -123,6 +123,7 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.destroy = this.destroy.bind(this);
|
this.destroy = this.destroy.bind(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tracks current selection state of the application.
|
* Tracks current selection state of the application.
|
||||||
* @private
|
* @private
|
||||||
@ -376,6 +377,7 @@ define([
|
|||||||
* MCT; if undefined, MCT will be run in the body of the document
|
* MCT; if undefined, MCT will be run in the body of the document
|
||||||
*/
|
*/
|
||||||
MCT.prototype.start = function (domElement = document.body, isHeadlessMode = false) {
|
MCT.prototype.start = function (domElement = document.body, isHeadlessMode = false) {
|
||||||
|
|
||||||
if (this.types.get('layout') === undefined) {
|
if (this.types.get('layout') === undefined) {
|
||||||
this.install(this.plugins.DisplayLayout({
|
this.install(this.plugins.DisplayLayout({
|
||||||
showAsView: ['summary-widget']
|
showAsView: ['summary-widget']
|
||||||
@ -434,6 +436,9 @@ define([
|
|||||||
domElement.appendChild(appLayout.$mount().$el);
|
domElement.appendChild(appLayout.$mount().$el);
|
||||||
|
|
||||||
this.layout = appLayout.$refs.layout;
|
this.layout = appLayout.$refs.layout;
|
||||||
|
this.once('destroy', () => {
|
||||||
|
appLayout.$destroy();
|
||||||
|
});
|
||||||
Browse(this);
|
Browse(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,9 +467,40 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
MCT.prototype.destroy = function () {
|
MCT.prototype.destroy = function () {
|
||||||
|
if (this._destroyed === true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
window.removeEventListener('beforeunload', this.destroy);
|
window.removeEventListener('beforeunload', this.destroy);
|
||||||
|
|
||||||
this.emit('destroy');
|
this.emit('destroy');
|
||||||
this.router.destroy();
|
this.removeAllListeners();
|
||||||
|
|
||||||
|
if (this.$injector) {
|
||||||
|
this.$injector.get('$rootScope').$destroy();
|
||||||
|
this.$injector = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.$angular) {
|
||||||
|
this.$angular.element(this.element).off().removeData();
|
||||||
|
this.$angular.element(this.element).empty();
|
||||||
|
this.$angular = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.overlays.destroy();
|
||||||
|
|
||||||
|
if (this.element) {
|
||||||
|
this.element.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
stylesManager.default.removeAllListeners();
|
||||||
|
|
||||||
|
window.angular = null;
|
||||||
|
window.openmct = null;
|
||||||
|
|
||||||
|
Object.keys(require.cache).forEach(key => delete require.cache[key]);
|
||||||
|
|
||||||
|
this._destroyed = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
MCT.prototype.plugins = plugins;
|
MCT.prototype.plugins = plugins;
|
||||||
|
@ -32,6 +32,10 @@ define([
|
|||||||
// cannot be injected.
|
// cannot be injected.
|
||||||
function AlternateCompositionInitializer(openmct) {
|
function AlternateCompositionInitializer(openmct) {
|
||||||
AlternateCompositionCapability.appliesTo = function (model, id) {
|
AlternateCompositionCapability.appliesTo = function (model, id) {
|
||||||
|
openmct.once('destroy', () => {
|
||||||
|
delete AlternateCompositionCapability.appliesTo;
|
||||||
|
});
|
||||||
|
|
||||||
model = objectUtils.toNewFormat(model, id || '');
|
model = objectUtils.toNewFormat(model, id || '');
|
||||||
|
|
||||||
return Boolean(openmct.composition.get(model));
|
return Boolean(openmct.composition.get(model));
|
||||||
|
@ -28,6 +28,10 @@ export default class Editor extends EventEmitter {
|
|||||||
super();
|
super();
|
||||||
this.editing = false;
|
this.editing = false;
|
||||||
this.openmct = openmct;
|
this.openmct = openmct;
|
||||||
|
|
||||||
|
openmct.once('destroy', () => {
|
||||||
|
this.removeAllListeners();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +44,15 @@ describe('The ActionCollection', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
openmct.$injector.get.and.returnValue(mockIdentifierService);
|
openmct.$injector.get.and.callFake((key) => {
|
||||||
|
return {
|
||||||
|
'identifierService': mockIdentifierService,
|
||||||
|
'$rootScope': {
|
||||||
|
'$destroy': () => {}
|
||||||
|
}
|
||||||
|
}[key];
|
||||||
|
});
|
||||||
|
|
||||||
mockObjectPath = [
|
mockObjectPath = [
|
||||||
{
|
{
|
||||||
name: 'mock folder',
|
name: 'mock folder',
|
||||||
|
@ -17,11 +17,7 @@ class OverlayAPI {
|
|||||||
|
|
||||||
this.dismissLastOverlay = this.dismissLastOverlay.bind(this);
|
this.dismissLastOverlay = this.dismissLastOverlay.bind(this);
|
||||||
|
|
||||||
document.addEventListener('keyup', (event) => {
|
document.addEventListener('keyup', this.dismissLastOverlay);
|
||||||
if (event.key === 'Escape') {
|
|
||||||
this.dismissLastOverlay();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,10 +48,12 @@ class OverlayAPI {
|
|||||||
/**
|
/**
|
||||||
* private
|
* private
|
||||||
*/
|
*/
|
||||||
dismissLastOverlay() {
|
dismissLastOverlay(event) {
|
||||||
let lastOverlay = this.activeOverlays[this.activeOverlays.length - 1];
|
if (event.key === 'Escape') {
|
||||||
if (lastOverlay && lastOverlay.dismissable) {
|
let lastOverlay = this.activeOverlays[this.activeOverlays.length - 1];
|
||||||
lastOverlay.dismiss();
|
if (lastOverlay && lastOverlay.dismissable) {
|
||||||
|
lastOverlay.dismiss();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +61,7 @@ class OverlayAPI {
|
|||||||
* A description of option properties that can be passed into the overlay
|
* A description of option properties that can be passed into the overlay
|
||||||
* @typedef options
|
* @typedef options
|
||||||
* @property {object} element DOMElement that is to be inserted/shown on the overlay
|
* @property {object} element DOMElement that is to be inserted/shown on the overlay
|
||||||
* @property {string} size preferred size of the overlay (large, small, fit)
|
* @property {string} size prefered size of the overlay (large, small, fit)
|
||||||
* @property {array} buttons optional button objects with label and callback properties
|
* @property {array} buttons optional button objects with label and callback properties
|
||||||
* @property {function} onDestroy callback to be called when overlay is destroyed
|
* @property {function} onDestroy callback to be called when overlay is destroyed
|
||||||
* @property {boolean} dismissable allow user to dismiss overlay by using esc, and clicking away
|
* @property {boolean} dismissable allow user to dismiss overlay by using esc, and clicking away
|
||||||
@ -132,6 +130,10 @@ class OverlayAPI {
|
|||||||
return progressDialog;
|
return progressDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
destroy() {
|
||||||
|
document.removeEventListener('keyup', this.dismissLastOverlay);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default OverlayAPI;
|
export default OverlayAPI;
|
||||||
|
@ -32,6 +32,10 @@ export default class StatusAPI extends EventEmitter {
|
|||||||
this.get = this.get.bind(this);
|
this.get = this.get.bind(this);
|
||||||
this.set = this.set.bind(this);
|
this.set = this.set.bind(this);
|
||||||
this.observe = this.observe.bind(this);
|
this.observe = this.observe.bind(this);
|
||||||
|
|
||||||
|
openmct.once('destroy', () => {
|
||||||
|
this.removeAllListeners();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get(identifier) {
|
get(identifier) {
|
||||||
|
@ -75,7 +75,16 @@ describe("the plugin", () => {
|
|||||||
|
|
||||||
mockDialogService.getUserInput.and.returnValue(mockPromise);
|
mockDialogService.getUserInput.and.returnValue(mockPromise);
|
||||||
|
|
||||||
spyOn(openmct.$injector, 'get').and.returnValue(mockDialogService);
|
spyOn(openmct.$injector, 'get');
|
||||||
|
openmct.$injector.get.and.callFake((key) => {
|
||||||
|
return {
|
||||||
|
'dialogService': mockDialogService,
|
||||||
|
'$rootScope': {
|
||||||
|
'$destroy': () => {}
|
||||||
|
}
|
||||||
|
}[key];
|
||||||
|
});
|
||||||
|
|
||||||
spyOn(compositionAPI, 'get').and.returnValue(mockComposition);
|
spyOn(compositionAPI, 'get').and.returnValue(mockComposition);
|
||||||
spyOn(openmct.objects, 'save').and.returnValue(Promise.resolve(true));
|
spyOn(openmct.objects, 'save').and.returnValue(Promise.resolve(true));
|
||||||
|
|
||||||
|
@ -117,6 +117,10 @@ export default function NotebookPlugin() {
|
|||||||
key: 'notebook-snapshot-indicator'
|
key: 'notebook-snapshot-indicator'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
openmct.once('destroy', () => {
|
||||||
|
snapshotContainer.destroy();
|
||||||
|
});
|
||||||
|
|
||||||
openmct.indicators.add(indicator);
|
openmct.indicators.add(indicator);
|
||||||
|
|
||||||
openmct.objectViews.addProvider({
|
openmct.objectViews.addProvider({
|
||||||
|
@ -85,4 +85,8 @@ export default class SnapshotContainer extends EventEmitter {
|
|||||||
|
|
||||||
return this.saveSnapshots(updatedSnapshots);
|
return this.saveSnapshots(updatedSnapshots);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
destroy() {
|
||||||
|
delete SnapshotContainer.instance;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,95 +22,109 @@
|
|||||||
import * as NotebookEntries from './notebook-entries';
|
import * as NotebookEntries from './notebook-entries';
|
||||||
import { createOpenMct, resetApplicationState } from 'utils/testing';
|
import { createOpenMct, resetApplicationState } from 'utils/testing';
|
||||||
|
|
||||||
const notebookStorage = {
|
let notebookStorage;
|
||||||
name: 'notebook',
|
let notebookEntries;
|
||||||
identifier: {
|
let notebookDomainObject;
|
||||||
namespace: '',
|
let selectedSection;
|
||||||
key: 'test-notebook'
|
let selectedPage;
|
||||||
},
|
|
||||||
defaultSectionId: '03a79b6a-971c-4e56-9892-ec536332c3f0',
|
|
||||||
defaultPageId: '8b548fd9-2b8a-4b02-93a9-4138e22eba00'
|
|
||||||
};
|
|
||||||
|
|
||||||
const notebookEntries = {
|
|
||||||
'03a79b6a-971c-4e56-9892-ec536332c3f0': {
|
|
||||||
'8b548fd9-2b8a-4b02-93a9-4138e22eba00': []
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const notebookDomainObject = {
|
|
||||||
identifier: {
|
|
||||||
key: 'notebook',
|
|
||||||
namespace: ''
|
|
||||||
},
|
|
||||||
type: 'notebook',
|
|
||||||
configuration: {
|
|
||||||
defaultSort: 'oldest',
|
|
||||||
entries: notebookEntries,
|
|
||||||
pageTitle: 'Page',
|
|
||||||
sections: [],
|
|
||||||
sectionTitle: 'Section',
|
|
||||||
type: 'General'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const selectedSection = {
|
|
||||||
id: '03a79b6a-971c-4e56-9892-ec536332c3f0',
|
|
||||||
isDefault: false,
|
|
||||||
isSelected: true,
|
|
||||||
name: 'Day 1',
|
|
||||||
pages: [
|
|
||||||
{
|
|
||||||
id: '54deb3d5-8267-4be4-95e9-3579ed8c082d',
|
|
||||||
isDefault: false,
|
|
||||||
isSelected: false,
|
|
||||||
name: 'Shift 1',
|
|
||||||
pageTitle: 'Page'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '2ea41c78-8e60-4657-a350-53f1a1fa3021',
|
|
||||||
isDefault: false,
|
|
||||||
isSelected: false,
|
|
||||||
name: 'Shift 2',
|
|
||||||
pageTitle: 'Page'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '8b548fd9-2b8a-4b02-93a9-4138e22eba00',
|
|
||||||
isDefault: false,
|
|
||||||
isSelected: true,
|
|
||||||
name: 'Unnamed Page',
|
|
||||||
pageTitle: 'Page'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
sectionTitle: 'Section'
|
|
||||||
};
|
|
||||||
|
|
||||||
const selectedPage = {
|
|
||||||
id: '8b548fd9-2b8a-4b02-93a9-4138e22eba00',
|
|
||||||
isDefault: false,
|
|
||||||
isSelected: true,
|
|
||||||
name: 'Unnamed Page',
|
|
||||||
pageTitle: 'Page'
|
|
||||||
};
|
|
||||||
|
|
||||||
let openmct;
|
let openmct;
|
||||||
let mockIdentifierService;
|
let mockIdentifierService;
|
||||||
|
|
||||||
describe('Notebook Entries:', () => {
|
describe('Notebook Entries:', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
notebookStorage = {
|
||||||
|
name: 'notebook',
|
||||||
|
identifier: {
|
||||||
|
namespace: '',
|
||||||
|
key: 'test-notebook'
|
||||||
|
},
|
||||||
|
defaultSectionId: '03a79b6a-971c-4e56-9892-ec536332c3f0',
|
||||||
|
defaultPageId: '8b548fd9-2b8a-4b02-93a9-4138e22eba00'
|
||||||
|
};
|
||||||
|
|
||||||
|
notebookEntries = {
|
||||||
|
'03a79b6a-971c-4e56-9892-ec536332c3f0': {
|
||||||
|
'8b548fd9-2b8a-4b02-93a9-4138e22eba00': []
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
notebookDomainObject = {
|
||||||
|
identifier: {
|
||||||
|
key: 'notebook',
|
||||||
|
namespace: ''
|
||||||
|
},
|
||||||
|
type: 'notebook',
|
||||||
|
configuration: {
|
||||||
|
defaultSort: 'oldest',
|
||||||
|
entries: notebookEntries,
|
||||||
|
pageTitle: 'Page',
|
||||||
|
sections: [],
|
||||||
|
sectionTitle: 'Section',
|
||||||
|
type: 'General'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
selectedSection = {
|
||||||
|
id: '03a79b6a-971c-4e56-9892-ec536332c3f0',
|
||||||
|
isDefault: false,
|
||||||
|
isSelected: true,
|
||||||
|
name: 'Day 1',
|
||||||
|
pages: [
|
||||||
|
{
|
||||||
|
id: '54deb3d5-8267-4be4-95e9-3579ed8c082d',
|
||||||
|
isDefault: false,
|
||||||
|
isSelected: false,
|
||||||
|
name: 'Shift 1',
|
||||||
|
pageTitle: 'Page'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '2ea41c78-8e60-4657-a350-53f1a1fa3021',
|
||||||
|
isDefault: false,
|
||||||
|
isSelected: false,
|
||||||
|
name: 'Shift 2',
|
||||||
|
pageTitle: 'Page'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '8b548fd9-2b8a-4b02-93a9-4138e22eba00',
|
||||||
|
isDefault: false,
|
||||||
|
isSelected: true,
|
||||||
|
name: 'Unnamed Page',
|
||||||
|
pageTitle: 'Page'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
sectionTitle: 'Section'
|
||||||
|
};
|
||||||
|
|
||||||
|
selectedPage = {
|
||||||
|
id: '8b548fd9-2b8a-4b02-93a9-4138e22eba00',
|
||||||
|
isDefault: false,
|
||||||
|
isSelected: true,
|
||||||
|
name: 'Unnamed Page',
|
||||||
|
pageTitle: 'Page'
|
||||||
|
};
|
||||||
|
|
||||||
openmct = createOpenMct();
|
openmct = createOpenMct();
|
||||||
openmct.$injector = jasmine.createSpyObj('$injector', ['get']);
|
openmct.$injector = jasmine.createSpyObj('$injector', ['get']);
|
||||||
mockIdentifierService = jasmine.createSpyObj(
|
mockIdentifierService = jasmine.createSpyObj(
|
||||||
'identifierService',
|
'identifierService',
|
||||||
['parse']
|
['parse']
|
||||||
);
|
);
|
||||||
|
openmct.$injector.get.and.callFake((key) => {
|
||||||
|
return {
|
||||||
|
'identifierService': mockIdentifierService,
|
||||||
|
'$rootScope': {
|
||||||
|
'$destroy': () => {}
|
||||||
|
}
|
||||||
|
}[key];
|
||||||
|
});
|
||||||
|
|
||||||
mockIdentifierService.parse.and.returnValue({
|
mockIdentifierService.parse.and.returnValue({
|
||||||
getSpace: () => {
|
getSpace: () => {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
openmct.$injector.get.and.returnValue(mockIdentifierService);
|
|
||||||
openmct.types.addType('notebook', {
|
openmct.types.addType('notebook', {
|
||||||
creatable: true
|
creatable: true
|
||||||
});
|
});
|
||||||
|
@ -23,51 +23,55 @@
|
|||||||
import * as NotebookStorage from './notebook-storage';
|
import * as NotebookStorage from './notebook-storage';
|
||||||
import { createOpenMct, resetApplicationState } from 'utils/testing';
|
import { createOpenMct, resetApplicationState } from 'utils/testing';
|
||||||
|
|
||||||
const notebookSection = {
|
let notebookSection;
|
||||||
id: 'temp-section',
|
let domainObject;
|
||||||
isDefault: false,
|
let notebookStorage;
|
||||||
isSelected: true,
|
|
||||||
name: 'section',
|
|
||||||
pages: [
|
|
||||||
{
|
|
||||||
id: 'temp-page',
|
|
||||||
isDefault: false,
|
|
||||||
isSelected: true,
|
|
||||||
name: 'page',
|
|
||||||
pageTitle: 'Page'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
sectionTitle: 'Section'
|
|
||||||
};
|
|
||||||
|
|
||||||
const domainObject = {
|
|
||||||
name: 'notebook',
|
|
||||||
identifier: {
|
|
||||||
namespace: '',
|
|
||||||
key: 'test-notebook'
|
|
||||||
},
|
|
||||||
configuration: {
|
|
||||||
sections: [
|
|
||||||
notebookSection
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const notebookStorage = {
|
|
||||||
name: 'notebook',
|
|
||||||
identifier: {
|
|
||||||
namespace: '',
|
|
||||||
key: 'test-notebook'
|
|
||||||
},
|
|
||||||
defaultSectionId: 'temp-section',
|
|
||||||
defaultPageId: 'temp-page'
|
|
||||||
};
|
|
||||||
|
|
||||||
let openmct;
|
let openmct;
|
||||||
let mockIdentifierService;
|
let mockIdentifierService;
|
||||||
|
|
||||||
describe('Notebook Storage:', () => {
|
describe('Notebook Storage:', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
notebookSection = {
|
||||||
|
id: 'temp-section',
|
||||||
|
isDefault: false,
|
||||||
|
isSelected: true,
|
||||||
|
name: 'section',
|
||||||
|
pages: [
|
||||||
|
{
|
||||||
|
id: 'temp-page',
|
||||||
|
isDefault: false,
|
||||||
|
isSelected: true,
|
||||||
|
name: 'page',
|
||||||
|
pageTitle: 'Page'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
sectionTitle: 'Section'
|
||||||
|
};
|
||||||
|
|
||||||
|
domainObject = {
|
||||||
|
name: 'notebook',
|
||||||
|
identifier: {
|
||||||
|
namespace: '',
|
||||||
|
key: 'test-notebook'
|
||||||
|
},
|
||||||
|
configuration: {
|
||||||
|
sections: [
|
||||||
|
notebookSection
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
notebookStorage = {
|
||||||
|
name: 'notebook',
|
||||||
|
identifier: {
|
||||||
|
namespace: '',
|
||||||
|
key: 'test-notebook'
|
||||||
|
},
|
||||||
|
defaultSectionId: 'temp-section',
|
||||||
|
defaultPageId: 'temp-page'
|
||||||
|
};
|
||||||
|
|
||||||
openmct = createOpenMct();
|
openmct = createOpenMct();
|
||||||
openmct.$injector = jasmine.createSpyObj('$injector', ['get']);
|
openmct.$injector = jasmine.createSpyObj('$injector', ['get']);
|
||||||
mockIdentifierService = jasmine.createSpyObj(
|
mockIdentifierService = jasmine.createSpyObj(
|
||||||
@ -80,7 +84,15 @@ describe('Notebook Storage:', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
openmct.$injector.get.and.returnValue(mockIdentifierService);
|
openmct.$injector.get.and.callFake((key) => {
|
||||||
|
return {
|
||||||
|
'identifierService': mockIdentifierService,
|
||||||
|
'$rootScope': {
|
||||||
|
'$destroy': () => {}
|
||||||
|
}
|
||||||
|
}[key];
|
||||||
|
});
|
||||||
|
|
||||||
window.localStorage.setItem('notebook-storage', null);
|
window.localStorage.setItem('notebook-storage', null);
|
||||||
openmct.objects.addProvider('', jasmine.createSpyObj('mockNotebookProvider', [
|
openmct.objects.addProvider('', jasmine.createSpyObj('mockNotebookProvider', [
|
||||||
'create',
|
'create',
|
||||||
|
@ -29,13 +29,8 @@ describe('the plugin', function () {
|
|||||||
let element;
|
let element;
|
||||||
let child;
|
let child;
|
||||||
let openmct;
|
let openmct;
|
||||||
let appHolder;
|
|
||||||
|
|
||||||
beforeEach((done) => {
|
beforeEach((done) => {
|
||||||
appHolder = document.createElement('div');
|
|
||||||
appHolder.style.width = '640px';
|
|
||||||
appHolder.style.height = '480px';
|
|
||||||
|
|
||||||
openmct = createOpenMct();
|
openmct = createOpenMct();
|
||||||
openmct.install(new PlanPlugin());
|
openmct.install(new PlanPlugin());
|
||||||
|
|
||||||
@ -50,7 +45,7 @@ describe('the plugin', function () {
|
|||||||
element.appendChild(child);
|
element.appendChild(child);
|
||||||
|
|
||||||
openmct.on('start', done);
|
openmct.on('start', done);
|
||||||
openmct.start(appHolder);
|
openmct.start(element);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -99,6 +94,7 @@ describe('the plugin', function () {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
let planView;
|
let planView;
|
||||||
|
let view;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
openmct.time.timeSystem('utc', {
|
openmct.time.timeSystem('utc', {
|
||||||
@ -139,12 +135,16 @@ describe('the plugin', function () {
|
|||||||
|
|
||||||
const applicableViews = openmct.objectViews.get(planDomainObject, []);
|
const applicableViews = openmct.objectViews.get(planDomainObject, []);
|
||||||
planView = applicableViews.find((viewProvider) => viewProvider.key === 'plan.view');
|
planView = applicableViews.find((viewProvider) => viewProvider.key === 'plan.view');
|
||||||
let view = planView.view(planDomainObject, mockObjectPath);
|
view = planView.view(planDomainObject, mockObjectPath);
|
||||||
view.show(child, true);
|
view.show(child, true);
|
||||||
|
|
||||||
return Vue.nextTick();
|
return Vue.nextTick();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
view.destroy();
|
||||||
|
});
|
||||||
|
|
||||||
it('loads activities into the view', () => {
|
it('loads activities into the view', () => {
|
||||||
const svgEls = element.querySelectorAll('.c-plan__contents svg');
|
const svgEls = element.querySelectorAll('.c-plan__contents svg');
|
||||||
expect(svgEls.length).toEqual(1);
|
expect(svgEls.length).toEqual(1);
|
||||||
|
@ -98,7 +98,10 @@ export default {
|
|||||||
|
|
||||||
//Respond to changes in conductor
|
//Respond to changes in conductor
|
||||||
this.openmct.time.on("timeSystem", this.setViewFromTimeSystem);
|
this.openmct.time.on("timeSystem", this.setViewFromTimeSystem);
|
||||||
setInterval(this.resize, RESIZE_POLL_INTERVAL);
|
this.resizeTimer = setInterval(this.resize, RESIZE_POLL_INTERVAL);
|
||||||
|
},
|
||||||
|
destroyed() {
|
||||||
|
clearInterval(this.resizeTimer);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setAxisDimensions() {
|
setAxisDimensions() {
|
||||||
|
@ -38,6 +38,10 @@ define(
|
|||||||
|
|
||||||
this.openmct = openmct;
|
this.openmct = openmct;
|
||||||
this.selected = [];
|
this.selected = [];
|
||||||
|
|
||||||
|
this.openmct.once('destroy', () => {
|
||||||
|
this.removeAllListeners();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Selection.prototype = Object.create(EventEmitter.prototype);
|
Selection.prototype = Object.create(EventEmitter.prototype);
|
||||||
|
@ -54,6 +54,9 @@ describe("the inspector", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
stylesViewComponent.$destroy();
|
||||||
|
savedStylesViewComponent.$destroy();
|
||||||
|
|
||||||
return resetApplicationState(openmct);
|
return resetApplicationState(openmct);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -77,7 +80,7 @@ describe("the inspector", () => {
|
|||||||
expect(savedStylesViewComponent.$children[0].$children.length).toBe(0);
|
expect(savedStylesViewComponent.$children[0].$children.length).toBe(0);
|
||||||
stylesViewComponent.$children[0].saveStyle(mockStyle);
|
stylesViewComponent.$children[0].saveStyle(mockStyle);
|
||||||
|
|
||||||
stylesViewComponent.$nextTick().then(() => {
|
return stylesViewComponent.$nextTick().then(() => {
|
||||||
expect(savedStylesViewComponent.$children[0].$children.length).toBe(1);
|
expect(savedStylesViewComponent.$children[0].$children.length).toBe(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -91,7 +94,7 @@ describe("the inspector", () => {
|
|||||||
|
|
||||||
stylesViewComponent.$children[0].saveStyle(mockStyle);
|
stylesViewComponent.$children[0].saveStyle(mockStyle);
|
||||||
|
|
||||||
stylesViewComponent.$nextTick().then(() => {
|
return stylesViewComponent.$nextTick().then(() => {
|
||||||
const styleSelectorComponent = savedStylesViewComponent.$children[0].$children[0];
|
const styleSelectorComponent = savedStylesViewComponent.$children[0].$children[0];
|
||||||
|
|
||||||
styleSelectorComponent.selectStyle();
|
styleSelectorComponent.selectStyle();
|
||||||
@ -147,7 +150,7 @@ describe("the inspector", () => {
|
|||||||
stylesViewComponent = createViewComponent(StylesView, selection, openmct);
|
stylesViewComponent = createViewComponent(StylesView, selection, openmct);
|
||||||
savedStylesViewComponent = createViewComponent(SavedStylesView, selection, openmct);
|
savedStylesViewComponent = createViewComponent(SavedStylesView, selection, openmct);
|
||||||
|
|
||||||
stylesViewComponent.$nextTick().then(() => {
|
return stylesViewComponent.$nextTick().then(() => {
|
||||||
const styleEditorComponentIndex = stylesViewComponent.$children[0].$children.length - 1;
|
const styleEditorComponentIndex = stylesViewComponent.$children[0].$children.length - 1;
|
||||||
const styleEditorComponent = stylesViewComponent.$children[0].$children[styleEditorComponentIndex];
|
const styleEditorComponent = stylesViewComponent.$children[0].$children[styleEditorComponentIndex];
|
||||||
const saveStyleButtonIndex = styleEditorComponent.$children.length - 1;
|
const saveStyleButtonIndex = styleEditorComponent.$children.length - 1;
|
||||||
@ -168,7 +171,7 @@ describe("the inspector", () => {
|
|||||||
stylesViewComponent = createViewComponent(StylesView, selection, openmct);
|
stylesViewComponent = createViewComponent(StylesView, selection, openmct);
|
||||||
savedStylesViewComponent = createViewComponent(SavedStylesView, selection, openmct);
|
savedStylesViewComponent = createViewComponent(SavedStylesView, selection, openmct);
|
||||||
|
|
||||||
stylesViewComponent.$nextTick().then(() => {
|
return stylesViewComponent.$nextTick().then(() => {
|
||||||
const styleEditorComponentIndex = stylesViewComponent.$children[0].$children.length - 1;
|
const styleEditorComponentIndex = stylesViewComponent.$children[0].$children.length - 1;
|
||||||
const styleEditorComponent = stylesViewComponent.$children[0].$children[styleEditorComponentIndex];
|
const styleEditorComponent = stylesViewComponent.$children[0].$children[styleEditorComponentIndex];
|
||||||
const saveStyleButtonIndex = styleEditorComponent.$children.length - 1;
|
const saveStyleButtonIndex = styleEditorComponent.$children.length - 1;
|
||||||
@ -185,7 +188,7 @@ describe("the inspector", () => {
|
|||||||
stylesViewComponent = createViewComponent(StylesView, selection, openmct);
|
stylesViewComponent = createViewComponent(StylesView, selection, openmct);
|
||||||
savedStylesViewComponent = createViewComponent(SavedStylesView, selection, openmct);
|
savedStylesViewComponent = createViewComponent(SavedStylesView, selection, openmct);
|
||||||
|
|
||||||
stylesViewComponent.$nextTick().then(() => {
|
return stylesViewComponent.$nextTick().then(() => {
|
||||||
const styleEditorComponentIndex = stylesViewComponent.$children[0].$children.length - 1;
|
const styleEditorComponentIndex = stylesViewComponent.$children[0].$children.length - 1;
|
||||||
const styleEditorComponent = stylesViewComponent.$children[0].$children[styleEditorComponentIndex];
|
const styleEditorComponent = stylesViewComponent.$children[0].$children[styleEditorComponentIndex];
|
||||||
const saveStyleButtonIndex = styleEditorComponent.$children.length - 1;
|
const saveStyleButtonIndex = styleEditorComponent.$children.length - 1;
|
||||||
|
@ -134,7 +134,7 @@ export default {
|
|||||||
actionCollection: {
|
actionCollection: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return {};
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -233,6 +233,7 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
document.addEventListener('click', this.closeViewAndSaveMenu);
|
document.addEventListener('click', this.closeViewAndSaveMenu);
|
||||||
|
|
||||||
this.promptUserbeforeNavigatingAway = this.promptUserbeforeNavigatingAway.bind(this);
|
this.promptUserbeforeNavigatingAway = this.promptUserbeforeNavigatingAway.bind(this);
|
||||||
window.addEventListener('beforeunload', this.promptUserbeforeNavigatingAway);
|
window.addEventListener('beforeunload', this.promptUserbeforeNavigatingAway);
|
||||||
|
|
||||||
|
@ -49,6 +49,10 @@ class ApplicationRouter extends EventEmitter {
|
|||||||
this.routes = [];
|
this.routes = [];
|
||||||
this.started = false;
|
this.started = false;
|
||||||
|
|
||||||
|
openmct.once('destroy', () => {
|
||||||
|
this.destroy();
|
||||||
|
});
|
||||||
|
|
||||||
this.setHash = _.debounce(this.setHash.bind(this), 300);
|
this.setHash = _.debounce(this.setHash.bind(this), 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user