Merge pull request #2854 from nasa/notebook-preview-action-fix

[Notebook] Embed preview action fix
This commit is contained in:
Nikhil 2020-04-01 10:13:01 -07:00 committed by GitHub
commit 250fee125a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 28 deletions

View File

@ -217,18 +217,16 @@ export default {
populateActionMenu() {
const self = this;
const actions = [new PreviewAction(self.openmct)];
self.openmct.objects.get(self.embed.type)
.then((domainObject) => {
actions.forEach((action) => {
self.actions.push({
cssClass: action.cssClass,
name: action.name,
perform: () => {
action.invoke([domainObject].concat(self.openmct.router.path));
}
});
});
actions.forEach((action) => {
self.actions.push({
cssClass: action.cssClass,
name: action.name,
perform: () => {
action.invoke(JSON.parse(self.embed.objectPath));
}
});
});
},
removeEmbed(id) {
this.$emit('removeEmbed', id);

View File

@ -95,7 +95,8 @@ export const createNewEmbed = (snapshotMeta, snapshot = '') => {
id: 'embed-' + date,
name,
snapshot,
type
type,
objectPath: JSON.stringify(objectPath)
};
}

View File

@ -40,12 +40,6 @@
:current-view="currentView"
@setView="setView"
/>
<button
v-if="notebookEnabled"
class="l-browse-bar__actions__edit c-button icon-notebook"
title="New Notebook entry"
@click="snapshot"
></button>
</div>
</div>
</div>
@ -57,7 +51,6 @@
<script>
import ContextMenuDropDown from '../../ui/components/contextMenuDropDown.vue';
import Snapshot from '@/plugins/notebook/snapshot';
import ViewSwitcher from '../../ui/layout/ViewSwitcher.vue';
export default {
@ -94,20 +87,11 @@ export default {
mounted() {
let view = this.openmct.objectViews.get(this.domainObject)[0];
this.setView(view);
if (this.openmct.types.get('notebook')) {
this.notebookSnapshot = new Snapshot(this.openmct);
this.notebookEnabled = true;
}
},
destroyed() {
this.view.destroy();
},
methods: {
snapshot() {
let element = document.getElementsByClassName("l-preview-window__object-view")[0];
this.notebookSnapshot.capture(this.domainObject, element);
},
clear() {
if (this.view) {
this.view.destroy();