Skip to content
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

Merged
merged 4 commits into from
Mar 25, 2021

Conversation

shahzad31
Copy link
Contributor

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

image

@shahzad31 shahzad31 requested a review from a team March 24, 2021 09:08
@shahzad31 shahzad31 added release_note:skip Skip the PR/issue when compiling release notes v7.13.0 v8.0.0 labels Mar 24, 2021
@shahzad31 shahzad31 requested a review from flash1293 March 24, 2021 09:08
@flash1293 flash1293 added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Mar 24, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

Copy link
Contributor

@flash1293 flash1293 left a 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)

@shahzad31
Copy link
Contributor Author

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.

@flash1293
Copy link
Contributor

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[]>

@flash1293
Copy link
Contributor

As discussed offline, a statically exported icon component which lazily loads icons if necessary is also a good approach

@shahzad31
Copy link
Contributor Author

@flash1293 i ended up adopting your approach +1

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
lens 893.7KB 919.2KB +25.6KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
lens 33.3KB 33.5KB +167.0B
Unknown metric groups

async chunk count

id before after diff
lens 1 2 +1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@shahzad31 shahzad31 requested a review from flash1293 March 25, 2021 09:35
Copy link
Contributor

@flash1293 flash1293 left a 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.

@shahzad31 shahzad31 merged commit e0534e4 into elastic:master Mar 25, 2021
@shahzad31 shahzad31 deleted the expose-xy-chart-types branch March 25, 2021 14:27
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 95275 or prevent reminders by adding the backport:skip label.

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Mar 29, 2021
@shahzad31 shahzad31 added the auto-backport Deprecated - use backport:version if exact versions are needed label Mar 29, 2021
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Mar 29, 2021
@kibanamachine
Copy link
Contributor

💚 Backport successful

7.x / #95664

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Mar 29, 2021
Co-authored-by: Shahzad <shahzad.muhammad@elastic.co>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.13.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants