[Notebook] Create Snapshot directly from any frame in a layout #3300 (#4099)

This commit is contained in:
Nikhil
2021-08-23 14:03:49 -07:00
committed by GitHub
parent d5e32ec494
commit 4b9ff67e49
5 changed files with 20 additions and 11 deletions

View File

@ -12,7 +12,7 @@
></button> ></button>
<div <div
ref="element" ref="element"
class="c-overlay__contents" class="c-overlay__contents js-notebook-snapshot-item-wrapper"
tabindex="0" tabindex="0"
></div> ></div>
<div <div

View File

@ -81,7 +81,7 @@ export default {
cssClass: 'icon-notebook', cssClass: 'icon-notebook',
name: `Save to Notebook ${defaultPath}`, name: `Save to Notebook ${defaultPath}`,
onItemClicked: () => { onItemClicked: () => {
return this.snapshot(NOTEBOOK_DEFAULT); return this.snapshot(NOTEBOOK_DEFAULT, event.target);
} }
}); });
} }
@ -91,16 +91,17 @@ export default {
cssClass: 'icon-camera', cssClass: 'icon-camera',
name: 'Save to Notebook Snapshots', name: 'Save to Notebook Snapshots',
onItemClicked: () => { onItemClicked: () => {
return this.snapshot(NOTEBOOK_SNAPSHOT); return this.snapshot(NOTEBOOK_SNAPSHOT, event.target);
} }
}); });
this.openmct.menus.showMenu(x, y, notebookTypes); this.openmct.menus.showMenu(x, y, notebookTypes);
}, },
snapshot(notebookType) { snapshot(notebookType, target) {
this.$nextTick(() => { this.$nextTick(() => {
const element = document.querySelector('.c-overlay__contents') const wrapper = target && target.closest('.js-notebook-snapshot-item-wrapper')
|| document.getElementsByClassName('l-shell__main-container')[0]; || document;
const element = wrapper.querySelector('.js-notebook-snapshot-item');
const bounds = this.openmct.time.bounds(); const bounds = this.openmct.time.bounds();
const link = !this.ignoreLink const link = !this.ignoreLink

View File

@ -21,7 +21,7 @@
*****************************************************************************/ *****************************************************************************/
<template> <template>
<div <div
class="c-so-view" class="c-so-view js-notebook-snapshot-item-wrapper"
:class="[ :class="[
statusClass, statusClass,
'c-so-view--' + domainObject.type, 'c-so-view--' + domainObject.type,
@ -56,6 +56,11 @@
'has-complex-content': complexContent '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" <div v-if="statusBarItems.length > 0"
class="c-so-view__frame-controls__btns" class="c-so-view__frame-controls__btns"
> >
@ -80,7 +85,7 @@
<object-view <object-view
ref="objectView" 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" :show-edit-view="showEditView"
:object-path="objectPath" :object-path="objectPath"
:layout-font-size="layoutFontSize" :layout-font-size="layoutFontSize"
@ -92,6 +97,7 @@
<script> <script>
import ObjectView from './ObjectView.vue'; import ObjectView from './ObjectView.vue';
import NotebookMenuSwitcher from '@/plugins/notebook/components/NotebookMenuSwitcher.vue';
const SIMPLE_CONTENT_TYPES = [ const SIMPLE_CONTENT_TYPES = [
'clock', 'clock',
@ -103,7 +109,8 @@ const SIMPLE_CONTENT_TYPES = [
export default { export default {
components: { components: {
ObjectView ObjectView,
NotebookMenuSwitcher
}, },
inject: ['openmct'], inject: ['openmct'],
props: { props: {
@ -139,6 +146,7 @@ export default {
return { return {
cssClass, cssClass,
complexContent, complexContent,
notebookEnabled: this.openmct.types.get('notebook'),
statusBarItems: [], statusBarItems: [],
status: '' status: ''
}; };

View File

@ -90,7 +90,7 @@
/> />
<object-view <object-view
ref="browseObject" ref="browseObject"
class="l-shell__main-container js-main-container" class="l-shell__main-container js-main-container js-notebook-snapshot-item"
data-selectable data-selectable
:show-edit-view="true" :show-edit-view="true"
@change-action-collection="setActionCollection" @change-action-collection="setActionCollection"

View File

@ -27,7 +27,7 @@
:domain-object="domainObject" :domain-object="domainObject"
:views="views" :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 ref="objectView"></div>
</div> </div>
</div> </div>