Store telemetry styles on their container domain objects.
This commit is contained in:
@@ -27,7 +27,6 @@
|
||||
<script>
|
||||
import ConditionalStylesView from '../../plugins/condition/components/inspector/ConditionalStylesView.vue';
|
||||
import Vue from 'vue';
|
||||
import { getStyleProp } from "../../plugins/condition/utils/styleUtils";
|
||||
|
||||
export default {
|
||||
inject: ['openmct'],
|
||||
@@ -44,35 +43,8 @@ export default {
|
||||
this.openmct.selection.off('change', this.updateSelection);
|
||||
},
|
||||
methods: {
|
||||
getStyleProperties(item) {
|
||||
let styleProps = {};
|
||||
Object.keys(item).forEach((key) => {
|
||||
Object.assign(styleProps, getStyleProp(key, item[key]));
|
||||
});
|
||||
return styleProps;
|
||||
},
|
||||
updateSelection(selection) {
|
||||
if (selection.length > 0 && selection[0].length > 0) {
|
||||
let isChildItem = false;
|
||||
let domainObject = selection[0][0].context.item;
|
||||
let layoutItem = {};
|
||||
let styleProps = this.getStyleProperties({
|
||||
fill: 'transparent',
|
||||
stroke: 'transparent',
|
||||
color: 'transparent'
|
||||
});
|
||||
if (selection[0].length > 1) {
|
||||
isChildItem = true;
|
||||
//If there are more than 1 items in the selection[0] list, the first one could either be a sub domain object OR a layout drawing control.
|
||||
//The second item in the selection[0] list is the container object (usually a layout)
|
||||
if (!domainObject) {
|
||||
styleProps = {};
|
||||
layoutItem = selection[0][0].context.layoutItem;
|
||||
styleProps = this.getStyleProperties(layoutItem);
|
||||
domainObject = selection[0][1].context.item;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.component) {
|
||||
this.component.$destroy();
|
||||
this.component = undefined;
|
||||
@@ -83,7 +55,7 @@ export default {
|
||||
this.component = new Vue({
|
||||
provide: {
|
||||
openmct: this.openmct,
|
||||
domainObject: domainObject
|
||||
selection: selection
|
||||
},
|
||||
el: viewContainer,
|
||||
components: {
|
||||
@@ -91,12 +63,12 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
layoutItem,
|
||||
styleProps,
|
||||
isChildItem
|
||||
// layoutItem,
|
||||
// styleProps,
|
||||
// isChildItem
|
||||
}
|
||||
},
|
||||
template: '<conditional-styles-view :can-hide="isChildItem" :item-id="layoutItem.id" :initial-styles="styleProps"></conditional-styles-view>'
|
||||
template: '<conditional-styles-view></conditional-styles-view>'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user