diff --git a/e2e/tests/functional/plugins/plot/autoscale.e2e.spec.js-snapshots/autoscale-canvas-panned-chrome-darwin b/e2e/tests/functional/plugins/plot/autoscale.e2e.spec.js-snapshots/autoscale-canvas-panned-chrome-darwin index d6d4dd21e5..072218f3f3 100644 Binary files a/e2e/tests/functional/plugins/plot/autoscale.e2e.spec.js-snapshots/autoscale-canvas-panned-chrome-darwin and b/e2e/tests/functional/plugins/plot/autoscale.e2e.spec.js-snapshots/autoscale-canvas-panned-chrome-darwin differ diff --git a/e2e/tests/functional/plugins/plot/autoscale.e2e.spec.js-snapshots/autoscale-canvas-panned-chrome-linux.png b/e2e/tests/functional/plugins/plot/autoscale.e2e.spec.js-snapshots/autoscale-canvas-panned-chrome-linux.png index 4a882660e0..145d4e54c4 100644 Binary files a/e2e/tests/functional/plugins/plot/autoscale.e2e.spec.js-snapshots/autoscale-canvas-panned-chrome-linux.png and b/e2e/tests/functional/plugins/plot/autoscale.e2e.spec.js-snapshots/autoscale-canvas-panned-chrome-linux.png differ diff --git a/e2e/tests/functional/plugins/plot/autoscale.e2e.spec.js-snapshots/autoscale-canvas-prepan-chrome-darwin b/e2e/tests/functional/plugins/plot/autoscale.e2e.spec.js-snapshots/autoscale-canvas-prepan-chrome-darwin index ef5455e5c4..b6c7ba2fcf 100644 Binary files a/e2e/tests/functional/plugins/plot/autoscale.e2e.spec.js-snapshots/autoscale-canvas-prepan-chrome-darwin and b/e2e/tests/functional/plugins/plot/autoscale.e2e.spec.js-snapshots/autoscale-canvas-prepan-chrome-darwin differ diff --git a/e2e/tests/functional/plugins/plot/autoscale.e2e.spec.js-snapshots/autoscale-canvas-prepan-chrome-linux.png b/e2e/tests/functional/plugins/plot/autoscale.e2e.spec.js-snapshots/autoscale-canvas-prepan-chrome-linux.png index ffdedffd2b..3b1a664ade 100644 Binary files a/e2e/tests/functional/plugins/plot/autoscale.e2e.spec.js-snapshots/autoscale-canvas-prepan-chrome-linux.png and b/e2e/tests/functional/plugins/plot/autoscale.e2e.spec.js-snapshots/autoscale-canvas-prepan-chrome-linux.png differ diff --git a/src/api/objects/InterceptorRegistry.js b/src/api/objects/InterceptorRegistry.js index 80f83cc712..bc51f98e1d 100644 --- a/src/api/objects/InterceptorRegistry.js +++ b/src/api/objects/InterceptorRegistry.js @@ -19,6 +19,7 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ +const DEFAULT_INTERCEPTOR_PRIORITY = 0; export default class InterceptorRegistry { /** * A InterceptorRegistry maintains the definitions for different interceptors that may be invoked on domain objects. @@ -45,7 +46,6 @@ export default class InterceptorRegistry { * @memberof module:openmct.InterceptorRegistry# */ addInterceptor(interceptorDef) { - //TODO: sort by priority this.interceptors.push(interceptorDef); } @@ -56,10 +56,18 @@ export default class InterceptorRegistry { * @memberof module:openmct.InterceptorRegistry# */ getInterceptors(identifier, object) { + + function byPriority(interceptorA, interceptorB) { + let priorityA = interceptorA.priority ?? DEFAULT_INTERCEPTOR_PRIORITY; + let priorityB = interceptorB.priority ?? DEFAULT_INTERCEPTOR_PRIORITY; + + return priorityB - priorityA; + } + return this.interceptors.filter(interceptor => { return typeof interceptor.appliesTo === 'function' && interceptor.appliesTo(identifier, object); - }); + }).sort(byPriority); } } diff --git a/src/plugins/myItems/myItemsInterceptor.js b/src/plugins/myItems/myItemsInterceptor.js index 375ee88e45..6a1953f8a5 100644 --- a/src/plugins/myItems/myItemsInterceptor.js +++ b/src/plugins/myItems/myItemsInterceptor.js @@ -37,14 +37,15 @@ function myItemsInterceptor(openmct, identifierObject, name) { return identifier.key === MY_ITEMS_KEY; }, invoke: (identifier, object) => { - if (openmct.objects.isMissing(object)) { + if (!object || openmct.objects.isMissing(object)) { openmct.objects.save(myItemsModel); return myItemsModel; } return object; - } + }, + priority: openmct.priority.HIGH }; }