-
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 as Building Blocks] Controls API #140739
[Embeddables as Building Blocks] Controls API #140739
Conversation
…/controlsAPIExample
…-ref HEAD~1..HEAD --fix'
…/controlsAPIExample
…renderer from index
Pinging @elastic/kibana-presentation (Team:Presentation) |
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.
Code review LGTM, left a few comments + one clarifying question 👍
However, I found a bug when testing locally:
- Load one of the sample dashboards from scratch
- Make a selection
- Unselect that selection
- Notice that the unsaved changes badge doesn't disappear even though it should
Screen.Recording.2022-10-14.at.4.48.28.PM.mov
/** | ||
* Use Lifecycles to load initial control group container | ||
*/ | ||
useLifecycles( |
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 is a cool hook 👀
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, I enjoy these more explicitly named hooks from this library.
If you noticed, I imported it individually up top, because something in that library was failing our eslint in some manner. So if we use this function, we have to be careful with it.
return i18n.translate('controls.controlGroup.title', { | ||
defaultMessage: 'Control group', | ||
}); |
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.
Nice 👍
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 figure you got what this change did, but I'll write it down here in case anyone else is looking:
Removing the reference to the strings file here makes it so that the entire strings file doesn't end up in the page load bundle.
onEmbeddableLoad: (controlGroupContainer: ControlGroupContainer) => void; | ||
} | ||
|
||
export const ControlGroupRenderer = ({ input, onEmbeddableLoad }: ControlGroupRendererProps) => { |
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.
Just to be clear, this ControlGroupRenderer
isn't actually used anywhere yet, correct? You are simply introducing it to use it in a follow-up PR related to portable dashboards.
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.
Absolutely correct.
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.
Approving because the bug I found is actually in main
and not related to this PR 👍
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
async chunk count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
…45184) #140739 caused a regression with timeslider control where `ControlGroupContainer` was not not firing `updateOutput` on `output.timeslice` changes. This PR resolves the regression and adds functional tests to ensure interactions with timeslider properly flow to dashboard saved search panel Co-authored-by: kibanamachine <[email protected]>
Summary
This PR introduces a strongly typed React Component,
control_group_renderer
which returns a reference to the full Control Group Embeddable, so that the consuming application can use it as an API. This PR also contains a few new API additions for the Control group. This pattern should be used as an example moving forward for Embeddables as Building Blocks, and is necessary for the Portable Dashboards initiative.