mirror of
https://github.com/nasa/openmct.git
synced 2025-03-05 13:30:34 +00:00
adding inspector
This commit is contained in:
parent
7af3996d29
commit
944634d759
src/plugins/events
58
src/plugins/events/EventInspectorViewProvider.js
Normal file
58
src/plugins/events/EventInspectorViewProvider.js
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
import mount from 'utils/mount';
|
||||||
|
|
||||||
|
import EventInspectorView from './components/EventInspectorView.vue';
|
||||||
|
|
||||||
|
export default function EventInspectorViewProvider(openmct) {
|
||||||
|
const INSPECTOR_KEY = 'telemetry.events.inspector';
|
||||||
|
return {
|
||||||
|
key: INSPECTOR_KEY,
|
||||||
|
name: 'Event',
|
||||||
|
canView: function (selection) {
|
||||||
|
if (
|
||||||
|
!Array.isArray(selection) ||
|
||||||
|
selection.length === 0 ||
|
||||||
|
!Array.isArray(selection[0]) ||
|
||||||
|
selection[0].length === 0
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let object = selection[0][0].context?.item;
|
||||||
|
|
||||||
|
return object && object.type === INSPECTOR_KEY;
|
||||||
|
},
|
||||||
|
view: function (selection) {
|
||||||
|
let _destroy = null;
|
||||||
|
|
||||||
|
return {
|
||||||
|
show: function (element) {
|
||||||
|
const { destroy } = mount(
|
||||||
|
{
|
||||||
|
el: element,
|
||||||
|
components: {
|
||||||
|
EventInspectorView
|
||||||
|
},
|
||||||
|
provide: {
|
||||||
|
openmct,
|
||||||
|
domainObject: selection[0][0].context.item
|
||||||
|
},
|
||||||
|
template: '<event-inspector></event-inspector>'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
app: openmct.app,
|
||||||
|
element
|
||||||
|
}
|
||||||
|
);
|
||||||
|
_destroy = destroy;
|
||||||
|
},
|
||||||
|
priority: function () {
|
||||||
|
return openmct.priority.HIGH + 1;
|
||||||
|
},
|
||||||
|
destroy: function () {
|
||||||
|
if (_destroy) {
|
||||||
|
_destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
73
src/plugins/events/components/EventInspectorView.vue
Normal file
73
src/plugins/events/components/EventInspectorView.vue
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<!--
|
||||||
|
Open MCT, Copyright (c) 2014-2024, 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-timelist-properties">
|
||||||
|
<div class="c-inspect-properties">
|
||||||
|
<ul class="c-inspect-properties__section">
|
||||||
|
<div class="c-inspect-properties_header" title="'Placeholder'">Placeholder</div>
|
||||||
|
<li class="c-inspect-properties__row">
|
||||||
|
<div class="c-inspect-properties__label" title="Foo">Foo</div>
|
||||||
|
<div class="c-inspect-properties__value">
|
||||||
|
<select
|
||||||
|
v-if="canEdit"
|
||||||
|
v-model="isExpanded"
|
||||||
|
aria-label="Display Style"
|
||||||
|
@change="updateExpandedView"
|
||||||
|
>
|
||||||
|
<option :key="'expanded-view-option-enabled'" :value="true">Expanded</option>
|
||||||
|
<option :key="'expanded-view-option-disabled'" :value="false">Compact</option>
|
||||||
|
</select>
|
||||||
|
<span>placeholder</span>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
inject: ['openmct', 'domainObject'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isEditing: this.openmct.editor.isEditing()
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
canEdit() {
|
||||||
|
return this.isEditing && !this.domainObject.locked;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.openmct.editor.on('isEditing', this.setEditState);
|
||||||
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
this.openmct.editor.off('isEditing', this.setEditState);
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
setEditState(isEditing) {
|
||||||
|
this.isEditing = isEditing;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -20,10 +20,12 @@
|
|||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
import EventInspectorViewProvider from './EventInspectorViewProvider.js';
|
||||||
import EventTimelineViewProvider from './EventTimelineViewProvider.js';
|
import EventTimelineViewProvider from './EventTimelineViewProvider.js';
|
||||||
|
|
||||||
export default function (options) {
|
export default function (options) {
|
||||||
return function install(openmct) {
|
return function install(openmct) {
|
||||||
openmct.objectViews.addProvider(new EventTimelineViewProvider(openmct));
|
openmct.objectViews.addProvider(new EventTimelineViewProvider(openmct));
|
||||||
|
openmct.objectViews.addProvider(new EventInspectorViewProvider(openmct));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user