Skip to content

Commit

Permalink
[Notebook] Create Snapshot directly from any frame in a layout #3300
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilmandlik committed Aug 6, 2021
1 parent fe928a1 commit 12818fb
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/api/overlays/components/OverlayComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
></button>
<div
ref="element"
class="c-overlay__contents"
class="c-overlay__contents js-notebook-snapshot-item-wrapper"
tabindex="0"
></div>
<div
Expand Down
11 changes: 6 additions & 5 deletions src/plugins/notebook/components/NotebookMenuSwitcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default {
cssClass: 'icon-notebook',
name: `Save to Notebook ${defaultPath}`,
onItemClicked: () => {
return this.snapshot(NOTEBOOK_DEFAULT);
return this.snapshot(NOTEBOOK_DEFAULT, event.target);
}
});
}
Expand All @@ -90,16 +90,17 @@ export default {
cssClass: 'icon-camera',
name: 'Save to Notebook Snapshots',
onItemClicked: () => {
return this.snapshot(NOTEBOOK_SNAPSHOT);
return this.snapshot(NOTEBOOK_SNAPSHOT, event.target);
}
});
this.openmct.menus.showMenu(x, y, notebookTypes);
},
snapshot(notebookType) {
snapshot(notebookType, target) {
this.$nextTick(() => {
const element = document.querySelector('.c-overlay__contents')
|| document.getElementsByClassName('l-shell__main-container')[0];
const wrapper = target && target.closest('.js-notebook-snapshot-item-wrapper')
|| document;
const element = wrapper.querySelector('.js-notebook-snapshot-item');
const bounds = this.openmct.time.bounds();
const link = !this.ignoreLink
Expand Down
14 changes: 11 additions & 3 deletions src/ui/components/ObjectFrame.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*****************************************************************************/
<template>
<div
class="c-so-view"
class="c-so-view js-notebook-snapshot-item-wrapper"
:class="[
statusClass,
'c-so-view--' + domainObject.type,
Expand Down Expand Up @@ -56,6 +56,11 @@
'has-complex-content': complexContent
}"
>
<NotebookMenuSwitcher v-if="notebookEnabled"
:domain-object="domainObject"
:object-path="objectPath"
class="c-notebook-snapshot-menubutton"
/>
<div v-if="statusBarItems.length > 0"
class="c-so-view__frame-controls__btns"
>
Expand All @@ -80,7 +85,7 @@

<object-view
ref="objectView"
class="c-so-view__object-view js-object-view"
class="c-so-view__object-view js-object-view js-notebook-snapshot-item"
:show-edit-view="showEditView"
:object-path="objectPath"
:layout-font-size="layoutFontSize"
Expand All @@ -92,6 +97,7 @@

<script>
import ObjectView from './ObjectView.vue';
import NotebookMenuSwitcher from '@/plugins/notebook/components/NotebookMenuSwitcher.vue';
const SIMPLE_CONTENT_TYPES = [
'clock',
Expand All @@ -103,7 +109,8 @@ const SIMPLE_CONTENT_TYPES = [
export default {
components: {
ObjectView
ObjectView,
NotebookMenuSwitcher
},
inject: ['openmct'],
props: {
Expand Down Expand Up @@ -139,6 +146,7 @@ export default {
return {
cssClass,
complexContent,
notebookEnabled: this.openmct.types.get('notebook'),
statusBarItems: [],
status: ''
};
Expand Down
2 changes: 1 addition & 1 deletion src/ui/layout/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
/>
<object-view
ref="browseObject"
class="l-shell__main-container js-main-container"
class="l-shell__main-container js-main-container js-notebook-snapshot-item"
data-selectable
:show-edit-view="true"
@change-action-collection="setActionCollection"
Expand Down
2 changes: 1 addition & 1 deletion src/ui/preview/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
:domain-object="domainObject"
:views="views"
/>
<div class="l-preview-window__object-view">
<div class="l-preview-window__object-view js-notebook-snapshot-item">
<div ref="objectView"></div>
</div>
</div>
Expand Down

0 comments on commit 12818fb

Please sign in to comment.