Compare commits

...

2 Commits

Author SHA1 Message Date
80ee7d3cf6 add untracked files 2023-08-23 15:27:13 -07:00
2c7294bb3c plot working in inspector 2023-08-23 14:47:26 -07:00
6 changed files with 391 additions and 0 deletions

View File

@ -103,6 +103,10 @@ export default class ObjectAPI {
this.errors = {
Conflict: ConflictError
};
this.calls = {
get: {},
makeKeyString: {}
};
}
/**
@ -177,6 +181,31 @@ export default class ObjectAPI {
* has been updated, or be rejected if it cannot be saved
*/
addCall(type, identifier) {
let keyString;
if (!identifier) {
throw new Error('Cannot make key string from null identifier logging');
}
if (typeof identifier === 'string') {
keyString = identifier;
} else if (!identifier.namespace) {
keyString = identifier.key;
} else {
keyString = [identifier.namespace.replace(/:/g, '\\:'), identifier.key].join(':');
}
if (this.calls[type][keyString]) {
this.calls[type][keyString]++;
} else {
this.calls[type][keyString] = 1;
}
Object.entries(this.calls.get).forEach(([key, value]) => console.log(`get: ${key}: ${value}`));
Object.entries(this.calls.makeKeyString).forEach(([key, value]) => console.log(`makeKeyString: ${key}: ${value}`));
}
/**
* Delete this domain object.
*
@ -199,6 +228,7 @@ export default class ObjectAPI {
* has been saved, or be rejected if it cannot be saved
*/
get(identifier, abortSignal, forceRemote = false) {
this.addCall('get', identifier);
let keystring = this.makeKeyString(identifier);
if (!forceRemote) {
@ -729,6 +759,7 @@ export default class ObjectAPI {
* @returns {string} A string representation of the given identifier, including namespace and key
*/
makeKeyString(identifier) {
this.addCall('makeKeyString', identifier);
return utils.makeKeyString(identifier);
}

View File

@ -0,0 +1,150 @@
<template>
<div class="c-inspector__numeric-data">
<div class="c-inspect-properties__header">
Numeric Data
</div>
<div v-if="hasNumericData">
<TelemetryFrame
v-for="telemetryKey in telemetryKeys"
:key="telemetryKey"
:telemetry-key="telemetryKey"
/>
</div>
<div v-else>
nothing
</div>
</div>
</template>
<script>
import TelemetryFrame from './TelemetryFrame.vue';
export default {
inject: [
'openmct'
],
components: {
TelemetryFrame
},
props: {
// bounds: {
// type: Object,
// required: true
// },
// telemetryKeys: {
// type: Array,
// default: () => []
// }
},
watch: {
// telemetryKeys: {
// handler() {
// this.renderNumericData();
// },
// deep: true
// },
// bounds: {
// handler() {
// this.renderNumericData();
// },
// deep: true
// }
},
computed: {
hasNumericData() {
return this.telemetryKeys?.length;
}
},
data() {
return {
telemetryKeys: ['9852db1e-a08a-41a0-b668-810a14327344']
}
},
mounted() {
},
methods: {
// async renderNumericData() {
// // this.destroyComponent();
// const telemetryKeys = [];
// telemetryKeys.map((telemetryKey) => this.plotObjects.push(this.openmct.objects.get(telemetryKey)));
// await Promise.all(this.plotObjects);
// // this.setIndependentTimeContextForComponent();
// // this.renderComponent();
// this.ready = true;
// },
setIndependentTimeContextForComponent() {
// this.unregisterTimeContextList = [];
// this.plotObjects.forEach((plotObject) => {
// const keyString = this.openmct.objects.makeKeyString(plotObject.identifier);
// // get an independent time context for object
// this.openmct.time.getContextForView([plotObject]);
// // set the time context of the object to the selected time range
// this.unregisterTimeContextList.push(this.openmct.time.addIndependentContext(keyString, this.bounds));
// });
},
renderComponent() {
// this.elementsList = [];
// this.componentsList = [];
// const bounds = this.bounds;
// this.plotObjects.forEach((proxyPlotObject) => {
// const plotObject = toRaw(proxyPlotObject);
// const { vNode, destroy } = mount(
// {
// components: {
// TelemetryFrame,
// },
// provide: {
// openmct: this.openmct,
// path: [ plotObject ]
// },
// data() {
// return {
// plotObject,
// bounds,
// };
// },
// template: `<TelemetryFrame
// :bounds="bounds"
// :telemetry-object="plotObject"
// >
// </TelemetryFrame>`
// },
// {
// app: this.openmct.app
// }
// );
// this.componentsList.push(destroy);
// this.elementsList.push(vNode.el);
// this.$refs.numericDataView.append(vNode.el);
// });
},
destroyComponent() {
// if (this.componentsList) {
// this.componentsList.map(destroy => destroy());
// delete this.componentsList;
// }
// if (this.elementsList) {
// this.elementsList.map((element) => element.remove());
// delete this.elementsList;
// }
// if (this.plotObjects) {
// this.plotObjects = [];
// }
// if (this.unregisterTimeContextList) {
// this.unregisterTimeContextList.map((unregisterTimeContext) => unregisterTimeContext());
// delete this.unregisterTimeContextList;
// }
}
}
}
</script>

View File

@ -0,0 +1,139 @@
<template>
<div></div>
</template>
<script>
import mount from '../../utils/mount';
export default {
inject: [
'openmct'
],
props: {
// bounds: {
// type: Object,
// required: true
// },
telemetryKey: {
type: String,
required: true
}
},
computed: {
},
data() {
return {
telemetryObject: undefined,
loaded: false
}
},
async mounted() {
this.telemetryObject = await this.openmct.objects.get(this.telemetryKey);
this.renderPlot();
this.loaded = true;
},
methods: {
renderPlot() {
const { vNode, destroy } = mount(
{
components: {
Plot: this.openmct.components.Plot
},
provide: {
openmct,
domainObject: this.telemetryObject,
path: [ this.telemetryObject ]
},
methods: {
loadingUpdated(loaded) {
this.loading = loaded;
}
},
template: `<Plot />`
},
{
app: this.openmct.app,
element: this.$el
}
);
this.component = vNode.componentInstance;
this._destroy = destroy;
},
setIndependentTimeContextForComponent() {
// this.unregisterTimeContextList = [];
// this.plotObjects.forEach((plotObject) => {
// const keyString = this.openmct.objects.makeKeyString(plotObject.identifier);
// // get an independent time context for object
// this.openmct.time.getContextForView([plotObject]);
// // set the time context of the object to the selected time range
// this.unregisterTimeContextList.push(this.openmct.time.addIndependentContext(keyString, this.bounds));
// });
},
renderComponent() {
// this.elementsList = [];
// this.componentsList = [];
// const bounds = this.bounds;
// this.plotObjects.forEach((proxyPlotObject) => {
// const plotObject = toRaw(proxyPlotObject);
// const { vNode, destroy } = mount(
// {
// components: {
// TelemetryFrame,
// },
// provide: {
// openmct: this.openmct,
// path: [ plotObject ]
// },
// data() {
// return {
// plotObject,
// bounds,
// };
// },
// template: `<TelemetryFrame
// :bounds="bounds"
// :telemetry-object="plotObject"
// >
// </TelemetryFrame>`
// },
// {
// app: this.openmct.app
// }
// );
// this.componentsList.push(destroy);
// this.elementsList.push(vNode.el);
// this.$refs.numericDataView.append(vNode.el);
// });
},
destroyComponent() {
// if (this.componentsList) {
// this.componentsList.map(destroy => destroy());
// delete this.componentsList;
// }
// if (this.elementsList) {
// this.elementsList.map((element) => element.remove());
// delete this.elementsList;
// }
// if (this.plotObjects) {
// this.plotObjects = [];
// }
// if (this.unregisterTimeContextList) {
// this.unregisterTimeContextList.map((unregisterTimeContext) => unregisterTimeContext());
// delete this.unregisterTimeContextList;
// }
}
},
beforeUnmount() {
// this.destroyComponent();
}
}
</script>

View File

@ -0,0 +1,68 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2022, 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.
*****************************************************************************/
import Pivot from './Pivot.vue';
import mount from 'utils/mount';
export default function PropertiesViewProvider(openmct) {
return {
key: 'testPlotView',
name: 'PlotView',
glyph: 'icon-info',
canView: function (selection) {
return selection.length > 0;
},
view: function (selection) {
let _destroy = null;
return {
show: function (element) {
const { destroy } = mount(
{
el: element,
components: {
Pivot
},
provide: {
openmct
},
template: `<Pivot />`
},
{
app: openmct.app,
element
}
);
_destroy = destroy;
},
priority: function () {
return openmct.priority.HIGH+100000;
},
destroy: function () {
if (_destroy) {
_destroy();
}
}
};
}
};
}

View File

@ -25,6 +25,7 @@ import ElementsViewProvider from './elements/ElementsViewProvider';
import PlotElementsViewProvider from './elements/PlotElementsViewProvider';
import StylesInspectorViewProvider from './styles/StylesInspectorViewProvider';
import AnnotationsViewProvider from './annotations/AnnotationsViewProvider';
import TestPlotViewProvider from './TestPlotViewProvider';
export default function InspectorViewsPlugin() {
return function install(openmct) {
@ -33,5 +34,6 @@ export default function InspectorViewsPlugin() {
openmct.inspectorViews.addProvider(new PlotElementsViewProvider(openmct));
openmct.inspectorViews.addProvider(new StylesInspectorViewProvider(openmct));
openmct.inspectorViews.addProvider(new AnnotationsViewProvider(openmct));
openmct.inspectorViews.addProvider(new TestPlotViewProvider(openmct));
};
}

View File

@ -545,6 +545,7 @@ export default {
}
},
getConfig() {
const identifier = this.domainObject.identifier;
const configId = this.openmct.objects.makeKeyString(this.domainObject.identifier);
let config = configStore.get(configId);
if (!config) {