-
Notifications
You must be signed in to change notification settings - Fork 906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes broken app when management is turned off #4891
Fixes broken app when management is turned off #4891
Conversation
Signed-off-by: Ashwin P Chandran <[email protected]>
Signed-off-by: Ashwin P Chandran <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #4891 +/- ##
==========================================
- Coverage 66.39% 66.39% -0.01%
==========================================
Files 3397 3397
Lines 64804 64806 +2
Branches 10360 10361 +1
==========================================
+ Hits 43026 43027 +1
- Misses 19218 19219 +1
Partials 2560 2560
Flags with carried forward coverage won't be shown. Click here to find out more.
|
try { | ||
uiActions.addTriggerAction(CONTEXT_MENU_TRIGGER, viewEventsOptionAction); | ||
uiActions.addTriggerAction(SAVED_OBJECT_DELETE_TRIGGER, savedObjectDeleteAction); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't it be safer to wrap them individually? That way, a failure, due to one plugin being disabled, will not prevent other listeners from being added. Maybe even throw the triggers and the callbacks into an array and then loop through them and add the trigger, wrapped in a try-catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah with the current behaviour this is fine. The context menu trigger comes from the embeddables plugin which is not something we disable (Dashboards would not work without it). So in theory the only real action that cannot be registered is the savedObject Management trigger, which is already the second action in the try block.
uiActions.addTriggerAction(PLUGIN_RESOURCE_DELETE_TRIGGER, pluginResourceDeleteAction); | ||
uiActions.addTriggerAction(EXTERNAL_ACTION_TRIGGER, openEventsFlyoutAction); | ||
|
||
// These triggers are registered by other plugins. If they are disabled can throw an error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// These triggers are registered by other plugins. If they are disabled can throw an error. | |
// These triggers are registered by other plugins. If they are disabled, adding an action can throw an error. |
try { | ||
uiActions.addTriggerAction(CONTEXT_MENU_TRIGGER, viewEventsOptionAction); | ||
uiActions.addTriggerAction(SAVED_OBJECT_DELETE_TRIGGER, savedObjectDeleteAction); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* fixes broken app when management is turned off Signed-off-by: Ashwin P Chandran <[email protected]> * updates changelog Signed-off-by: Ashwin P Chandran <[email protected]> --------- Signed-off-by: Ashwin P Chandran <[email protected]> (cherry picked from commit 1068939) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
* fixes broken app when management is turned off Signed-off-by: Ashwin P Chandran <[email protected]> * updates changelog Signed-off-by: Ashwin P Chandran <[email protected]> --------- Signed-off-by: Ashwin P Chandran <[email protected]> (cherry picked from commit 1068939) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
Then
management.enabled: false
is set in the config, the app now correctly loads without breaking.Issues Resolved
fixes #4671
Screenshot
Testing the changes
set
management.enabled: false
in the config file and startup OSD. All the pages should be working while the management pages are disabled.Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr