Compare commits

...

18 Commits

Author SHA1 Message Date
b062615c25 Merge branch 'master' into unload-openmct 2021-09-30 14:25:43 -07:00
e784242379 Fix leaking test specs 2021-09-10 17:21:09 -07:00
da8dbf25bf Make sure app holder gets destroyed 2021-09-10 17:20:54 -07:00
a5571eec05 Clean up router on destroy 2021-09-10 16:31:14 -07:00
19802ce2cc Fix merge error and restore missing bind statement 2021-09-10 16:30:49 -07:00
e83735a927 Clean up conductor resize handler on destroy 2021-09-10 16:24:35 -07:00
c9a47a411a Clean up notebook 2021-09-10 16:23:55 -07:00
a6e55fd493 Removed console logS 2021-09-10 16:17:38 -07:00
76f35a0bcd Merge recent changes to MCT.js from master 2021-09-10 16:17:12 -07:00
b6930ef7cd Merge branch 'master' into unload-openmct 2021-09-10 15:58:54 -07:00
57b9cbd42f Remove console log in Selection.js 2021-09-10 15:58:41 -07:00
17901147ef Fix broken tests 2021-09-10 15:50:44 -07:00
58b8f90682 Clean up MCT class 2021-09-10 15:50:36 -07:00
d06cbc8975 Destroy API listeners 2021-09-10 11:34:52 -07:00
553b18587c Clean up workers on destroy 2021-09-03 15:03:47 -07:00
590dc74e45 Fix memory leak in legacy ticker service 2021-09-03 14:46:23 -07:00
3557ed4b4c Fix memory leaks related to navigation 2021-09-03 13:36:51 -07:00
41cc52d50a Remove legacy routes support 2021-09-03 12:15:32 -07:00
32 changed files with 293 additions and 247 deletions

View File

@ -41,11 +41,6 @@ define([
"$scope"
]
}
],
"routes": [
{
"templateUrl": "templates/exampleForm.html"
}
]
}
}

View File

@ -96,5 +96,9 @@ define([
return this.workerInterface.subscribe(workerRequest, callback);
};
GeneratorProvider.prototype.destroy = function () {
this.workerInterface.destroy();
};
return GeneratorProvider;
});

View File

@ -40,6 +40,11 @@ define([
this.callbacks = {};
}
WorkerInterface.prototype.destroy = function () {
delete this.worker.onmessage;
this.worker.terminate();
};
WorkerInterface.prototype.onMessage = function (message) {
message = message.data;
var callback = this.callbacks[message.id];

View File

@ -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 SinewaveLimitProvider());
};

View File

@ -164,16 +164,6 @@ define([
"license": "license-apache",
"link": "http://logging.apache.org/log4net/license.html"
}
],
"routes": [
{
"when": "/licenses",
"template": licensesTemplate
},
{
"when": "/licenses-md",
"template": licensesExportMdTemplate
}
]
}
}

View File

@ -50,8 +50,6 @@ define([
name: "platform/commonUI/browse",
definition: {
"extensions": {
"routes": [
],
"constants": [
{
"key": "DEFAULT_PATH",

View File

@ -39,9 +39,6 @@ define(
this.callbacks = [];
this.checks = [];
this.$window = $window;
this.oldUnload = $window.onbeforeunload;
$window.onbeforeunload = this.onBeforeUnload.bind(this);
}
/**

View File

@ -71,7 +71,8 @@ define([
"implementation": TickerService,
"depends": [
"$timeout",
"now"
"now",
"$rootScope"
]
},
{

View File

@ -32,8 +32,13 @@ define(
* @param $timeout Angular's $timeout
* @param {Function} now function to provide the current time in ms
*/
function TickerService($timeout, now) {
function TickerService($timeout, now, $rootScope) {
var self = this;
var timeoutId;
$rootScope.$on('$destroy', function () {
$timeout.cancel(timeoutId);
});
function tick() {
var timestamp = now(),
@ -48,7 +53,7 @@ define(
}
// Try to update at exactly the next second
$timeout(tick, 1000 - millis, true);
timeoutId = $timeout(tick, 1000 - millis, true);
}
tick();

View File

@ -30,16 +30,18 @@ define(
var mockTimeout,
mockNow,
mockCallback,
tickerService;
tickerService,
mockRootScope;
beforeEach(function () {
mockTimeout = jasmine.createSpy('$timeout');
mockNow = jasmine.createSpy('now');
mockCallback = jasmine.createSpy('callback');
mockRootScope = jasmine.createSpyObj('rootScope', ['$on']);
mockNow.and.returnValue(TEST_TIMESTAMP);
tickerService = new TickerService(mockTimeout, mockNow);
tickerService = new TickerService(mockTimeout, mockNow, mockRootScope);
});
it("notifies listeners of clock ticks", function () {

View File

@ -58,7 +58,7 @@ define([
) {
var $http = this.$http,
$log = this.$log,
app = angular.module(Constants.MODULE_NAME, ["ngRoute"]),
app = angular.module(Constants.MODULE_NAME, []),
loader = new BundleLoader($http, $log, openmct.legacyRegistry),
resolver = new BundleResolver(
new ExtensionResolver(

View File

@ -28,8 +28,7 @@
define(
[
'./FrameworkLayer',
'angular',
'angular-route'
'angular'
],
function (
FrameworkLayer,

View File

@ -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
function registerComponents(components) {
var app = this.app,
@ -194,13 +166,6 @@ define(
CustomRegistrars.prototype.constants =
mapUpon(registerConstant);
/**
* Register Angular routes.
* @param {Array} extensions the resolved extensions
*/
CustomRegistrars.prototype.routes =
mapUpon(registerRoute);
/**
* Register Angular directives.
* @param {Array} extensions the resolved extensions

View File

@ -57,7 +57,6 @@ define(
expect(customRegistrars.directives).toBeTruthy();
expect(customRegistrars.controllers).toBeTruthy();
expect(customRegistrars.services).toBeTruthy();
expect(customRegistrars.routes).toBeTruthy();
expect(customRegistrars.constants).toBeTruthy();
expect(customRegistrars.runs).toBeTruthy();
});
@ -139,47 +138,6 @@ define(
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 () {
// Most relevant code will be exercised in service compositor spec
expect(customRegistrars.components).toBeTruthy();

View File

@ -110,8 +110,15 @@ define([
worker = workerService.run('bareBonesSearchWorker');
}
worker.addEventListener('message', function (messageEvent) {
function handleWorkerMessage(messageEvent) {
provider.onWorkerMessage(messageEvent);
}
worker.addEventListener('message', handleWorkerMessage);
this.openmct.once('destroy', () => {
worker.removeEventListener('message', handleWorkerMessage);
worker.terminate();
});
return worker;

View File

@ -31,7 +31,6 @@ define([
'objectUtils',
'./plugins/plugins',
'./adapter/indicators/legacy-indicators-plugin',
'./plugins/buildInfo/plugin',
'./ui/registries/ViewRegistry',
'./plugins/imagery/plugin',
'./ui/registries/InspectorViewRegistry',
@ -40,6 +39,7 @@ define([
'./ui/router/Browse',
'../platform/framework/src/Main',
'./ui/layout/Layout.vue',
'./ui/inspector/styles/StylesManager',
'../platform/core/src/objects/DomainObjectImpl',
'../platform/core/src/capabilities/ContextualDomainObject',
'./ui/preview/plugin',
@ -60,7 +60,6 @@ define([
objectUtils,
plugins,
LegacyIndicatorsPlugin,
buildInfoPlugin,
ViewRegistry,
ImageryPlugin,
InspectorViewRegistry,
@ -69,6 +68,7 @@ define([
Browse,
Main,
Layout,
stylesManager,
DomainObjectImpl,
ContextualDomainObject,
PreviewPlugin,
@ -123,6 +123,7 @@ define([
};
this.destroy = this.destroy.bind(this);
/**
* Tracks current selection state of the application.
* @private
@ -376,6 +377,7 @@ define([
* MCT; if undefined, MCT will be run in the body of the document
*/
MCT.prototype.start = function (domElement = document.body, isHeadlessMode = false) {
if (this.types.get('layout') === undefined) {
this.install(this.plugins.DisplayLayout({
showAsView: ['summary-widget']
@ -434,6 +436,9 @@ define([
domElement.appendChild(appLayout.$mount().$el);
this.layout = appLayout.$refs.layout;
this.once('destroy', () => {
appLayout.$destroy();
});
Browse(this);
}
@ -462,9 +467,40 @@ define([
};
MCT.prototype.destroy = function () {
if (this._destroyed === true) {
return;
}
window.removeEventListener('beforeunload', this.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;

View File

@ -32,6 +32,10 @@ define([
// cannot be injected.
function AlternateCompositionInitializer(openmct) {
AlternateCompositionCapability.appliesTo = function (model, id) {
openmct.once('destroy', () => {
delete AlternateCompositionCapability.appliesTo;
});
model = objectUtils.toNewFormat(model, id || '');
return Boolean(openmct.composition.get(model));

View File

@ -28,6 +28,10 @@ export default class Editor extends EventEmitter {
super();
this.editing = false;
this.openmct = openmct;
openmct.once('destroy', () => {
this.removeAllListeners();
});
}
/**

View File

@ -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 = [
{
name: 'mock folder',

View File

@ -17,11 +17,7 @@ class OverlayAPI {
this.dismissLastOverlay = this.dismissLastOverlay.bind(this);
document.addEventListener('keyup', (event) => {
if (event.key === 'Escape') {
this.dismissLastOverlay();
}
});
document.addEventListener('keyup', this.dismissLastOverlay);
}
@ -52,10 +48,12 @@ class OverlayAPI {
/**
* private
*/
dismissLastOverlay() {
let lastOverlay = this.activeOverlays[this.activeOverlays.length - 1];
if (lastOverlay && lastOverlay.dismissable) {
lastOverlay.dismiss();
dismissLastOverlay(event) {
if (event.key === 'Escape') {
let lastOverlay = this.activeOverlays[this.activeOverlays.length - 1];
if (lastOverlay && lastOverlay.dismissable) {
lastOverlay.dismiss();
}
}
}
@ -63,7 +61,7 @@ class OverlayAPI {
* A description of option properties that can be passed into the overlay
* @typedef options
* @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 {function} onDestroy callback to be called when overlay is destroyed
* @property {boolean} dismissable allow user to dismiss overlay by using esc, and clicking away
@ -132,6 +130,10 @@ class OverlayAPI {
return progressDialog;
}
destroy() {
document.removeEventListener('keyup', this.dismissLastOverlay);
}
}
export default OverlayAPI;

View File

@ -32,6 +32,10 @@ export default class StatusAPI extends EventEmitter {
this.get = this.get.bind(this);
this.set = this.set.bind(this);
this.observe = this.observe.bind(this);
openmct.once('destroy', () => {
this.removeAllListeners();
});
}
get(identifier) {

View File

@ -75,7 +75,16 @@ describe("the plugin", () => {
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(openmct.objects, 'save').and.returnValue(Promise.resolve(true));

View File

@ -117,6 +117,10 @@ export default function NotebookPlugin() {
key: 'notebook-snapshot-indicator'
};
openmct.once('destroy', () => {
snapshotContainer.destroy();
});
openmct.indicators.add(indicator);
openmct.objectViews.addProvider({

View File

@ -85,4 +85,8 @@ export default class SnapshotContainer extends EventEmitter {
return this.saveSnapshots(updatedSnapshots);
}
destroy() {
delete SnapshotContainer.instance;
}
}

View File

@ -22,95 +22,109 @@
import * as NotebookEntries from './notebook-entries';
import { createOpenMct, resetApplicationState } from 'utils/testing';
const notebookStorage = {
name: 'notebook',
identifier: {
namespace: '',
key: 'test-notebook'
},
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 notebookStorage;
let notebookEntries;
let notebookDomainObject;
let selectedSection;
let selectedPage;
let openmct;
let mockIdentifierService;
describe('Notebook Entries:', () => {
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.$injector = jasmine.createSpyObj('$injector', ['get']);
mockIdentifierService = jasmine.createSpyObj(
'identifierService',
['parse']
);
openmct.$injector.get.and.callFake((key) => {
return {
'identifierService': mockIdentifierService,
'$rootScope': {
'$destroy': () => {}
}
}[key];
});
mockIdentifierService.parse.and.returnValue({
getSpace: () => {
return '';
}
});
openmct.$injector.get.and.returnValue(mockIdentifierService);
openmct.types.addType('notebook', {
creatable: true
});

View File

@ -23,51 +23,55 @@
import * as NotebookStorage from './notebook-storage';
import { createOpenMct, resetApplicationState } from 'utils/testing';
const notebookSection = {
id: 'temp-section',
isDefault: false,
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 notebookSection;
let domainObject;
let notebookStorage;
let openmct;
let mockIdentifierService;
describe('Notebook Storage:', () => {
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.$injector = jasmine.createSpyObj('$injector', ['get']);
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);
openmct.objects.addProvider('', jasmine.createSpyObj('mockNotebookProvider', [
'create',

View File

@ -29,13 +29,8 @@ describe('the plugin', function () {
let element;
let child;
let openmct;
let appHolder;
beforeEach((done) => {
appHolder = document.createElement('div');
appHolder.style.width = '640px';
appHolder.style.height = '480px';
openmct = createOpenMct();
openmct.install(new PlanPlugin());
@ -50,7 +45,7 @@ describe('the plugin', function () {
element.appendChild(child);
openmct.on('start', done);
openmct.start(appHolder);
openmct.start(element);
});
afterEach(() => {
@ -99,6 +94,7 @@ describe('the plugin', function () {
}
];
let planView;
let view;
beforeEach(() => {
openmct.time.timeSystem('utc', {
@ -139,12 +135,16 @@ describe('the plugin', function () {
const applicableViews = openmct.objectViews.get(planDomainObject, []);
planView = applicableViews.find((viewProvider) => viewProvider.key === 'plan.view');
let view = planView.view(planDomainObject, mockObjectPath);
view = planView.view(planDomainObject, mockObjectPath);
view.show(child, true);
return Vue.nextTick();
});
afterEach(() => {
view.destroy();
});
it('loads activities into the view', () => {
const svgEls = element.querySelectorAll('.c-plan__contents svg');
expect(svgEls.length).toEqual(1);

View File

@ -98,7 +98,10 @@ export default {
//Respond to changes in conductor
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: {
setAxisDimensions() {

View File

@ -38,6 +38,10 @@ define(
this.openmct = openmct;
this.selected = [];
this.openmct.once('destroy', () => {
this.removeAllListeners();
});
}
Selection.prototype = Object.create(EventEmitter.prototype);

View File

@ -54,6 +54,9 @@ describe("the inspector", () => {
});
afterEach(() => {
stylesViewComponent.$destroy();
savedStylesViewComponent.$destroy();
return resetApplicationState(openmct);
});
@ -77,7 +80,7 @@ describe("the inspector", () => {
expect(savedStylesViewComponent.$children[0].$children.length).toBe(0);
stylesViewComponent.$children[0].saveStyle(mockStyle);
stylesViewComponent.$nextTick().then(() => {
return stylesViewComponent.$nextTick().then(() => {
expect(savedStylesViewComponent.$children[0].$children.length).toBe(1);
});
});
@ -91,7 +94,7 @@ describe("the inspector", () => {
stylesViewComponent.$children[0].saveStyle(mockStyle);
stylesViewComponent.$nextTick().then(() => {
return stylesViewComponent.$nextTick().then(() => {
const styleSelectorComponent = savedStylesViewComponent.$children[0].$children[0];
styleSelectorComponent.selectStyle();
@ -147,7 +150,7 @@ describe("the inspector", () => {
stylesViewComponent = createViewComponent(StylesView, selection, openmct);
savedStylesViewComponent = createViewComponent(SavedStylesView, selection, openmct);
stylesViewComponent.$nextTick().then(() => {
return stylesViewComponent.$nextTick().then(() => {
const styleEditorComponentIndex = stylesViewComponent.$children[0].$children.length - 1;
const styleEditorComponent = stylesViewComponent.$children[0].$children[styleEditorComponentIndex];
const saveStyleButtonIndex = styleEditorComponent.$children.length - 1;
@ -168,7 +171,7 @@ describe("the inspector", () => {
stylesViewComponent = createViewComponent(StylesView, selection, openmct);
savedStylesViewComponent = createViewComponent(SavedStylesView, selection, openmct);
stylesViewComponent.$nextTick().then(() => {
return stylesViewComponent.$nextTick().then(() => {
const styleEditorComponentIndex = stylesViewComponent.$children[0].$children.length - 1;
const styleEditorComponent = stylesViewComponent.$children[0].$children[styleEditorComponentIndex];
const saveStyleButtonIndex = styleEditorComponent.$children.length - 1;
@ -185,7 +188,7 @@ describe("the inspector", () => {
stylesViewComponent = createViewComponent(StylesView, selection, openmct);
savedStylesViewComponent = createViewComponent(SavedStylesView, selection, openmct);
stylesViewComponent.$nextTick().then(() => {
return stylesViewComponent.$nextTick().then(() => {
const styleEditorComponentIndex = stylesViewComponent.$children[0].$children.length - 1;
const styleEditorComponent = stylesViewComponent.$children[0].$children[styleEditorComponentIndex];
const saveStyleButtonIndex = styleEditorComponent.$children.length - 1;

View File

@ -134,7 +134,7 @@ export default {
actionCollection: {
type: Object,
default: () => {
return {};
return undefined;
}
}
},
@ -233,6 +233,7 @@ export default {
},
mounted: function () {
document.addEventListener('click', this.closeViewAndSaveMenu);
this.promptUserbeforeNavigatingAway = this.promptUserbeforeNavigatingAway.bind(this);
window.addEventListener('beforeunload', this.promptUserbeforeNavigatingAway);

View File

@ -49,6 +49,10 @@ class ApplicationRouter extends EventEmitter {
this.routes = [];
this.started = false;
openmct.once('destroy', () => {
this.destroy();
});
this.setHash = _.debounce(this.setHash.bind(this), 300);
}