diff --git a/src/plugins/charts/scatter/plugin.js b/src/plugins/charts/scatter/plugin.js index b136bb12f0..075083a718 100644 --- a/src/plugins/charts/scatter/plugin.js +++ b/src/plugins/charts/scatter/plugin.js @@ -98,9 +98,11 @@ export default function () { }; function getScatterPlotFormControl(openmct) { + let destroyComponent; + return { show(element, model, onChange) { - const { vNode } = mount( + const { vNode, destroy } = mount( { el: element, components: { @@ -122,8 +124,12 @@ export default function () { element } ); + destroyComponent = destroy; return vNode; + }, + destroy() { + destroyComponent(); } }; } diff --git a/src/plugins/clearData/plugin.js b/src/plugins/clearData/plugin.js index 8f2fd74a33..f8dc606b44 100644 --- a/src/plugins/clearData/plugin.js +++ b/src/plugins/clearData/plugin.js @@ -30,7 +30,7 @@ export default function plugin(appliesToObjects, options = { indicator: true }) return function install(openmct) { if (installIndicator) { - const { vNode } = mount( + const { vNode, destroy } = mount( { components: { GlobalClearIndicator @@ -49,7 +49,8 @@ export default function plugin(appliesToObjects, options = { indicator: true }) let indicator = { element: vNode.el, key: 'global-clear-indicator', - priority: openmct.priority.DEFAULT + priority: openmct.priority.DEFAULT, + destroy: destroy }; openmct.indicators.add(indicator); diff --git a/src/plugins/gauge/GaugePlugin.js b/src/plugins/gauge/GaugePlugin.js index 4c64ccb8fe..d05e4eff47 100644 --- a/src/plugins/gauge/GaugePlugin.js +++ b/src/plugins/gauge/GaugePlugin.js @@ -167,9 +167,11 @@ export default function () { }; function getGaugeFormController(openmct) { + let destroyComponent; + return { show(element, model, onChange) { - const { vNode } = mount( + const { vNode, destroy } = mount( { el: element, components: { @@ -191,8 +193,12 @@ export default function () { element } ); + destroyComponent = destroy; return vNode.componentInstance; + }, + destroy() { + destroyComponent(); } }; } diff --git a/src/plugins/imagery/components/ImageryTimeView.vue b/src/plugins/imagery/components/ImageryTimeView.vue index 23aeba6a51..6e8a24819f 100644 --- a/src/plugins/imagery/components/ImageryTimeView.vue +++ b/src/plugins/imagery/components/ImageryTimeView.vue @@ -98,6 +98,9 @@ export default { if (this.unlisten) { this.unlisten(); } + if (this.destroyImageryContainer) { + this.destroyImageryContainer(); + } }, methods: { setTimeContext() { @@ -237,7 +240,10 @@ export default { imageryContainer = existingContainer; imageryContainer.style.maxWidth = `${containerWidth}px`; } else { - const { vNode } = mount( + if (this.destroyImageryContainer) { + this.destroyImageryContainer(); + } + const { vNode, destroy } = mount( { components: { SwimLane @@ -257,6 +263,7 @@ export default { } ); + this.destroyImageryContainer = destroy; const component = vNode.componentInstance; this.$refs.imageryHolder.appendChild(component.$el); diff --git a/src/plugins/notebook/components/NotebookSnapshotIndicator.vue b/src/plugins/notebook/components/NotebookSnapshotIndicator.vue index 9906d1f15f..16eba66b4d 100644 --- a/src/plugins/notebook/components/NotebookSnapshotIndicator.vue +++ b/src/plugins/notebook/components/NotebookSnapshotIndicator.vue @@ -90,7 +90,10 @@ export default { drawerElement.innerHTML = '
'; const divElement = document.querySelector('.l-shell__drawer div'); - mount( + if (this.destroySnapshotContainer) { + this.destroySnapshotContainer(); + } + const { destroy } = mount( { el: divElement, components: { @@ -113,6 +116,7 @@ export default { element: divElement } ); + this.destroySnapshotContainer = destroy; }, updateSnapshotIndicatorTitle() { const snapshotCount = this.snapshotContainer.getSnapshots().length; diff --git a/src/plugins/notebook/plugin.js b/src/plugins/notebook/plugin.js index 33b23da862..6ecdc8a4da 100644 --- a/src/plugins/notebook/plugin.js +++ b/src/plugins/notebook/plugin.js @@ -83,7 +83,7 @@ function installBaseNotebookFunctionality(openmct) { openmct.actions.register(new CopyToNotebookAction(openmct)); openmct.actions.register(new ExportNotebookAsTextAction(openmct)); - const { vNode } = mount( + const { vNode, destroy } = mount( { components: { NotebookSnapshotIndicator @@ -102,7 +102,8 @@ function installBaseNotebookFunctionality(openmct) { const indicator = { element: vNode.el, key: 'notebook-snapshot-indicator', - priority: openmct.priority.DEFAULT + priority: openmct.priority.DEFAULT, + destroy: destroy }; openmct.indicators.add(indicator); diff --git a/src/plugins/notificationIndicator/plugin.js b/src/plugins/notificationIndicator/plugin.js index 22e92f6bde..79dfce78f2 100644 --- a/src/plugins/notificationIndicator/plugin.js +++ b/src/plugins/notificationIndicator/plugin.js @@ -24,7 +24,7 @@ import NotificationIndicator from './components/NotificationIndicator.vue'; export default function plugin() { return function install(openmct) { - const { vNode } = mount( + const { vNode, destroy } = mount( { components: { NotificationIndicator @@ -42,7 +42,8 @@ export default function plugin() { let indicator = { key: 'notifications-indicator', element: vNode.el, - priority: openmct.priority.DEFAULT + priority: openmct.priority.DEFAULT, + destroy: destroy }; openmct.indicators.add(indicator); }; diff --git a/src/plugins/plot/stackedPlot/StackedPlotItem.vue b/src/plugins/plot/stackedPlot/StackedPlotItem.vue index 219aed6b74..f69e44eb16 100644 --- a/src/plugins/plot/stackedPlot/StackedPlotItem.vue +++ b/src/plugins/plot/stackedPlot/StackedPlotItem.vue @@ -197,7 +197,7 @@ export default { this.composition.load(); } - const { vNode } = mount( + const { vNode, destroy } = mount( { components: { Plot @@ -249,6 +249,7 @@ export default { } ); this.component = vNode.componentInstance; + this._destroy = destroy; if (this.isEditing) { this.setSelection(); diff --git a/src/plugins/userIndicator/plugin.js b/src/plugins/userIndicator/plugin.js index e844a77f83..d9cce9a79b 100644 --- a/src/plugins/userIndicator/plugin.js +++ b/src/plugins/userIndicator/plugin.js @@ -25,7 +25,7 @@ import UserIndicator from './components/UserIndicator.vue'; export default function UserIndicatorPlugin() { function addIndicator(openmct) { - const { vNode } = mount( + const { vNode, destroy } = mount( { components: { UserIndicator @@ -43,7 +43,8 @@ export default function UserIndicatorPlugin() { openmct.indicators.add({ key: 'user-indicator', element: vNode.el, - priority: openmct.priority.HIGH + priority: openmct.priority.HIGH, + destroy: destroy }); }