mirror of
https://github.com/nasa/openmct.git
synced 2025-06-26 19:12:02 +00:00
Compare commits
7 Commits
fix-missin
...
hide-param
Author | SHA1 | Date | |
---|---|---|---|
4b39e17565 | |||
fd5631f5b7 | |||
d1dba4921b | |||
42af3ad2fc | |||
16fe1b55c6 | |||
8037c372b0 | |||
216a349282 |
@ -1,3 +1,25 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2021, 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>
|
<template>
|
||||||
<li
|
<li
|
||||||
draggable="true"
|
draggable="true"
|
||||||
|
@ -1,3 +1,25 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2021, 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>
|
<template>
|
||||||
<div class="c-elements-pool">
|
<div class="c-elements-pool">
|
||||||
<Search
|
<Search
|
||||||
|
@ -1,3 +1,25 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2021, 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>
|
<template>
|
||||||
<div class="c-inspector">
|
<div class="c-inspector">
|
||||||
<object-name />
|
<object-name />
|
||||||
@ -19,7 +41,9 @@
|
|||||||
type="vertical"
|
type="vertical"
|
||||||
>
|
>
|
||||||
<pane class="c-inspector__properties">
|
<pane class="c-inspector__properties">
|
||||||
<properties />
|
<Properties
|
||||||
|
v-if="!activity"
|
||||||
|
/>
|
||||||
<location />
|
<location />
|
||||||
<inspector-views />
|
<inspector-views />
|
||||||
</pane>
|
</pane>
|
||||||
@ -57,7 +81,7 @@ import multipane from '../layout/multipane.vue';
|
|||||||
import pane from '../layout/pane.vue';
|
import pane from '../layout/pane.vue';
|
||||||
import ElementsPool from './ElementsPool.vue';
|
import ElementsPool from './ElementsPool.vue';
|
||||||
import Location from './Location.vue';
|
import Location from './Location.vue';
|
||||||
import Properties from './Properties.vue';
|
import Properties from './details/Properties.vue';
|
||||||
import ObjectName from './ObjectName.vue';
|
import ObjectName from './ObjectName.vue';
|
||||||
import InspectorViews from './InspectorViews.vue';
|
import InspectorViews from './InspectorViews.vue';
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
@ -98,7 +122,8 @@ export default {
|
|||||||
key: '__styles',
|
key: '__styles',
|
||||||
name: 'Styles'
|
name: 'Styles'
|
||||||
}],
|
}],
|
||||||
currentTabbedView: {}
|
currentTabbedView: {},
|
||||||
|
activity: undefined
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -111,9 +136,12 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
updateInspectorViews(selection) {
|
updateInspectorViews(selection) {
|
||||||
this.refreshComposition(selection);
|
this.refreshComposition(selection);
|
||||||
|
|
||||||
if (this.openmct.types.get('conditionSet')) {
|
if (this.openmct.types.get('conditionSet')) {
|
||||||
this.refreshTabs(selection);
|
this.refreshTabs(selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.setActivity(selection);
|
||||||
},
|
},
|
||||||
refreshComposition(selection) {
|
refreshComposition(selection) {
|
||||||
if (selection.length > 0 && selection[0].length > 0) {
|
if (selection.length > 0 && selection[0].length > 0) {
|
||||||
@ -150,6 +178,12 @@ export default {
|
|||||||
},
|
},
|
||||||
isCurrent(view) {
|
isCurrent(view) {
|
||||||
return _.isEqual(this.currentTabbedView, view);
|
return _.isEqual(this.currentTabbedView, view);
|
||||||
|
},
|
||||||
|
setActivity(selection) {
|
||||||
|
this.activity = selection
|
||||||
|
&& selection.length
|
||||||
|
&& selection[0].length
|
||||||
|
&& selection[0][0].activity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,3 +1,25 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2021, 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.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
export const mockTelemetryTableSelection = [
|
export const mockTelemetryTableSelection = [
|
||||||
[{
|
[{
|
||||||
context: {
|
context: {
|
||||||
|
@ -1,10 +1,29 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2021, 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>
|
<template>
|
||||||
<div></div>
|
<div></div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
inject: ['openmct'],
|
inject: ['openmct'],
|
||||||
|
@ -1,3 +1,25 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2021, 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>
|
<template>
|
||||||
<div class="c-inspect-properties c-inspect-properties--location">
|
<div class="c-inspect-properties c-inspect-properties--location">
|
||||||
<div
|
<div
|
||||||
|
@ -1,3 +1,25 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2021, 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>
|
<template>
|
||||||
<div class="c-inspector__header">
|
<div class="c-inspector__header">
|
||||||
<div v-if="!multiSelect"
|
<div v-if="!multiSelect"
|
||||||
|
@ -1,171 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div v-if="!activity"
|
|
||||||
class="c-inspector__properties c-inspect-properties"
|
|
||||||
>
|
|
||||||
<div class="c-inspect-properties__header">
|
|
||||||
Details
|
|
||||||
</div>
|
|
||||||
<ul
|
|
||||||
v-if="!multiSelect && !singleSelectNonObject"
|
|
||||||
class="c-inspect-properties__section"
|
|
||||||
>
|
|
||||||
<li class="c-inspect-properties__row">
|
|
||||||
<div class="c-inspect-properties__label">
|
|
||||||
Title
|
|
||||||
</div>
|
|
||||||
<div class="c-inspect-properties__value">
|
|
||||||
{{ item.name }}
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li class="c-inspect-properties__row">
|
|
||||||
<div class="c-inspect-properties__label">
|
|
||||||
Type
|
|
||||||
</div>
|
|
||||||
<div class="c-inspect-properties__value">
|
|
||||||
{{ typeName }}
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li
|
|
||||||
v-if="item.created"
|
|
||||||
class="c-inspect-properties__row"
|
|
||||||
>
|
|
||||||
<div class="c-inspect-properties__label">
|
|
||||||
Created
|
|
||||||
</div>
|
|
||||||
<div class="c-inspect-properties__value">
|
|
||||||
{{ formatTime(item.created) }}
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li
|
|
||||||
v-if="item.modified"
|
|
||||||
class="c-inspect-properties__row"
|
|
||||||
>
|
|
||||||
<div class="c-inspect-properties__label">
|
|
||||||
Modified
|
|
||||||
</div>
|
|
||||||
<div class="c-inspect-properties__value">
|
|
||||||
{{ formatTime(item.modified) }}
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li
|
|
||||||
v-for="prop in typeProperties"
|
|
||||||
:key="prop.name"
|
|
||||||
class="c-inspect-properties__row"
|
|
||||||
>
|
|
||||||
<div class="c-inspect-properties__label">
|
|
||||||
{{ prop.name }}
|
|
||||||
</div>
|
|
||||||
<div class="c-inspect-properties__value">
|
|
||||||
{{ prop.value }}
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<div
|
|
||||||
v-if="multiSelect"
|
|
||||||
class="c-inspect-properties__row--span-all"
|
|
||||||
>
|
|
||||||
No properties to display for multiple items
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
v-if="singleSelectNonObject"
|
|
||||||
class="c-inspect-properties__row--span-all"
|
|
||||||
>
|
|
||||||
No properties to display for this item
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import Moment from "moment";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
inject: ['openmct'],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
domainObject: {},
|
|
||||||
activity: undefined,
|
|
||||||
multiSelect: false
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
item() {
|
|
||||||
return this.domainObject || {};
|
|
||||||
},
|
|
||||||
type() {
|
|
||||||
return this.openmct.types.get(this.item.type);
|
|
||||||
},
|
|
||||||
typeName() {
|
|
||||||
if (!this.type) {
|
|
||||||
return `Unknown: ${this.item.type}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.type.definition.name;
|
|
||||||
},
|
|
||||||
typeProperties() {
|
|
||||||
if (!this.type) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
let definition = this.type.definition;
|
|
||||||
if (!definition.form || definition.form.length === 0) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
return definition.form
|
|
||||||
.map((field) => {
|
|
||||||
let path = field.property;
|
|
||||||
if (typeof path === 'string') {
|
|
||||||
path = [path];
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
name: field.name,
|
|
||||||
path
|
|
||||||
};
|
|
||||||
})
|
|
||||||
.filter(field => Array.isArray(field.path))
|
|
||||||
.map((field) => {
|
|
||||||
return {
|
|
||||||
name: field.name,
|
|
||||||
value: field.path.reduce((object, key) => {
|
|
||||||
return object[key];
|
|
||||||
}, this.item)
|
|
||||||
};
|
|
||||||
});
|
|
||||||
},
|
|
||||||
singleSelectNonObject() {
|
|
||||||
return !this.item.identifier && !this.multiSelect;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.openmct.selection.on('change', this.updateSelection);
|
|
||||||
this.updateSelection(this.openmct.selection.get());
|
|
||||||
},
|
|
||||||
beforeDestroy() {
|
|
||||||
this.openmct.selection.off('change', this.updateSelection);
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
updateSelection(selection) {
|
|
||||||
if (selection.length === 0 || selection[0].length === 0) {
|
|
||||||
this.domainObject = {};
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selection.length > 1) {
|
|
||||||
this.multiSelect = true;
|
|
||||||
this.domainObject = {};
|
|
||||||
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
this.multiSelect = false;
|
|
||||||
this.domainObject = selection[0][0].context.item;
|
|
||||||
this.activity = selection[0][0].context.activity;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
formatTime(unixTime) {
|
|
||||||
return Moment.utc(unixTime).format('YYYY-MM-DD[\n]HH:mm:ss') + ' UTC';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
43
src/ui/inspector/details/DetailText.vue
Normal file
43
src/ui/inspector/details/DetailText.vue
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2021, 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>
|
||||||
|
<li class="c-inspect-properties__row">
|
||||||
|
<div class="c-inspect-properties__label">
|
||||||
|
{{ detail.name }}
|
||||||
|
</div>
|
||||||
|
<div class="c-inspect-properties__value">
|
||||||
|
{{ detail.value }}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
detail: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
50
src/ui/inspector/details/DetailTime.vue
Normal file
50
src/ui/inspector/details/DetailTime.vue
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2021, 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>
|
||||||
|
<li class="c-inspect-properties__row">
|
||||||
|
<div class="c-inspect-properties__label">
|
||||||
|
{{ detail.name }}
|
||||||
|
</div>
|
||||||
|
<div class="c-inspect-properties__value">
|
||||||
|
{{ formattedTime }}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Moment from 'moment';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
detail: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
formattedTime() {
|
||||||
|
return Moment.utc(this.detail.value).format('YYYY-MM-DD[\n]HH:mm:ss') + ' UTC';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
199
src/ui/inspector/details/Properties.vue
Normal file
199
src/ui/inspector/details/Properties.vue
Normal file
@ -0,0 +1,199 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2021, 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="c-inspector__properties c-inspect-properties">
|
||||||
|
<div class="c-inspect-properties__header">
|
||||||
|
Details
|
||||||
|
</div>
|
||||||
|
<ul
|
||||||
|
v-if="hasDetails"
|
||||||
|
class="c-inspect-properties__section"
|
||||||
|
>
|
||||||
|
<Component
|
||||||
|
:is="getComponent(detail)"
|
||||||
|
v-for="detail in details"
|
||||||
|
:key="detail.name"
|
||||||
|
:detail="detail"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<div
|
||||||
|
v-else
|
||||||
|
class="c-inspect-properties__row--span-all"
|
||||||
|
>
|
||||||
|
{{ noDetailsMessage }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import DetailText from './DetailText.vue';
|
||||||
|
import DetailTime from './DetailTime.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
DetailText,
|
||||||
|
DetailTime
|
||||||
|
},
|
||||||
|
inject: ['openmct'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
selection: undefined
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
details() {
|
||||||
|
return this.customDetails ? this.customDetails : this.domainObjectDetails;
|
||||||
|
},
|
||||||
|
customDetails() {
|
||||||
|
if (this.context === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.context.details;
|
||||||
|
},
|
||||||
|
domainObject() {
|
||||||
|
if (this.context === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.context.item;
|
||||||
|
},
|
||||||
|
type() {
|
||||||
|
if (this.domainObject === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.openmct.types.get(this.domainObject.type);
|
||||||
|
},
|
||||||
|
domainObjectDetails() {
|
||||||
|
if (this.domainObject === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const title = this.domainObject.name;
|
||||||
|
const typeName = this.type ? this.type.definition.name : `Unknown: ${this.domainObject.type}`;
|
||||||
|
const timestampLabel = this.domainObject.modified ? 'Modified' : 'Created';
|
||||||
|
const timestamp = this.domainObject.modified ? this.domainObject.modified : this.domainObject.created;
|
||||||
|
|
||||||
|
const details = [
|
||||||
|
{
|
||||||
|
name: 'Title',
|
||||||
|
value: title
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Type',
|
||||||
|
value: typeName
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
if (timestamp !== undefined) {
|
||||||
|
details.push(
|
||||||
|
{
|
||||||
|
name: timestampLabel,
|
||||||
|
value: timestamp,
|
||||||
|
component: 'time'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [...details, ...this.typeProperties];
|
||||||
|
},
|
||||||
|
context() {
|
||||||
|
if (
|
||||||
|
!this.selection
|
||||||
|
|| !this.selection.length
|
||||||
|
|| !this.selection[0].length
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.selection[0][0].context;
|
||||||
|
},
|
||||||
|
hasDetails() {
|
||||||
|
return Boolean(
|
||||||
|
this.details
|
||||||
|
&& this.details.length
|
||||||
|
&& !this.multiSelection
|
||||||
|
);
|
||||||
|
},
|
||||||
|
multiSelection() {
|
||||||
|
return this.selection && this.selection.length > 1;
|
||||||
|
},
|
||||||
|
noDetailsMessage() {
|
||||||
|
return this.multiSelection
|
||||||
|
? 'No properties to display for multiple items'
|
||||||
|
: 'No properties to display for this item';
|
||||||
|
},
|
||||||
|
typeProperties() {
|
||||||
|
if (!this.type) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
let definition = this.type.definition;
|
||||||
|
if (!definition.form || definition.form.length === 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return definition.form
|
||||||
|
.map((field) => {
|
||||||
|
let path = field.property;
|
||||||
|
if (typeof path === 'string') {
|
||||||
|
path = [path];
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: field.name,
|
||||||
|
path
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.filter(field => Array.isArray(field.path))
|
||||||
|
.map((field) => {
|
||||||
|
return {
|
||||||
|
name: field.name,
|
||||||
|
value: field.path.reduce((object, key) => {
|
||||||
|
return object[key];
|
||||||
|
}, this.domainObject)
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.openmct.selection.on('change', this.updateSelection);
|
||||||
|
this.updateSelection(this.openmct.selection.get());
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
this.openmct.selection.off('change', this.updateSelection);
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getComponent(detail) {
|
||||||
|
const component = detail.component ? detail.component : 'text';
|
||||||
|
|
||||||
|
return `detail-${component}`;
|
||||||
|
},
|
||||||
|
updateSelection(selection) {
|
||||||
|
this.selection = selection;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -53,6 +53,7 @@
|
|||||||
class="l-shell__pane-tree"
|
class="l-shell__pane-tree"
|
||||||
handle="after"
|
handle="after"
|
||||||
label="Browse"
|
label="Browse"
|
||||||
|
hide-param="hideTree"
|
||||||
collapsable
|
collapsable
|
||||||
@start-resizing="onStartResizing"
|
@start-resizing="onStartResizing"
|
||||||
@end-resizing="onEndResizing"
|
@end-resizing="onEndResizing"
|
||||||
@ -104,6 +105,7 @@
|
|||||||
class="l-shell__pane-inspector l-pane--holds-multipane"
|
class="l-shell__pane-inspector l-pane--holds-multipane"
|
||||||
handle="before"
|
handle="before"
|
||||||
label="Inspect"
|
label="Inspect"
|
||||||
|
hide-param="hideInspector"
|
||||||
collapsable
|
collapsable
|
||||||
@start-resizing="onStartResizing"
|
@start-resizing="onStartResizing"
|
||||||
@end-resizing="onEndResizing"
|
@end-resizing="onEndResizing"
|
||||||
|
@ -41,10 +41,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
const COLLAPSE_THRESHOLD_PX = 40;
|
const COLLAPSE_THRESHOLD_PX = 40;
|
||||||
const HIDE_TREE_PARAM = 'hideTree';
|
|
||||||
const HIDE_INSPECTOR_PARAM = 'hideInspector';
|
|
||||||
const PANE_INSPECTOR = 'Inspect';
|
|
||||||
const PANE_TREE = 'Browse';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
inject: ['openmct'],
|
inject: ['openmct'],
|
||||||
@ -63,6 +59,10 @@ export default {
|
|||||||
label: {
|
label: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
},
|
||||||
|
hideParam: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -78,39 +78,27 @@ export default {
|
|||||||
async mounted() {
|
async mounted() {
|
||||||
await this.$nextTick();
|
await this.$nextTick();
|
||||||
// Hide tree and/or inspector pane if specified in URL
|
// Hide tree and/or inspector pane if specified in URL
|
||||||
this.handleHideUrl();
|
if (this.collapsable) {
|
||||||
this.openmct.router.on('change:params', this.handleHideUrl);
|
this.handleHideUrl();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.openmct.router.off('change:params', this.handleHideUrl);
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toggleCollapse: function (e) {
|
toggleCollapse: function (e) {
|
||||||
let target = this.label === PANE_TREE ? HIDE_TREE_PARAM : HIDE_INSPECTOR_PARAM;
|
|
||||||
this.collapsed = !this.collapsed;
|
|
||||||
if (this.collapsed) {
|
if (this.collapsed) {
|
||||||
this.handleCollapse();
|
|
||||||
this.addHideParam(target);
|
|
||||||
} else {
|
|
||||||
this.handleExpand();
|
this.handleExpand();
|
||||||
this.removeHideParam(target);
|
this.removeHideParam(this.hideParam);
|
||||||
|
} else {
|
||||||
|
this.handleCollapse();
|
||||||
|
this.addHideParam(this.hideParam);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleHideUrl: function () {
|
handleHideUrl: function () {
|
||||||
if (!this.collapsable) {
|
const hideParam = this.openmct.router.getSearchParam(this.hideParam);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let hideTreeParam = this.openmct.router.getSearchParam(HIDE_TREE_PARAM);
|
if (hideParam === 'true') {
|
||||||
let hideInspectorParam = this.openmct.router.getSearchParam(HIDE_INSPECTOR_PARAM);
|
|
||||||
let hideTree = hideTreeParam === 'true' && this.label === PANE_TREE;
|
|
||||||
let hideInspector = hideInspectorParam === 'true' && this.label === PANE_INSPECTOR;
|
|
||||||
if (hideTree || hideInspector) {
|
|
||||||
this.collapsed = true;
|
|
||||||
this.handleCollapse();
|
this.handleCollapse();
|
||||||
} else {
|
|
||||||
this.collapsed = false;
|
|
||||||
this.handleExpand();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addHideParam: function (target) {
|
addHideParam: function (target) {
|
||||||
@ -122,11 +110,13 @@ export default {
|
|||||||
handleCollapse: function () {
|
handleCollapse: function () {
|
||||||
this.currentSize = (this.dragCollapse === true) ? this.initial : this.$el.style[this.styleProp];
|
this.currentSize = (this.dragCollapse === true) ? this.initial : this.$el.style[this.styleProp];
|
||||||
this.$el.style[this.styleProp] = '';
|
this.$el.style[this.styleProp] = '';
|
||||||
|
this.collapsed = true;
|
||||||
},
|
},
|
||||||
handleExpand: function () {
|
handleExpand: function () {
|
||||||
this.$el.style[this.styleProp] = this.currentSize;
|
this.$el.style[this.styleProp] = this.currentSize;
|
||||||
delete this.currentSize;
|
delete this.currentSize;
|
||||||
delete this.dragCollapse;
|
delete this.dragCollapse;
|
||||||
|
this.collapsed = false;
|
||||||
},
|
},
|
||||||
trackSize: function () {
|
trackSize: function () {
|
||||||
if (!this.dragCollapse === true) {
|
if (!this.dragCollapse === true) {
|
||||||
|
Reference in New Issue
Block a user