From 666bb416978cf5b50f3597d7d7c0ed773a8cc7c6 Mon Sep 17 00:00:00 2001 From: Pegah Sarram Date: Fri, 1 Feb 2019 17:40:30 -0800 Subject: [PATCH] [Selection] support getting object view's selection context (#2272) * Get selection context from object view for constructing the context in subobject view. * Implement getSelectionContext for flexible layout provider and remove code that makes flexible layout self selectable. * Get selection context from object frame when constructing context for frames. * Disable Add button when selected parent is a flexible layout * Make 'Add' button working for selected display layouts in a flexible layout. * fix expand error and fix flexible layout toggle container issue * Check for parent object before getting composition. --- .../components/SubobjectView.vue | 19 +++++++++++-------- .../flexibleLayout/components/frame.vue | 19 ++++++++++--------- src/plugins/flexibleLayout/toolbarProvider.js | 4 +++- src/ui/components/ObjectFrame.vue | 11 +++++++---- src/ui/components/ObjectView.vue | 19 +++++++++++++------ src/ui/inspector/Inspector.vue | 2 +- 6 files changed, 45 insertions(+), 29 deletions(-) diff --git a/src/plugins/displayLayout/components/SubobjectView.vue b/src/plugins/displayLayout/components/SubobjectView.vue index 17e42ff0ec..cc1c838d5a 100644 --- a/src/plugins/displayLayout/components/SubobjectView.vue +++ b/src/plugins/displayLayout/components/SubobjectView.vue @@ -26,7 +26,8 @@ + :has-frame="item.hasFrame" + ref="objectFrame"> @@ -98,13 +99,15 @@ setObject(domainObject) { this.domainObject = domainObject; this.objectPath = [this.domainObject].concat(this.openmct.router.path); - this.context = { - item: domainObject, - layoutItem: this.item, - index: this.index - }; - this.removeSelectable = this.openmct.selection.selectable( - this.$el, this.context, this.initSelect); + this.$nextTick(function () { + let childContext = this.$refs.objectFrame.getSelectionContext(); + childContext.item = domainObject; + childContext.layoutItem = this.item; + childContext.index = this.index; + this.context = childContext; + this.removeSelectable = this.openmct.selection.selectable( + this.$el, this.context, this.initSelect); + }); } }, mounted() { diff --git a/src/plugins/flexibleLayout/components/frame.vue b/src/plugins/flexibleLayout/components/frame.vue index 77286d4c00..308b894c3d 100644 --- a/src/plugins/flexibleLayout/components/frame.vue +++ b/src/plugins/flexibleLayout/components/frame.vue @@ -35,7 +35,8 @@ v-if="domainObject" :domain-object="domainObject" :object-path="objectPath" - :has-frame="hasFrame"> + :has-frame="hasFrame" + ref="objectFrame">