diff --git a/src/plugins/conditionWidget/conditionWidgetStylesInterceptor.js b/src/plugins/conditionWidget/conditionWidgetStylesInterceptor.js index a6e29ff4eb..6a8aa4bf71 100644 --- a/src/plugins/conditionWidget/conditionWidgetStylesInterceptor.js +++ b/src/plugins/conditionWidget/conditionWidgetStylesInterceptor.js @@ -23,7 +23,7 @@ export default function conditionWidgetStylesInterceptor(openmct) { return { appliesTo: (identifier, domainObject) => { - return identifier.key === 'conditionWidget' && !domainObject.configuration?.objectStyles; + return domainObject.type === 'conditionWidget' && !domainObject?.configuration?.objectStyles; }, invoke: (identifier, domainObject) => { if (!domainObject.configuration) { @@ -35,7 +35,6 @@ export default function conditionWidgetStylesInterceptor(openmct) { openmct.objects.save(domainObject); return domainObject; - }, - priority: openmct.priority.DEFAULT + } }; } diff --git a/src/plugins/plot/overlayPlot/overlayPlotStylesInterceptor.js b/src/plugins/plot/overlayPlot/overlayPlotStylesInterceptor.js index 88a56e5f6a..d910f66f23 100644 --- a/src/plugins/plot/overlayPlot/overlayPlotStylesInterceptor.js +++ b/src/plugins/plot/overlayPlot/overlayPlotStylesInterceptor.js @@ -24,7 +24,7 @@ export default function overlayPlotStylesInterceptor(openmct) { return { appliesTo: (identifier, domainObject) => { return ( - identifier.key === 'telemetry.plot.overlay' && !domainObject.configuration?.objectStyles + domainObject.type === 'telemetry.plot.overlay' && !domainObject?.configuration?.objectStyles ); }, invoke: (identifier, domainObject) => { @@ -37,7 +37,6 @@ export default function overlayPlotStylesInterceptor(openmct) { openmct.objects.save(domainObject); return domainObject; - }, - priority: openmct.priority.DEFAULT + } }; } diff --git a/src/plugins/plot/plugin.js b/src/plugins/plot/plugin.js index ac3fbd047e..49fa6ece57 100644 --- a/src/plugins/plot/plugin.js +++ b/src/plugins/plot/plugin.js @@ -32,8 +32,6 @@ import StackedPlotViewProvider from './stackedPlot/StackedPlotViewProvider.js'; export default function () { return function install(openmct) { - openmct.objects.addGetInterceptor(overlayPlotStylesInterceptor(openmct)); - openmct.types.addType('telemetry.plot.overlay', { key: 'telemetry.plot.overlay', name: 'Overlay Plot', @@ -53,6 +51,8 @@ export default function () { priority: 891 }); + openmct.objects.addGetInterceptor(overlayPlotStylesInterceptor(openmct)); + openmct.types.addType('telemetry.plot.stacked', { key: 'telemetry.plot.stacked', name: 'Stacked Plot', diff --git a/src/plugins/plot/stackedPlot/StackedPlot.vue b/src/plugins/plot/stackedPlot/StackedPlot.vue index d3fe03d332..b87fb0d8b9 100644 --- a/src/plugins/plot/stackedPlot/StackedPlot.vue +++ b/src/plugins/plot/stackedPlot/StackedPlot.vue @@ -147,11 +147,6 @@ export default { this.config = this.getConfig(configId); this.showLegendsForChildren = this.config.legend.get('showLegendsForChildren'); - // Initialize objectStyles if it doesn't exist - if (!this.domainObject.configuration.objectStyles) { - this.domainObject.configuration.objectStyles = {}; - } - this.loaded = true; this.imageExporter = new ImageExporter(this.openmct); diff --git a/src/plugins/plot/stackedPlot/stackedPlotConfigurationInterceptor.js b/src/plugins/plot/stackedPlot/stackedPlotConfigurationInterceptor.js index e1dbc1c808..43e59a155c 100644 --- a/src/plugins/plot/stackedPlot/stackedPlotConfigurationInterceptor.js +++ b/src/plugins/plot/stackedPlot/stackedPlotConfigurationInterceptor.js @@ -23,14 +23,27 @@ export default function stackedPlotConfigurationInterceptor(openmct) { openmct.objects.addGetInterceptor({ appliesTo: (identifier, domainObject) => { - return domainObject && domainObject.type === 'telemetry.plot.stacked'; + return ( + domainObject.type === 'telemetry.plot.stacked' && + (!domainObject.configuration?.series || !domainObject.configuration?.objectStyles) + ); }, - invoke: (identifier, object) => { - if (object && object.configuration && object.configuration.series === undefined) { - object.configuration.series = []; + invoke: (identifier, domainObject) => { + if (!domainObject.configuration) { + domainObject.configuration = {}; } - return object; + if (!domainObject.configuration.series) { + domainObject.configuration.series = []; + } + + if (!domainObject.configuration.objectStyles) { + domainObject.configuration.objectStyles = {}; + } + + openmct.objects.save(domainObject); + + return domainObject; } }); }