mirror of
https://github.com/nasa/openmct.git
synced 2025-06-19 07:38:15 +00:00
[Snapshots] Add download as PNG and JPG buttons (#3123)
* working export * fix lint errors
This commit is contained in:
@ -27,13 +27,13 @@
|
|||||||
>
|
>
|
||||||
{{ condition.configuration.name }}
|
{{ condition.configuration.name }}
|
||||||
</span>
|
</span>
|
||||||
<span class="c-style__condition-desc__text"
|
<span v-if="!condition.isDefault"
|
||||||
v-if="!condition.isDefault"
|
class="c-style__condition-desc__text"
|
||||||
>
|
>
|
||||||
{{ description }}
|
{{ description }}
|
||||||
</span>
|
</span>
|
||||||
<span class="c-style__condition-desc__text"
|
<span v-else
|
||||||
v-else
|
class="c-style__condition-desc__text"
|
||||||
>
|
>
|
||||||
Match if no other condition is matched
|
Match if no other condition is matched
|
||||||
</span>
|
</span>
|
||||||
|
@ -60,6 +60,7 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.addPopupMenuItems();
|
this.addPopupMenuItems();
|
||||||
|
this.exportImageService = this.openmct.$injector.get('exportImageService');
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
addPopupMenuItems() {
|
addPopupMenuItems() {
|
||||||
@ -205,7 +206,7 @@ export default {
|
|||||||
},
|
},
|
||||||
openSnapshot() {
|
openSnapshot() {
|
||||||
const self = this;
|
const self = this;
|
||||||
const snapshot = new Vue({
|
this.snapshot = new Vue({
|
||||||
data: () => {
|
data: () => {
|
||||||
return {
|
return {
|
||||||
embed: self.embed
|
embed: self.embed
|
||||||
@ -213,14 +214,15 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
formatTime: self.formatTime,
|
formatTime: self.formatTime,
|
||||||
annotateSnapshot: self.annotateSnapshot
|
annotateSnapshot: self.annotateSnapshot,
|
||||||
|
exportImage: self.exportImage
|
||||||
},
|
},
|
||||||
template: SnapshotTemplate
|
template: SnapshotTemplate
|
||||||
});
|
});
|
||||||
|
|
||||||
const snapshotOverlay = this.openmct.overlays.overlay({
|
const snapshotOverlay = this.openmct.overlays.overlay({
|
||||||
element: snapshot.$mount().$el,
|
element: this.snapshot.$mount().$el,
|
||||||
onDestroy: () => { snapshot.$destroy(true) },
|
onDestroy: () => { this.snapshot.$destroy(true) },
|
||||||
size: 'large',
|
size: 'large',
|
||||||
dismissable: true,
|
dismissable: true,
|
||||||
buttons: [
|
buttons: [
|
||||||
@ -234,6 +236,15 @@ export default {
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
exportImage(type) {
|
||||||
|
let element = this.snapshot.$refs['snapshot-image'];
|
||||||
|
|
||||||
|
if (type === 'png') {
|
||||||
|
this.exportImageService.exportPNG(element, this.embed.name);
|
||||||
|
} else {
|
||||||
|
this.exportImageService.exportJPG(element, this.embed.name);
|
||||||
|
}
|
||||||
|
},
|
||||||
previewEmbed() {
|
previewEmbed() {
|
||||||
const self = this;
|
const self = this;
|
||||||
const previewAction = new PreviewAction(self.openmct);
|
const previewAction = new PreviewAction(self.openmct);
|
||||||
|
@ -15,14 +15,32 @@
|
|||||||
<div class="l-browse-bar__snapshot-datetime">
|
<div class="l-browse-bar__snapshot-datetime">
|
||||||
SNAPSHOT {{formatTime(embed.createdOn, 'YYYY-MM-DD HH:mm:ss')}}
|
SNAPSHOT {{formatTime(embed.createdOn, 'YYYY-MM-DD HH:mm:ss')}}
|
||||||
</div>
|
</div>
|
||||||
|
<span class="c-button-set c-button-set--strip-h">
|
||||||
|
<button
|
||||||
|
class="c-button icon-download"
|
||||||
|
title="Export This View's Data as PNG"
|
||||||
|
@click="exportImage('png')"
|
||||||
|
>
|
||||||
|
<span class="c-button__label">PNG</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="c-button"
|
||||||
|
title="Export This View's Data as JPG"
|
||||||
|
@click="exportImage('jpg')"
|
||||||
|
>
|
||||||
|
<span class="c-button__label">JPG</span>
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
<a class="l-browse-bar__annotate-button c-button icon-pencil" title="Annotate" @click="annotateSnapshot">
|
<a class="l-browse-bar__annotate-button c-button icon-pencil" title="Annotate" @click="annotateSnapshot">
|
||||||
<span class="title-label">Annotate</span>
|
<span class="title-label">Annotate</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="c-notebook-snapshot__image"
|
<div
|
||||||
:style="{ backgroundImage: 'url(' + embed.snapshot.src + ')' }"
|
ref="snapshot-image"
|
||||||
|
class="c-notebook-snapshot__image"
|
||||||
|
:style="{ backgroundImage: 'url(' + embed.snapshot.src + ')' }"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user