mirror of
https://github.com/nasa/openmct.git
synced 2025-06-01 15:10:50 +00:00
add styles get interceptor for overlay plots
This commit is contained in:
parent
c385c90395
commit
97ae8db9d1
@ -26,9 +26,11 @@ export default function conditionWidgetStylesInterceptor(openmct) {
|
|||||||
return identifier.key === 'conditionWidget' && !domainObject.configuration?.objectStyles;
|
return identifier.key === 'conditionWidget' && !domainObject.configuration?.objectStyles;
|
||||||
},
|
},
|
||||||
invoke: (identifier, domainObject) => {
|
invoke: (identifier, domainObject) => {
|
||||||
domainObject.configuration = {
|
if (!domainObject.configuration) {
|
||||||
objectStyles: {}
|
domainObject.configuration = {};
|
||||||
};
|
}
|
||||||
|
|
||||||
|
domainObject.configuration.objectStyles = {};
|
||||||
|
|
||||||
openmct.objects.save(domainObject);
|
openmct.objects.save(domainObject);
|
||||||
|
|
||||||
|
@ -173,15 +173,6 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
eventHelpers.extend(this);
|
eventHelpers.extend(this);
|
||||||
this.imageExporter = new ImageExporter(this.openmct);
|
this.imageExporter = new ImageExporter(this.openmct);
|
||||||
|
|
||||||
// Initialize objectStyles for overlay plot if it doesn't exist
|
|
||||||
if (
|
|
||||||
this.domainObject.type === 'telemetry.plot.overlay' &&
|
|
||||||
!this.domainObject.configuration.objectStyles
|
|
||||||
) {
|
|
||||||
this.domainObject.configuration.objectStyles = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
this.loadComposition();
|
this.loadComposition();
|
||||||
this.setupClockChangedEvent((domainObject) => {
|
this.setupClockChangedEvent((domainObject) => {
|
||||||
this.triggerUnsubscribeFromStaleness(domainObject);
|
this.triggerUnsubscribeFromStaleness(domainObject);
|
||||||
|
43
src/plugins/plot/overlayPlot/overlayPlotStylesInterceptor.js
Normal file
43
src/plugins/plot/overlayPlot/overlayPlotStylesInterceptor.js
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* 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.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
export default function overlayPlotStylesInterceptor(openmct) {
|
||||||
|
return {
|
||||||
|
appliesTo: (identifier, domainObject) => {
|
||||||
|
return (
|
||||||
|
identifier.key === 'telemetry.plot.overlay' && !domainObject.configuration?.objectStyles
|
||||||
|
);
|
||||||
|
},
|
||||||
|
invoke: (identifier, domainObject) => {
|
||||||
|
if (!domainObject.configuration) {
|
||||||
|
domainObject.configuration = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
domainObject.configuration.objectStyles = {};
|
||||||
|
|
||||||
|
openmct.objects.save(domainObject);
|
||||||
|
|
||||||
|
return domainObject;
|
||||||
|
},
|
||||||
|
priority: openmct.priority.DEFAULT
|
||||||
|
};
|
||||||
|
}
|
@ -23,6 +23,7 @@ import PlotViewActions from './actions/ViewActions.js';
|
|||||||
import PlotsInspectorViewProvider from './inspector/PlotsInspectorViewProvider.js';
|
import PlotsInspectorViewProvider from './inspector/PlotsInspectorViewProvider.js';
|
||||||
import StackedPlotsInspectorViewProvider from './inspector/StackedPlotsInspectorViewProvider.js';
|
import StackedPlotsInspectorViewProvider from './inspector/StackedPlotsInspectorViewProvider.js';
|
||||||
import OverlayPlotCompositionPolicy from './overlayPlot/OverlayPlotCompositionPolicy.js';
|
import OverlayPlotCompositionPolicy from './overlayPlot/OverlayPlotCompositionPolicy.js';
|
||||||
|
import overlayPlotStylesInterceptor from './overlayPlot/overlayPlotStylesInterceptor.js';
|
||||||
import OverlayPlotViewProvider from './overlayPlot/OverlayPlotViewProvider.js';
|
import OverlayPlotViewProvider from './overlayPlot/OverlayPlotViewProvider.js';
|
||||||
import PlotViewProvider from './PlotViewProvider.js';
|
import PlotViewProvider from './PlotViewProvider.js';
|
||||||
import StackedPlotCompositionPolicy from './stackedPlot/StackedPlotCompositionPolicy.js';
|
import StackedPlotCompositionPolicy from './stackedPlot/StackedPlotCompositionPolicy.js';
|
||||||
@ -31,6 +32,8 @@ import StackedPlotViewProvider from './stackedPlot/StackedPlotViewProvider.js';
|
|||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
return function install(openmct) {
|
return function install(openmct) {
|
||||||
|
openmct.objects.addGetInterceptor(overlayPlotStylesInterceptor(openmct));
|
||||||
|
|
||||||
openmct.types.addType('telemetry.plot.overlay', {
|
openmct.types.addType('telemetry.plot.overlay', {
|
||||||
key: 'telemetry.plot.overlay',
|
key: 'telemetry.plot.overlay',
|
||||||
name: 'Overlay Plot',
|
name: 'Overlay Plot',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user