-
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
Expose xy chart types component #95275
Conversation
Pinging @elastic/kibana-app (Team:KibanaApp) |
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.
Before going into the details, I'm not convinced this component should live in the lens
plugin. It seems pretty opinionated in how it looks and works and it's also quite specific for its intended use case.
I see the need though, but so far we aren't directly exposing UI (except for the embeddable itself of course) and I want to keep the lines of ownership as clear as possible.
What about exposing the xy visualizationTypes
array instead and exploratory view can own the logic of building the UI out of it? As it's a fairly small piece of code I think it would be OK to export it statically in the initial bundle (an alternative would be exposing it via the contract as a lazy-loaded observable)
I do agree with the concerns, exposing visualizationTypes directly will add it to the page load bundle size(which i want to avoid), i guess maybe i can expose it as an Icon Item wrapping it around. In that case whatever chart type is being passed to that it just get relevant icon from visualizationTypes and render that. |
Not 100% sure what solution you prefer - I had something like this in mind: interface LensStart {
EmbeddableComponent: React.ComponentType<EmbeddableComponentProps>;
navigateToPrefilledEditor: (input: LensEmbeddableInput) => void;
canUseEditor: () => boolean;
getXyVisTypes: () => Promise<VisualizationType[]> |
As discussed offline, a statically exported icon component which lazily loads icons if necessary is also a good approach |
@flash1293 i ended up adopting your approach +1 |
💚 Build SucceededMetrics [docs]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.
Changes LGTM, code review only.
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Summary
We are using these chart type icons in exploratory view so exposing them from lens.
Testing
This shouldn't have any impact on lens