mirror of
https://github.com/nasa/openmct.git
synced 2025-02-18 16:40:58 +00:00
Reorganize components, create ObjectFrame
This commit is contained in:
parent
18a94d938f
commit
afa1589cb5
@ -40,7 +40,7 @@ define([
|
|||||||
'../platform/framework/src/Main',
|
'../platform/framework/src/Main',
|
||||||
'./styles-new/core.scss',
|
'./styles-new/core.scss',
|
||||||
'./styles-new/notebook.scss',
|
'./styles-new/notebook.scss',
|
||||||
'./ui/components/layout/Layout.vue',
|
'./ui/layout/Layout.vue',
|
||||||
'../platform/core/src/objects/DomainObjectImpl',
|
'../platform/core/src/objects/DomainObjectImpl',
|
||||||
'../platform/core/src/capabilities/ContextualDomainObject',
|
'../platform/core/src/capabilities/ContextualDomainObject',
|
||||||
'vue'
|
'vue'
|
||||||
|
@ -24,90 +24,16 @@
|
|||||||
:grid-size="gridSize"
|
:grid-size="gridSize"
|
||||||
@endDrag="(item, updates) => $emit('endDrag', item, updates)"
|
@endDrag="(item, updates) => $emit('endDrag', item, updates)"
|
||||||
@drilledIn="item => $emit('drilledIn', item)">
|
@drilledIn="item => $emit('drilledIn', item)">
|
||||||
<div class="u-contents">
|
<object-frame v-if="domainObject"
|
||||||
<div class="c-so-view__header">
|
:domain-object="domainObject"
|
||||||
<div class="c-so-view__header__start">
|
:object-path="objectPath"
|
||||||
<div class="c-so-view__header__name"
|
:has-frame="item.hasFrame">
|
||||||
:class="cssClass">
|
</object-frame>
|
||||||
{{ domainObject && domainObject.name }}
|
|
||||||
</div>
|
|
||||||
<context-menu-drop-down
|
|
||||||
:object-path="objectPath">
|
|
||||||
</context-menu-drop-down>
|
|
||||||
</div>
|
|
||||||
<div class="c-so-view__header__end">
|
|
||||||
<div class="c-button icon-expand local-controls--hidden"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<object-view class="c-so-view__object-view"
|
|
||||||
:object="domainObject"></object-view>
|
|
||||||
</div>
|
|
||||||
</layout-frame>
|
</layout-frame>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
@import "~styles/sass-base";
|
|
||||||
|
|
||||||
.c-so-view {
|
|
||||||
/*************************** HEADER */
|
|
||||||
&__header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
&__start,
|
|
||||||
&__end {
|
|
||||||
display: flex;
|
|
||||||
flex: 1 1 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__end {
|
|
||||||
justify-content: flex-end;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__name {
|
|
||||||
@include headerFont(1em);
|
|
||||||
display: flex;
|
|
||||||
&:before {
|
|
||||||
margin-right: $interiorMarginSm;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.no-frame & {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&__name {
|
|
||||||
@include ellipsize();
|
|
||||||
@include headerFont(1.2em);
|
|
||||||
flex: 0 1 auto;
|
|
||||||
|
|
||||||
&:before {
|
|
||||||
// Object type icon
|
|
||||||
flex: 0 0 auto;
|
|
||||||
margin-right: $interiorMarginSm;
|
|
||||||
opacity: 0.5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*************************** OBJECT VIEW */
|
|
||||||
&__object-view {
|
|
||||||
flex: 1 1 auto;
|
|
||||||
overflow: auto;
|
|
||||||
|
|
||||||
.c-object-view {
|
|
||||||
.u-fills-container {
|
|
||||||
// Expand component types that fill a container
|
|
||||||
@include abs();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ObjectView from '../../../ui/components/layout/ObjectView.vue'
|
import ObjectFrame from '../../../ui/components/ObjectFrame.vue'
|
||||||
import ContextMenuDropDown from '../../../ui/components/controls/contextMenuDropDown.vue';
|
|
||||||
import LayoutFrame from './LayoutFrame.vue'
|
import LayoutFrame from './LayoutFrame.vue'
|
||||||
|
|
||||||
const MINIMUM_FRAME_SIZE = [320, 180],
|
const MINIMUM_FRAME_SIZE = [320, 180],
|
||||||
@ -152,20 +78,17 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
domainObject: undefined,
|
domainObject: undefined,
|
||||||
cssClass: undefined,
|
|
||||||
objectPath: []
|
objectPath: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
ObjectView,
|
ObjectFrame,
|
||||||
ContextMenuDropDown,
|
|
||||||
LayoutFrame
|
LayoutFrame
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setObject(domainObject) {
|
setObject(domainObject) {
|
||||||
this.domainObject = domainObject;
|
this.domainObject = domainObject;
|
||||||
this.objectPath = [this.domainObject].concat(this.openmct.router.path);
|
this.objectPath = [this.domainObject].concat(this.openmct.router.path);
|
||||||
this.cssClass = this.openmct.types.get(this.domainObject.type).definition.cssClass;
|
|
||||||
let context = {
|
let context = {
|
||||||
item: domainObject,
|
item: domainObject,
|
||||||
layoutItem: this.item,
|
layoutItem: this.item,
|
||||||
@ -176,6 +99,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
console.log(this.item);
|
||||||
this.openmct.objects.get(this.item.identifier)
|
this.openmct.objects.get(this.item.identifier)
|
||||||
.then(this.setObject);
|
.then(this.setObject);
|
||||||
},
|
},
|
||||||
|
@ -27,15 +27,16 @@
|
|||||||
}">
|
}">
|
||||||
|
|
||||||
<div class="c-frame c-fl-frame__drag-wrapper is-selectable is-moveable"
|
<div class="c-frame c-fl-frame__drag-wrapper is-selectable is-moveable"
|
||||||
:class="{'no-frame': noFrame}"
|
|
||||||
draggable="true"
|
draggable="true"
|
||||||
@dragstart="initDrag"
|
@dragstart="initDrag"
|
||||||
ref="frame">
|
ref="frame">
|
||||||
|
|
||||||
<subobject-view
|
<object-frame
|
||||||
v-if="item.domainObject.identifier"
|
v-if="domainObject"
|
||||||
:item="item">
|
:domain-object="domainObject"
|
||||||
</subobject-view>
|
:object-path="objectPath"
|
||||||
|
:has-frame="hasFrame">
|
||||||
|
</object-frame>
|
||||||
|
|
||||||
<div class="c-fl-frame__size-indicator"
|
<div class="c-fl-frame__size-indicator"
|
||||||
v-if="isEditing"
|
v-if="isEditing"
|
||||||
@ -48,7 +49,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ResizeHandle from './resizeHandle.vue';
|
import ResizeHandle from './resizeHandle.vue';
|
||||||
import SubobjectView from '../../displayLayout/components/SubobjectView.vue';
|
import ObjectFrame from '../../../ui/components/ObjectFrame.vue';
|
||||||
import isEditingMixin from '../mixins/isEditing';
|
import isEditingMixin from '../mixins/isEditing';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -57,26 +58,29 @@ export default {
|
|||||||
mixins: [isEditingMixin],
|
mixins: [isEditingMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
item: {domainObject: {}}
|
domainObject: undefined,
|
||||||
|
objectPath: undefined
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
ResizeHandle,
|
ResizeHandle,
|
||||||
SubobjectView
|
ObjectFrame
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
noFrame() {
|
hasFrame() {
|
||||||
return this.frame.noFrame;
|
return !this.frame.noFrame;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setDomainObject(object) {
|
setDomainObject(object) {
|
||||||
this.item.domainObject = object;
|
console.log('setting object!');
|
||||||
|
this.domainObject = object;
|
||||||
|
this.objectPath = [object];
|
||||||
this.setSelection();
|
this.setSelection();
|
||||||
},
|
},
|
||||||
setSelection() {
|
setSelection() {
|
||||||
let context = {
|
let context = {
|
||||||
item: this.item.domainObject,
|
item: this.domainObject,
|
||||||
addContainer: this.addContainer,
|
addContainer: this.addContainer,
|
||||||
type: 'frame',
|
type: 'frame',
|
||||||
frameId: this.frame.id
|
frameId: this.frame.id
|
||||||
|
5
src/ui/components/COMPONENTS.md
Normal file
5
src/ui/components/COMPONENTS.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Components
|
||||||
|
|
||||||
|
Components in this folder are intended for reuse in other parts of the
|
||||||
|
application. In order for components to be reused, they must not depend on
|
||||||
|
parent styling, and they should have minimum internal state.
|
134
src/ui/components/ObjectFrame.vue
Normal file
134
src/ui/components/ObjectFrame.vue
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
<template>
|
||||||
|
<div class="u-contents c-so-view"
|
||||||
|
:class="{
|
||||||
|
'c-so-view--no-frame': !hasFrame
|
||||||
|
}">
|
||||||
|
<div class="c-so-view__header">
|
||||||
|
<div class="c-so-view__header__start">
|
||||||
|
<div class="c-so-view__header__name"
|
||||||
|
:class="cssClass">
|
||||||
|
{{ domainObject && domainObject.name }}
|
||||||
|
</div>
|
||||||
|
<context-menu-drop-down
|
||||||
|
:object-path="objectPath">
|
||||||
|
</context-menu-drop-down>
|
||||||
|
</div>
|
||||||
|
<div class="c-so-view__header__end">
|
||||||
|
<div class="c-button icon-expand local-controls--hidden"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<object-view class="c-so-view__object-view"
|
||||||
|
:object="domainObject"></object-view>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
@import "~styles/sass-base";
|
||||||
|
|
||||||
|
.c-so-view {
|
||||||
|
/*************************** HEADER */
|
||||||
|
&__header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
&__start,
|
||||||
|
&__end {
|
||||||
|
display: flex;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__end {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__name {
|
||||||
|
@include headerFont(1em);
|
||||||
|
display: flex;
|
||||||
|
&:before {
|
||||||
|
margin-right: $interiorMarginSm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&--no-frame .c-so-view__header {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__name {
|
||||||
|
@include ellipsize();
|
||||||
|
@include headerFont(1.2em);
|
||||||
|
flex: 0 1 auto;
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
// Object type icon
|
||||||
|
flex: 0 0 auto;
|
||||||
|
margin-right: $interiorMarginSm;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************** OBJECT VIEW */
|
||||||
|
&__object-view {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
|
.c-object-view {
|
||||||
|
.u-fills-container {
|
||||||
|
// Expand component types that fill a container
|
||||||
|
@include abs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import ObjectView from './ObjectView.vue'
|
||||||
|
import ContextMenuDropDown from './contextMenuDropDown.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
inject: ['openmct'],
|
||||||
|
props: {
|
||||||
|
domainObject: Object,
|
||||||
|
objectPath: Array,
|
||||||
|
hasFrame: Boolean,
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
cssClass() {
|
||||||
|
if (!this.domainObject || !this.domainObject.type) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let objectType = this.openmct.types.get(this.domainObject.type);
|
||||||
|
if (!objectType || !objectType.definition) {
|
||||||
|
return; // TODO: return unknown icon type.
|
||||||
|
}
|
||||||
|
return objectType.definition.cssClass;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
ObjectView,
|
||||||
|
ContextMenuDropDown,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -16,7 +16,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li class="js-last-place" @drop="moveToIndex(elements.length)"></li>
|
<li class="js-last-place" @drop="moveToIndex(elements.length)"></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div v-if="elements.length === 0">No contained elements</div>
|
<div v-if="elements.length === 0">No contained elements</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -55,8 +55,8 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
import Search from '../controls/search.vue';
|
import Search from '../components/search.vue';
|
||||||
import ObjectLabel from '../controls/ObjectLabel.vue';
|
import ObjectLabel from '../components/ObjectLabel.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
inject: ['openmct'],
|
inject: ['openmct'],
|
||||||
@ -147,7 +147,7 @@ export default {
|
|||||||
composition.splice(deleteIndex, 1);
|
composition.splice(deleteIndex, 1);
|
||||||
composition.splice(moveToIndex, 0, moveFromId);
|
composition.splice(moveToIndex, 0, moveFromId);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.openmct.objects.mutate(this.parentObject, 'composition', composition);
|
this.openmct.objects.mutate(this.parentObject, 'composition', composition);
|
||||||
},
|
},
|
||||||
moveFrom(index){
|
moveFrom(index){
|
@ -179,8 +179,8 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import multipane from '../controls/multipane.vue';
|
import multipane from '../layout/multipane.vue';
|
||||||
import pane from '../controls/pane.vue';
|
import pane from '../layout/pane.vue';
|
||||||
import Elements from './Elements.vue';
|
import Elements from './Elements.vue';
|
||||||
import Location from './Location.vue';
|
import Location from './Location.vue';
|
||||||
import Properties from './Properties.vue';
|
import Properties from './Properties.vue';
|
@ -62,8 +62,8 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import CreateAction from '../../../../platform/commonUI/edit/src/creation/CreateAction';
|
import CreateAction from '../../../platform/commonUI/edit/src/creation/CreateAction';
|
||||||
import objectUtils from '../../../api/objects/object-utils';
|
import objectUtils from '../../api/objects/object-utils';
|
||||||
|
|
||||||
function convertToLegacyObject(domainObject) {
|
function convertToLegacyObject(domainObject) {
|
||||||
let keyString = objectUtils.makeKeyString(domainObject.identifier);
|
let keyString = objectUtils.makeKeyString(domainObject.identifier);
|
@ -237,12 +237,12 @@
|
|||||||
<script>
|
<script>
|
||||||
import Inspector from '../inspector/Inspector.vue';
|
import Inspector from '../inspector/Inspector.vue';
|
||||||
import MctTree from './mct-tree.vue';
|
import MctTree from './mct-tree.vue';
|
||||||
import ObjectView from './ObjectView.vue';
|
import ObjectView from '../components/ObjectView.vue';
|
||||||
import MctTemplate from '../legacy/mct-template.vue';
|
import MctTemplate from '../legacy/mct-template.vue';
|
||||||
import CreateButton from '../controls/CreateButton.vue';
|
import CreateButton from './CreateButton.vue';
|
||||||
import search from '../controls/search.vue';
|
import search from '../components/search.vue';
|
||||||
import multipane from '../controls/multipane.vue';
|
import multipane from './multipane.vue';
|
||||||
import pane from '../controls/pane.vue';
|
import pane from './pane.vue';
|
||||||
import BrowseBar from './BrowseBar.vue';
|
import BrowseBar from './BrowseBar.vue';
|
||||||
import StatusBar from './status-bar/StatusBar.vue';
|
import StatusBar from './status-bar/StatusBar.vue';
|
||||||
import Toolbar from '../toolbar/Toolbar.vue';
|
import Toolbar from '../toolbar/Toolbar.vue';
|
@ -21,8 +21,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import viewControl from '../controls/viewControl.vue';
|
import viewControl from '../components/viewControl.vue';
|
||||||
import ObjectLabel from '../controls/ObjectLabel.vue';
|
import ObjectLabel from '../components/ObjectLabel.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'tree-item',
|
name: 'tree-item',
|
Loading…
x
Reference in New Issue
Block a user