* framework for all inspector views being provided * move elements view to plugin * move location view into plugin * move styles view into plugin * move properties view into plugin * install inspector views in index.html * rename filters inspector view provider for tab * finish elements view as plugin * finish location view as plugin * finish properties view as plugin * finish styles view as plugin * point main styles to new plugins * finish inspector tab and views components * fix paths for styles views * fix path issues * rename fault management inspector view fix unit test * fix paths for unit tests * rename bar graph inspector view fix unit test * rename plots inspector view fix unit test * inspector views installed in mct.js * sort inspector views by priority * make name required for inspector tabs * priority changes * only show filters tab if filters exist * object renamed to domainObject * remove dead code * select first tab if selected tab becomes hidden * bandaid fix to get e2e working * also apply bandaid to this test * [a11y] Basic ARIA tab role for Inspector panels * test(e2e): better selectors for scatterPlot test * test(e2e): fix search test selector * pass key and glyph to views * use key for tabs identification * high + 1 priority for object specific views * Closes #6118 - Significant layout and behavior refinements to Inspector tabs. - New theme constants for tabs. - Tabs in Tab Views updated to use theme constants. * Closes #6118 - Refinement to look of Inspector tabs. - Shortened names in many *InspectorViewProvider.js files. - WIP adding glyph capability, display not yet wired up. * Closes #6118 - Tightened H2 spacing in Inspector. * move annotations into plugin * register annotations view provider * move tags inside annotations * fix paths * move element item group into plugin * move PlotElementsPool view into plugin * plots has a different element view * fix paths for plot elements pool * fix: `role=` instead of `aria-role=` 🤦♂️ * test(e2e): fix tab locators * move location views into properties tab view * include location.scss * move location into properties tab * fix html for location within properties view * retain selected tab on new selection * refresh view of same tab with new selection * add browse mode inspector view for alphanumerics * fix prop passing * removed vestigial code * fix inspector tab selection * remove timeouts and unnessecary awaits * test: assert checkbox status before checking * add selectInspectorTab to general app actions * use selectInspectorTabs from appActions * need to pass page to playwright function * select the correct tab * fix plan unit test * fix plots tests by clicking on correct tab --------- Co-authored-by: Jesse Mazzella <jesse.d.mazzella@nasa.gov> Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: John Hill <john.c.hill@nasa.gov> Co-authored-by: Scott Bell <scott@traclabs.com>
254 lines
7.9 KiB
Vue
254 lines
7.9 KiB
Vue
/*****************************************************************************
|
|
* Open MCT, Copyright (c) 2014-2023, 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>
|
|
<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>
|
|
|
|
<Location
|
|
v-if="hasLocation"
|
|
:domain-object="domainObject"
|
|
:parent-domain-object="parentDomainObject"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import Moment from 'moment';
|
|
import DetailText from './DetailText.vue';
|
|
import Location from './Location.vue';
|
|
|
|
export default {
|
|
components: {
|
|
DetailText,
|
|
Location
|
|
},
|
|
inject: ['openmct'],
|
|
data() {
|
|
return {
|
|
selection: undefined
|
|
};
|
|
},
|
|
computed: {
|
|
details() {
|
|
return this.customDetails ?? this.domainObjectDetails;
|
|
},
|
|
customDetails() {
|
|
return this.context?.details;
|
|
},
|
|
domainObject() {
|
|
return this.context?.item;
|
|
},
|
|
parentDomainObject() {
|
|
return this.selection?.[0]?.[1]?.context?.item;
|
|
},
|
|
type() {
|
|
if (this.domainObject === undefined) {
|
|
return;
|
|
}
|
|
|
|
return this.openmct.types.get(this.domainObject.type);
|
|
},
|
|
domainObjectDetails() {
|
|
if (this.domainObject === undefined) {
|
|
return;
|
|
}
|
|
|
|
const UNKNOWN_USER = 'Unknown';
|
|
const title = this.domainObject.name;
|
|
const typeName = this.type ? this.type.definition.name : `Unknown: ${this.domainObject.type}`;
|
|
const createdTimestamp = this.domainObject.created;
|
|
const createdBy = this.domainObject.createdBy ? this.domainObject.createdBy : UNKNOWN_USER;
|
|
const modifiedBy = this.domainObject.modifiedBy ? this.domainObject.modifiedBy : UNKNOWN_USER;
|
|
const modifiedTimestamp = this.domainObject.modified ? this.domainObject.modified : this.domainObject.created;
|
|
const notes = this.domainObject.notes;
|
|
const version = this.domainObject.version;
|
|
|
|
const details = [
|
|
{
|
|
name: 'Title',
|
|
value: title
|
|
},
|
|
{
|
|
name: 'Type',
|
|
value: typeName
|
|
},
|
|
{
|
|
name: 'Created By',
|
|
value: createdBy
|
|
},
|
|
{
|
|
name: 'Modified By',
|
|
value: modifiedBy
|
|
}
|
|
];
|
|
|
|
if (notes) {
|
|
details.push({
|
|
name: 'Notes',
|
|
value: notes
|
|
});
|
|
}
|
|
|
|
if (createdTimestamp !== undefined) {
|
|
const formattedCreatedTimestamp = Moment.utc(createdTimestamp)
|
|
.format('YYYY-MM-DD[\n]HH:mm:ss')
|
|
+ ' UTC';
|
|
|
|
details.push(
|
|
{
|
|
name: 'Created',
|
|
value: formattedCreatedTimestamp
|
|
}
|
|
);
|
|
}
|
|
|
|
if (modifiedTimestamp !== undefined) {
|
|
const formattedModifiedTimestamp = Moment.utc(modifiedTimestamp)
|
|
.format('YYYY-MM-DD[\n]HH:mm:ss')
|
|
+ ' UTC';
|
|
|
|
details.push(
|
|
{
|
|
name: 'Modified',
|
|
value: formattedModifiedTimestamp
|
|
}
|
|
);
|
|
}
|
|
|
|
if (version) {
|
|
details.push({
|
|
name: 'Version',
|
|
value: version
|
|
});
|
|
}
|
|
|
|
return [...details, ...this.typeProperties];
|
|
},
|
|
context() {
|
|
return this.selection?.[0]?.[0]?.context;
|
|
},
|
|
hasDetails() {
|
|
return Boolean(
|
|
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
|
|
.filter(field => !field.hideFromInspector)
|
|
.map(field => {
|
|
let path = field.property;
|
|
if (typeof path === 'string') {
|
|
path = [path];
|
|
}
|
|
|
|
if (field.control === 'file-input') {
|
|
path = [...path, 'name'];
|
|
}
|
|
|
|
return {
|
|
name: field.name,
|
|
path
|
|
};
|
|
})
|
|
.filter(field => Array.isArray(field.path))
|
|
.map((field) => {
|
|
return {
|
|
name: field.name,
|
|
value: field.path.reduce((object, key) => {
|
|
if (object === undefined) {
|
|
return object;
|
|
}
|
|
|
|
return object[key];
|
|
}, this.domainObject)
|
|
};
|
|
});
|
|
},
|
|
hasLocation() {
|
|
const domainObject = this.selection?.[0]?.[0]?.context?.item;
|
|
const isRootObject = domainObject?.location === 'ROOT';
|
|
const hasSingleSelection = this.selection?.length === 1;
|
|
|
|
return hasSingleSelection && !isRootObject;
|
|
}
|
|
},
|
|
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>
|