mirror of
https://github.com/nasa/openmct.git
synced 2025-03-21 11:35:59 +00:00
update previous interceptors and add for stacked plot
This commit is contained in:
parent
f98cabe13b
commit
8655434e4b
@ -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
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -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',
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user