kibana icon indicating copy to clipboard operation
kibana copied to clipboard

[Lens] Move custom chart icons into lens package

Open alexwizp opened this issue 1 year ago • 5 comments

Closes #135230 Original PR: #138101

Summary

A new attempt to merge #138101 after revert

Why did the revert happen?

CI was RED. To fix the broken CI changes from #138038 should also be applied to a lens-icons package.

To reviewers:

Difference between original PR and this one only in https://github.com/elastic/kibana/pull/138413/commits/1c3085f2ce0e653772055eb9a2b88e31e978ba2c

alexwizp avatar Aug 09 '22 14:08 alexwizp

@elasticmachine merge upstream

alexwizp avatar Aug 09 '22 20:08 alexwizp

Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors)

elasticmachine avatar Aug 09 '22 21:08 elasticmachine

In case of removing extra styles which @MichaelMarcialis proposed

.lnsLayerChartSwitch__item-isSelected & {
    fill: makeGraphicContrastColor($euiColorVis0, $euiColorDarkShade);
  }

we can use @emotion/css instead of importing styles from scss file. + classnames dependency can be removed

  • [x] PR should be updated

alexwizp avatar Aug 10 '22 08:08 alexwizp

This PR was moved to Draft. We found duplicated icons in src/plugins/chart_expressions/expression_xy/**

Our plan:

  • move @kbn/lens-icons package out of x-pack and rename it to @kbn/chart-icons
  • reuse @kbn/chart-icons from expression_xy and lens

alexwizp avatar Aug 10 '22 09:08 alexwizp

@elasticmachine merge upstream

alexwizp avatar Aug 11 '22 13:08 alexwizp

This is bloating the bundle size of the gauge plugin - it seems like the gauge plugin is importing the icons from the package, then re-exporting them for Lens.

Let's remove the re-export from gauge and import them from the chart-icons package directly in Lens.

flash1293 avatar Aug 12 '22 09:08 flash1293

@elasticmachine merge upstream

alexwizp avatar Aug 12 '22 13:08 alexwizp

@elasticmachine merge upstream

alexwizp avatar Aug 15 '22 07:08 alexwizp

@alexwizp seems like the expression gauge plugin is still exporting the icons from the main index.ts file and the page load bundle is still bloated: Screenshot 2022-08-15 at 10 12 00

flash1293 avatar Aug 15 '22 08:08 flash1293

@flash1293 missed your previous comment, will fix in a minute. Thank you

alexwizp avatar Aug 15 '22 08:08 alexwizp

It's still re-exporting the chart icons package on the plugin, this time it's indirect via https://github.com/elastic/kibana/pull/138413/files#diff-84830ea845fdd1ad14f04dcd087863b4b0983805bee885c3da03eb9e229d8b48R15

because component/utils is importing the icons for the getIcons helper. As the getIcons helper is only used in the component itself which is lazy loaded, let's move the helper over there to get the page load bundle size down

flash1293 avatar Aug 15 '22 10:08 flash1293

@elasticmachine merge upstream

alexwizp avatar Aug 16 '22 08:08 alexwizp

:green_heart: Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
expressionGauge 39 81 +42
expressionHeatmap 68 112 +44
expressionPartitionVis 56 95 +39
expressionXY 114 144 +30
lens 906 913 +7
maps 874 918 +44
total +206

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/chart-icons - 76 +76
expressionGauge 61 57 -4
expressionHeatmap 103 101 -2
total +70

Async chunks

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

id before after diff
expressionGauge 10.6KB 18.0KB +7.3KB
expressionHeatmap 82.1KB 89.3KB +7.2KB
expressionPartitionVis 44.4KB 50.6KB +6.2KB
expressionXY 109.3KB 115.8KB +6.5KB
lens 1.2MB 1.2MB -4.7KB
maps 2.6MB 2.6MB +6.2KB
total +28.6KB

Page load bundle

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

id before after diff
expressionGauge 15.4KB 14.0KB -1.4KB
expressionHeatmap 15.0KB 13.8KB -1.2KB
expressionPartitionVis 23.5KB 23.6KB +110.0B
expressionXY 35.0KB 35.1KB +56.0B
lens 34.6KB 34.5KB -75.0B
maps 81.1KB 81.1KB +56.0B
total -2.4KB
Unknown metric groups

API count

id before after diff
@kbn/chart-icons - 76 +76
expressionGauge 61 57 -4
expressionHeatmap 107 105 -2
total +70

async chunk count

id before after diff
lens 14 15 +1

History

  • :green_heart: Build #65051 succeeded 2c03c6611e5744051bdeb78903517bb2d53841aa
  • :green_heart: Build #65026 succeeded a5c95e5a7edf74842e07a7aea46ca3d3863675d0
  • :green_heart: Build #65016 succeeded 7049cba78bf72d8da9abaf234ceca4396283130f
  • :green_heart: Build #64812 succeeded fe60f75d458c69c3496151765d0d20145aa05b17
  • :yellow_heart: Build #64727 was flaky 1a34303ddfe237feba867b6e5d451a4d38474619
  • :green_heart: Build #64547 succeeded 3426487b0b3978e5c1d997a37571a788ad3de58e

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

cc @alexwizp

kibana-ci avatar Aug 16 '22 10:08 kibana-ci