-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Use modern mount context in Dev Tools and Console #70379
Use modern mount context in Dev Tools and Console #70379
Conversation
src/plugins/console/public/plugin.ts
Outdated
@@ -46,23 +43,32 @@ export class ConsoleUIPlugin implements Plugin<void, void, AppSetupUIPluginDepen | |||
category: FeatureCatalogueCategory.ADMIN, | |||
}); | |||
|
|||
devTools.register({ | |||
return devTools.register({ |
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.
The original use of async
meant that the return value of calling devTools.register
was published as this setup
method's contract.
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.
Not 100% sure I follow 😅, how did async
cause the call to devTools.register
to be the return value of setup
? AFAICT the return value of async setup
was Promise<void>
.
In fact, I don't think we should be returning the value of devTools.register as the public contract. Not sure it makes sense to expose our registration to dev tools to other plugins, thus giving them a way to enable and disable console?
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.
To clarify, I think the return value of setup should go from Promise<void>
to just void
which should be achieved by just removing async
and not returning anything.
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.
You're right! I confused the implicit return of a promise with implicitly returning a value. Thanks for pointing this out!
element, | ||
appBasePath: '', | ||
onAppLeave: () => undefined, | ||
// TODO: adapt to use Core's ScopedHistory | ||
history: {} as any, | ||
}; | ||
const unmountHandler = isAppMountDeprecated(activeDevTool.mount) |
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.
None of the dev tools have deprecated mount methods any more.
@@ -66,7 +67,7 @@ export class DevToolApp { | |||
constructor( | |||
id: string, | |||
title: string, | |||
mount: App['mount'], | |||
mount: AppMount, |
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.
I had to make this change in order for TS to pass. It kept thinking I was trying to use the deprecated interface.
10dac82
to
1c1ec2f
Compare
@@ -59,15 +63,18 @@ export class DevToolsPlugin implements Plugin<DevToolsSetup, void> { | |||
euiIconType: 'devToolsApp', | |||
order: 9001, | |||
category: DEFAULT_APP_CATEGORIES.management, | |||
mount: async (appMountContext, params) => { | |||
if (!this.getSortedDevTools) { |
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.
This looks like a typo. Instead of invoking this method we're just checking that it exists, so this condition will always evaluate to true. If this logic were to be changed to invoke the method and respect a false
return value, we'd just throw an error and Kibana would crash. Which seems like worse behavior than rendering Dev Tools with an incomplete list of apps. So I think removing this condition makes the most sense.
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 it looks like this check should have been:
this.getSortedDevTools().length === 0
But I think your proposal makes more sense 👍
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
1c1ec2f
to
9118fe5
Compare
…n definitions of Grok Debugger, Search Profiler, and Painless Lab.
9118fe5
to
e05c909
Compare
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 are some really welcome changes @cjcenizal !
I left one comment regarding console setup return value that I would like to block on, but for the most part this is looking great 👍
src/plugins/console/public/plugin.ts
Outdated
@@ -46,23 +43,32 @@ export class ConsoleUIPlugin implements Plugin<void, void, AppSetupUIPluginDepen | |||
category: FeatureCatalogueCategory.ADMIN, | |||
}); | |||
|
|||
devTools.register({ | |||
return devTools.register({ |
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.
Not 100% sure I follow 😅, how did async
cause the call to devTools.register
to be the return value of setup
? AFAICT the return value of async setup
was Promise<void>
.
In fact, I don't think we should be returning the value of devTools.register as the public contract. Not sure it makes sense to expose our registration to dev tools to other plugins, thus giving them a way to enable and disable console?
@@ -59,15 +63,18 @@ export class DevToolsPlugin implements Plugin<DevToolsSetup, void> { | |||
euiIconType: 'devToolsApp', | |||
order: 9001, | |||
category: DEFAULT_APP_CATEGORIES.management, | |||
mount: async (appMountContext, params) => { | |||
if (!this.getSortedDevTools) { |
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 it looks like this check should have been:
this.getSortedDevTools().length === 0
But I think your proposal makes more sense 👍
@jloleysens Thanks for the review! I addressed your feedback. Could you take another look? |
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.
Thanks for addressing the feedback, happy with these changes!
@elasticmachine merge upstream |
💛 Build succeeded, but was flaky
Test FailuresKibana Pipeline / kibana-oss-agent / Chrome UI Functional Tests.test/functional/apps/saved_objects_management/edit_saved_object·ts.saved objects management saved objects edition page allows to delete a saved objectStandard Out
Stack Trace
Build metrics
History
To update your PR or re-run it, just comment with: |
This removes a warning from the browser console:
As part of this I also cleaned up the plugin definitions of Grok Debugger, Search Profiler, and Painless Lab.