diff --git a/src/plugins/notebook/components/Notebook.vue b/src/plugins/notebook/components/Notebook.vue index 399c408707..d320f18016 100644 --- a/src/plugins/notebook/components/Notebook.vue +++ b/src/plugins/notebook/components/Notebook.vue @@ -140,6 +140,7 @@ import SearchResults from './SearchResults.vue'; import Sidebar from './Sidebar.vue'; import { clearDefaultNotebook, getDefaultNotebook, setDefaultNotebook, setDefaultNotebookSectionId, setDefaultNotebookPageId } from '../utils/notebook-storage'; import { addNotebookEntry, createNewEmbed, getEntryPosById, getNotebookEntries, mutateObject } from '../utils/notebook-entries'; +import { saveNotebookImageDomainObject, updateNamespaceOfDomainObject } from '../utils/notebook-image'; import { NOTEBOOK_VIEW_TYPE } from '../notebook-constants'; import objectUtils from 'objectUtils'; @@ -385,9 +386,13 @@ export default { const snapshotId = event.dataTransfer.getData('openmct/snapshot/id'); if (snapshotId.length) { const snapshot = this.snapshotContainer.getSnapshot(snapshotId); - this.newEntry(snapshot); + this.newEntry(snapshot.embedObject); this.snapshotContainer.removeSnapshot(snapshotId); + const namespace = this.domainObject.identifier.namespace; + const notebookImageDomainObject = updateNamespaceOfDomainObject(snapshot.notebookImageDomainObject, namespace); + saveNotebookImageDomainObject(this.openmct, notebookImageDomainObject); + return; } diff --git a/src/plugins/notebook/components/NotebookEmbed.vue b/src/plugins/notebook/components/NotebookEmbed.vue index 6011a0d544..7a5c6aa256 100644 --- a/src/plugins/notebook/components/NotebookEmbed.vue +++ b/src/plugins/notebook/components/NotebookEmbed.vue @@ -40,7 +40,7 @@ export default { components: { PopupMenu }, - inject: ['openmct'], + inject: ['openmct', 'snapshotContainer'], props: { embed: { type: Object, @@ -48,6 +48,12 @@ export default { return {}; } }, + isSnapshotContainer: { + type: Boolean, + default() { + return false; + } + }, removeActionString: { type: String, default() { @@ -135,6 +141,14 @@ export default { return; } + if (this.isSnapshotContainer) { + const snapshot = this.snapshotContainer.getSnapshot(this.embed.id); + const fullSizeImageURL = snapshot.notebookImageDomainObject.configuration.fullSizeImageURL; + painterroInstance.show(fullSizeImageURL); + + return; + } + this.openmct.objects.get(fullSizeImageObjectIdentifier) .then(object => { painterroInstance.show(object.configuration.fullSizeImageURL); @@ -190,6 +204,14 @@ export default { return; } + if (this.isSnapshotContainer) { + const snapshot = this.snapshotContainer.getSnapshot(this.embed.id); + const fullSizeImageURL = snapshot.notebookImageDomainObject.configuration.fullSizeImageURL; + this.openSnapshotOverlay(fullSizeImageURL); + + return; + } + this.openmct.objects.get(fullSizeImageObjectIdentifier) .then(object => { this.openSnapshotOverlay(object.configuration.fullSizeImageURL); @@ -259,8 +281,20 @@ export default { updateSnapshot(snapshotObject) { this.embed.snapshot.thumbnailImage = snapshotObject.thumbnailImage; - updateNotebookImageDomainObject(this.openmct, this.embed.snapshot.fullSizeImageObjectIdentifier, snapshotObject.fullSizeImage); + this.updateNotebookImageDomainObjectSnapshot(snapshotObject); this.updateEmbed(this.embed); + }, + updateNotebookImageDomainObjectSnapshot(snapshotObject) { + if (this.isSnapshotContainer) { + const snapshot = this.snapshotContainer.getSnapshot(this.embed.id); + + snapshot.embedObject.snapshot.thumbnailImage = snapshotObject.thumbnailImage; + snapshot.notebookImageDomainObject.configuration.fullSizeImageURL = snapshotObject.fullSizeImage.src; + + this.snapshotContainer.updateSnapshot(snapshot); + } else { + updateNotebookImageDomainObject(this.openmct, this.embed.snapshot.fullSizeImageObjectIdentifier, snapshotObject.fullSizeImage); + } } } }; diff --git a/src/plugins/notebook/components/NotebookEntry.vue b/src/plugins/notebook/components/NotebookEntry.vue index 14a647dda7..bfbf5831f6 100644 --- a/src/plugins/notebook/components/NotebookEntry.vue +++ b/src/plugins/notebook/components/NotebookEntry.vue @@ -102,9 +102,11 @@