[Lens] Integrate Config Builder into APIs and transforms#235277
[Lens] Integrate Config Builder into APIs and transforms#235277mistic merged 89 commits intoelastic:mainfrom
Conversation
This is needed in case of dashboard url state that would bypass other transforms for by-value lens panels.
This item should never return the old `v0` state of lens.
|
Pinging @elastic/kibana-visualizations (Team:Visualizations) |
src/platform/packages/shared/kbn-lens-embeddable-utils/config_builder/schema/charts/metric.ts
Outdated
Show resolved
Hide resolved
x-pack/platform/plugins/shared/lens/common/transforms/transform_in.ts
Outdated
Show resolved
Hide resolved
x-pack/platform/plugins/shared/lens/public/react_embeddable/helper.ts
Outdated
Show resolved
Hide resolved
markov00
left a comment
There was a problem hiding this comment.
Reviewed after accepting my previous comments replies. Thanks Nick, all good for me!
dej611
left a comment
There was a problem hiding this comment.
General logic seems ok.
I'm a bit concerned about the lens-common-2 package: perhaps it can have a better name & more organized content? Not a blocker tho.
There was a problem hiding this comment.
Would it be best to include here all the Lens Embeddable types at this point?
I mean, generic Lens types at this point in @kbn/lens-common and embeddable types in @kbn/lens-embeddable-common. wdyt?
There was a problem hiding this comment.
I don't know, whatever makes it easier. I don't love these types being on their own when they should be in Lens.
Especially when the only limitation is the type checking, then re-exporting many of these types from Lens.
x-pack/platform/plugins/shared/lens/public/react_embeddable/lens_embeddable.tsx
Outdated
Show resolved
Hide resolved
) ## Summary Lens transforms Phase 2 ### Changes #### Integrate the Config Builder This integrates the `LensConfigBuilder` into the full end-to-end flow of all aspects of Lens including: - Lens APIs (transforms config to pass over the wire, convert to SO for saving) - Lens public client (transform api format to old Lens state) - Lens transforms (transforms Lens by-value panels for dashboards) #### Update Lens CM and API schema The schemas following changes from elastic#229534, did not match the integration perfectly and stubbed out a few things. So there was some cleanup needed to these schema to make them clearer and easier to understand. These also needed to be changed to integrate the new `lensApiStateSchema` that will include all New API Formats. #### Registers Lens embeddable transforms Transforms: - `dashboard/server` - Used to transform by-ref Lens dashboard panels. - `dashboard/public` - Used to transform panels from url state. - `lens/public` - Used to transform standalone Lens embeddables (see example [here](https://github.com/elastic/kibana/blob/ed9f709ef56b182116ebcd788245fdecfdacfd8b/x-pack/platform/plugins/shared/cases/public/components/visualizations/lens_renderer.tsx#L40)). These transforms are meant to transform both: - **Item transforms** - Current `v0` Lens state/attributes with old configurations to the latest state/attributes. Applying all existing runtime migrations and pins version to latest Lens item `v1`. - Only for `lens/public` transforms, we are not saving standalone Lens embeddable state in new API format. - **API Format transforms** - Transforms the current `v1` Lens state to the new API format and vis-versa. - Needed to save Lens as `v1` as SO but pass the New API Format over the wire. - Needed to save Lens state in dashboard by-value panels in the New API Format. Transforms are behind a features flag, when enabled it will transform only supported chart types for all lens visualizations including by-ref and by-value. When disabled (default) it will pass around the only Lens SO state as it does today. ```yml # kibana.dev.yml feature_flags.overrides: lens.apiFormat: true ``` ### Issues Closes elastic#229543 Closes elastic#229546 Closed elastic#237192 ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) --------- Co-authored-by: Peter Pisljar <peter.pisljar@elastic.co> Co-authored-by: dej611 <dej611@gmail.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Marco Liberati <dej611@users.noreply.github.com> Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co>
Summary
Lens transforms Phase 2
Changes
Integrate the Config Builder
This integrates the
LensConfigBuilderinto the full end-to-end flow of all aspects of Lens including:Update Lens CM and API schema
The schemas following changes from #229534, did not match the integration perfectly and stubbed out a few things. So there was some cleanup needed to these schema to make them clearer and easier to understand.
These also needed to be changed to integrate the new
lensApiStateSchemathat will include all New API Formats.Registers Lens embeddable transforms
Transforms:
dashboard/server- Used to transform by-ref Lens dashboard panels.dashboard/public- Used to transform panels from url state.lens/public- Used to transform standalone Lens embeddables (see example here).These transforms are meant to transform both:
v0Lens state/attributes with old configurations to the latest state/attributes. Applying all existing runtime migrations and pins version to latest Lens itemv1.lens/publictransforms, we are not saving standalone Lens embeddable state in new API format.v1Lens state to the new API format and vis-versa.v1as SO but pass the New API Format over the wire.Transforms are behind a features flag, when enabled it will transform only supported chart types for all lens visualizations including by-ref and by-value. When disabled (default) it will pass around the only Lens SO state as it does today.
Issues
Closes #229543
Closes #229546
Closed #237192
Checklist