diff --git a/src/MCT.js b/src/MCT.js index 48768a7d19..56c7d5cad4 100644 --- a/src/MCT.js +++ b/src/MCT.js @@ -43,6 +43,7 @@ define([ './ui/layout/Layout.vue', '../platform/core/src/objects/DomainObjectImpl', '../platform/core/src/capabilities/ContextualDomainObject', + './ui/preview/plugin', 'vue' ], function ( EventEmitter, @@ -67,6 +68,7 @@ define([ Layout, DomainObjectImpl, ContextualDomainObject, + PreviewPlugin, Vue ) { /** @@ -230,7 +232,7 @@ define([ this.install(this.plugins.Plot()); this.install(this.plugins.TelemetryTable()); this.install(this.plugins.DisplayLayout()); - this.install(this.plugins.Preview()); + this.install(PreviewPlugin.default()); if (typeof BUILD_CONSTANTS !== 'undefined') { this.install(buildInfoPlugin(BUILD_CONSTANTS)); diff --git a/src/plugins/plugins.js b/src/plugins/plugins.js index e1e0d1e7da..93d1a03f22 100644 --- a/src/plugins/plugins.js +++ b/src/plugins/plugins.js @@ -40,8 +40,7 @@ define([ './flexibleLayout/plugin', './tabs/plugin', '../../platform/features/fixed/plugin', - './LADTable/plugin', - './preview/plugin' + './LADTable/plugin' ], function ( _, UTCTimeSystem, @@ -62,8 +61,7 @@ define([ FlexibleLayout, Tabs, FixedView, - LADTable, - PreviewPlugin + LADTable ) { var bundleMap = { LocalStorage: 'platform/persistence/local', @@ -179,7 +177,6 @@ define([ plugins.FixedView = FixedView; plugins.FlexibleLayout = FlexibleLayout; plugins.LADTable = LADTable; - plugins.Preview = PreviewPlugin.default; return plugins; }); diff --git a/src/ui/components/ObjectLabel.vue b/src/ui/components/ObjectLabel.vue index 289880862c..bc6ed4ecc5 100644 --- a/src/ui/components/ObjectLabel.vue +++ b/src/ui/components/ObjectLabel.vue @@ -2,6 +2,7 @@
@@ -13,12 +14,19 @@ import ObjectLink from '../mixins/object-link'; import ContextMenuGesture from '../mixins/context-menu-gesture'; +import PreviewAction from '../preview/PreviewAction.js'; export default { mixins: [ObjectLink, ContextMenuGesture], inject: ['openmct'], props: { - domainObject: Object + domainObject: Object, + objectPath: { + type: Array, + default() { + return []; + } + } }, data() { return { @@ -32,6 +40,7 @@ export default { }); this.$once('hook:destroyed', removeListener); } + this.previewAction = new PreviewAction(this.openmct); }, computed: { typeClass() { @@ -43,6 +52,17 @@ export default { } }, methods: { + navigateOrPreview(event) { + if (this.openmct.editor.isEditing()){ + event.preventDefault(); + this.preview(); + } + }, + preview() { + if (this.previewAction.appliesTo(this.objectPath)){ + this.previewAction.invoke(this.objectPath); + } + }, dragStart(event) { let navigatedObject = this.openmct.router.path[0]; let serializedObject = JSON.stringify(this.observedObject); diff --git a/src/ui/layout/mct-tree.vue b/src/ui/layout/mct-tree.vue index 8d2ce073ae..026cef1fb8 100644 --- a/src/ui/layout/mct-tree.vue +++ b/src/ui/layout/mct-tree.vue @@ -47,7 +47,7 @@ } } - &.is-selected { + &.is-navigated-object { background: $colorItemTreeSelectedBg; .c-tree__item__type-icon:before { color: $colorItemTreeIconHover; diff --git a/src/ui/layout/tree-item.vue b/src/ui/layout/tree-item.vue index 51c08cd27a..bb0f94d685 100644 --- a/src/ui/layout/tree-item.vue +++ b/src/ui/layout/tree-item.vue @@ -1,7 +1,7 @@