From 9d2991ee102921d187c1a771137ef2e155e378be Mon Sep 17 00:00:00 2001 From: Deep Tailor Date: Fri, 26 Jun 2020 17:34:36 -0700 Subject: [PATCH 01/11] [Snapshots] Add download as PNG and JPG buttons (#3123) * working export * fix lint errors --- .../components/ConditionDescription.vue | 8 +++---- .../notebook/components/notebook-embed.vue | 19 ++++++++++++---- .../components/snapshot-template.html | 22 +++++++++++++++++-- 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/src/plugins/condition/components/ConditionDescription.vue b/src/plugins/condition/components/ConditionDescription.vue index c7cc42ae0e..5f7ecefe74 100644 --- a/src/plugins/condition/components/ConditionDescription.vue +++ b/src/plugins/condition/components/ConditionDescription.vue @@ -27,13 +27,13 @@ > {{ condition.configuration.name }} - {{ description }} - Match if no other condition is matched diff --git a/src/plugins/notebook/components/notebook-embed.vue b/src/plugins/notebook/components/notebook-embed.vue index 92a590888f..27efdf4ba7 100644 --- a/src/plugins/notebook/components/notebook-embed.vue +++ b/src/plugins/notebook/components/notebook-embed.vue @@ -60,6 +60,7 @@ export default { }, mounted() { this.addPopupMenuItems(); + this.exportImageService = this.openmct.$injector.get('exportImageService'); }, methods: { addPopupMenuItems() { @@ -205,7 +206,7 @@ export default { }, openSnapshot() { const self = this; - const snapshot = new Vue({ + this.snapshot = new Vue({ data: () => { return { embed: self.embed @@ -213,14 +214,15 @@ export default { }, methods: { formatTime: self.formatTime, - annotateSnapshot: self.annotateSnapshot + annotateSnapshot: self.annotateSnapshot, + exportImage: self.exportImage }, template: SnapshotTemplate }); const snapshotOverlay = this.openmct.overlays.overlay({ - element: snapshot.$mount().$el, - onDestroy: () => { snapshot.$destroy(true) }, + element: this.snapshot.$mount().$el, + onDestroy: () => { this.snapshot.$destroy(true) }, size: 'large', dismissable: true, 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() { const self = this; const previewAction = new PreviewAction(self.openmct); diff --git a/src/plugins/notebook/components/snapshot-template.html b/src/plugins/notebook/components/snapshot-template.html index 5fdf3f09fc..0e1134309a 100644 --- a/src/plugins/notebook/components/snapshot-template.html +++ b/src/plugins/notebook/components/snapshot-template.html @@ -15,14 +15,32 @@
SNAPSHOT {{formatTime(embed.createdOn, 'YYYY-MM-DD HH:mm:ss')}}
+ + + + Annotate -
From 6ab468086a39e4fa7b1e86b9cc24668e31c9e3e8 Mon Sep 17 00:00:00 2001 From: Deep Tailor Date: Mon, 29 Jun 2020 13:14:42 -0700 Subject: [PATCH 02/11] Lock views and prevent editing (#3094) * working lock and unlock * prevent flexible layout drop hints from showing * fix lint issue * wip * disable mousedown when not editing in DisplayLayout * continued wip * Cherrypick new glyphs from add-new-glyphs-062320 * More new glyphs, updated art - New glyphs: icon-unlocked and icon-target; - Updated art for icon-lock glyph; * Edit toggle refinements WIP - Markup, CSS in BrowseBar.vue; * More new glyphs, updated art - New glyphs: icon-unlocked and icon-target; - Updated art for icon-lock glyph; * Edit toggle refinements - Replaced toggle switch with button; * prevent styling changes when locked * fix lint issues * fix tests * make reviewer suggested changes Co-authored-by: charlesh88 --- .../edit/src/actions/PropertiesAction.js | 5 + .../entanglement/src/actions/MoveAction.js | 13 +- .../src/actions/ImportAsJSONAction.js | 10 +- .../components/inspector/StylesView.vue | 21 +- .../displayLayout/DisplayLayoutToolbar.js | 2 +- .../displayLayout/components/BoxView.vue | 7 +- .../components/DisplayLayout.vue | 18 +- .../displayLayout/components/ImageView.vue | 7 +- .../displayLayout/components/LayoutFrame.vue | 6 +- .../components/SubobjectView.vue | 5 + .../components/TelemetryView.vue | 5 + .../displayLayout/components/TextView.vue | 7 +- .../components/display-layout.scss | 3 +- src/plugins/displayLayout/plugin.js | 8 +- .../flexibleLayout/components/container.vue | 13 + .../components/flexibleLayout.vue | 4 +- .../flexibleLayout/components/frame.vue | 10 +- .../flexibleLayoutViewProvider.js | 3 +- src/plugins/flexibleLayout/toolbarProvider.js | 10 + .../plot/res/templates/plot-options.html | 4 +- src/plugins/remove/RemoveAction.js | 6 + src/styles/_constants.scss | 5 + src/styles/_glyphs.scss | 5 + src/styles/fonts/Open MCT Symbols 16px.json | 1120 +++++++++++++---- src/styles/fonts/Open-MCT-Symbols-16px.svg | 7 +- src/styles/fonts/Open-MCT-Symbols-16px.ttf | Bin 21428 -> 22416 bytes src/styles/fonts/Open-MCT-Symbols-16px.woff | Bin 21504 -> 22492 bytes src/ui/components/ObjectView.vue | 23 +- src/ui/components/toggle-switch.scss | 1 - src/ui/inspector/Inspector.vue | 1 - src/ui/layout/BrowseBar.vue | 22 +- src/ui/layout/layout.scss | 2 +- 32 files changed, 1086 insertions(+), 267 deletions(-) diff --git a/platform/commonUI/edit/src/actions/PropertiesAction.js b/platform/commonUI/edit/src/actions/PropertiesAction.js index a9dfae8bca..b9c9021378 100644 --- a/platform/commonUI/edit/src/actions/PropertiesAction.js +++ b/platform/commonUI/edit/src/actions/PropertiesAction.js @@ -81,10 +81,15 @@ define( * context. */ PropertiesAction.appliesTo = function (context) { + var domainObject = (context || {}).domainObject, type = domainObject && domainObject.getCapability('type'), creatable = type && type.hasFeature('creation'); + if (domainObject && domainObject.model && domainObject.model.locked) { + return false; + } + // Only allow creatable types to be edited return domainObject && creatable; }; diff --git a/platform/entanglement/src/actions/MoveAction.js b/platform/entanglement/src/actions/MoveAction.js index 35432bbf17..69c02e12f2 100644 --- a/platform/entanglement/src/actions/MoveAction.js +++ b/platform/entanglement/src/actions/MoveAction.js @@ -40,7 +40,18 @@ define( } MoveAction.prototype = Object.create(AbstractComposeAction.prototype); - MoveAction.appliesTo = AbstractComposeAction.appliesTo; + + MoveAction.appliesTo = function (context) { + var applicableObject = + context.selectedObject || context.domainObject; + + if (applicableObject && applicableObject.model.locked) { + return false; + } + + return Boolean(applicableObject && + applicableObject.hasCapability('context')); + }; return MoveAction; } diff --git a/platform/import-export/src/actions/ImportAsJSONAction.js b/platform/import-export/src/actions/ImportAsJSONAction.js index 40dd338e15..a4598cd17a 100644 --- a/platform/import-export/src/actions/ImportAsJSONAction.js +++ b/platform/import-export/src/actions/ImportAsJSONAction.js @@ -216,8 +216,14 @@ define(['zepto', 'objectUtils'], function ($, objectUtils) { }; ImportAsJSONAction.appliesTo = function (context) { - return context.domainObject !== undefined && - context.domainObject.hasCapability("composition"); + let domainObject = context.domainObject; + + if (domainObject && domainObject.model.locked) { + return false; + } + + return domainObject !== undefined && + domainObject.hasCapability("composition"); }; return ImportAsJSONAction; diff --git a/src/plugins/condition/components/inspector/StylesView.vue b/src/plugins/condition/components/inspector/StylesView.vue index 07d9551d84..35cb7ad169 100644 --- a/src/plugins/condition/components/inspector/StylesView.vue +++ b/src/plugins/condition/components/inspector/StylesView.vue @@ -37,12 +37,13 @@ >