-
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
[Embeddables rebuild] Decouple add panel trigger #176110
[Embeddables rebuild] Decouple add panel trigger #176110
Conversation
…decoupleAddPanelTrigger
…decoupleAddPanelTrigger
/ci |
/ci |
…decoupleAddPanelTrigger' into embeddableRefactor/decoupleAddPanelTrigger
/ci |
Pinging @elastic/kibana-presentation (Team:Presentation) |
/ci |
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.
Changes LGTM, tested ES|QL panel creation and everything works as expected. Very nice simplification Devon at least on the consumer side. Me gusta! 👏
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.
Really nice to see it all come together.
// Create and register an action which allows this embeddable to be created from | ||
// the dashboard toolbar context menu. | ||
// ----------------------------------------------------------------------------- | ||
uiActions.registerAction<EmbeddableApiContext>({ |
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.
How about moving action registration to plugin.setup method. That way, the action can be moved to its own file as well.
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.
Done in 192fd05
} | ||
|
||
export type PresentationContainer = Partial<PublishesViewMode> & | ||
PublishesLastSavedState & { | ||
addNewPanel: <ApiType extends unknown = unknown>( | ||
panel: PanelPackage, | ||
silent?: boolean |
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.
how about renaming silent
to something less cryptic, like displaySuccessToast
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 actually purposefully went more crypic with this one, because the presentation container interface could be fulfilled with any implementation, and they may not use a toast
or anything of the sort.
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.
How about displaySuccess
? Its vague on how success is displayed but conveys what this value toogles.
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.
Sure that works! displaySuccess
also has the bonus of being the default when no argument is passed in. Likely, most implementations will want to avoid the toast.
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.
done in 192fd05
throw new EmbeddableFactoryNotFoundError(panelPackage.panelType); | ||
} | ||
|
||
if (this.trackPanelAddMetric) { |
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.
Should trackPanelAddMetric be moved to top of function so it can track react embeddables as well?
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.
Good call, done in 192fd05
this.setScrollToPanelId(newEmbeddable.id); | ||
this.setHighlightPanelId(newEmbeddable.id); | ||
|
||
if (!silent) { |
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.
Should toast also be displayed when react embeddables are added?
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.
Good call. Done in 192fd05
…decoupleAddPanelTrigger' into embeddableRefactor/decoupleAddPanelTrigger
…decoupleAddPanelTrigger
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
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.
LGTM
code review, tested in chrome
Decouples the `ADD_PANEL_TRIGGER` from the Embeddables framework by making it take a `PresentationContainer` as context instead.
Decouples the `ADD_PANEL_TRIGGER` from the Embeddables framework by making it take a `PresentationContainer` as context instead.
Decouples the `ADD_PANEL_TRIGGER` from the Embeddables framework by making it take a `PresentationContainer` as context instead.
Summary
Closes #176230
This PR decouples the
ADD_PANEL_TRIGGER
from the Embeddables framework by making it take aPresentationContainer
as context instead.This PR also adds the ability to create new panels to the
PresentationContainer
interface. This allows us to register actions to create new React Embeddables.How to test
The example has been updated to include an action that creates
Eui Markdown
React Embeddables. You should be able to runyarn start --run-examples
then build Dashboards withEui Markdown
panels.