Mct4170 - Give indicators priorities (#4322)

* added priority api with an enum for sane priority defaults
openmct.priority.LOW: -1000. Should always run last.
openmct.priority.DEFAULT: 0. This is the default unless you specify something else.
openmct.priority.HIGH: 1000. Should always run first.

* allow indicators to be sorted by priority
This commit is contained in:
Scott Bell
2021-10-25 23:24:03 +02:00
committed by GitHub
parent c0bda64927
commit a908eb1d65
13 changed files with 125 additions and 105 deletions

View File

@ -47,7 +47,9 @@ define([
});
let indicator = {
element: component.$mount().$el
element: component.$mount().$el,
key: 'clear-data-indicator',
priority: openmct.priority.DEFAULT
};
openmct.indicators.add(indicator);

View File

@ -41,6 +41,9 @@ describe('When the Clear Data Plugin is installed,', () => {
const openmct = {
objectViews: mockObjectViews,
indicators: mockIndicatorProvider,
priority: {
DEFAULT: 0
},
actions: mockActionsProvider,
install: function (plugin) {
plugin(this);
@ -69,13 +72,13 @@ describe('When the Clear Data Plugin is installed,', () => {
];
it('Global Clear Indicator is installed', () => {
openmct.install(ClearDataActionPlugin([]));
openmct.install(ClearDataActionPlugin(openmct, {indicator: true}));
expect(mockIndicatorProvider.add).toHaveBeenCalled();
});
it('Clear Data context menu action is installed', () => {
openmct.install(ClearDataActionPlugin([]));
openmct.install(ClearDataActionPlugin(openmct, []));
expect(mockActionsProvider.register).toHaveBeenCalled();
});

View File

@ -116,7 +116,8 @@ export default function ClockPlugin(options) {
});
const indicator = {
element: clockIndicator.$mount().$el,
key: 'clock-indicator'
key: 'clock-indicator',
priority: openmct.priority.LOW
};
openmct.indicators.add(indicator);

View File

@ -114,7 +114,8 @@ export default function NotebookPlugin() {
});
const indicator = {
element: notebookSnapshotIndicator.$mount().$el,
key: 'notebook-snapshot-indicator'
key: 'notebook-snapshot-indicator',
priority: openmct.priority.DEFAULT
};
openmct.indicators.add(indicator);

View File

@ -36,7 +36,8 @@ export default function plugin() {
let indicator = {
key: 'notifications-indicator',
element: component.$mount().$el
element: component.$mount().$el,
priority: openmct.priority.DEFAULT
};
openmct.indicators.add(indicator);