Skip to content

[Lens] Integrate Config Builder into APIs and transforms#235277

Merged
mistic merged 89 commits intoelastic:mainfrom
nickofthyme:lens-cb-integration
Nov 11, 2025
Merged

[Lens] Integrate Config Builder into APIs and transforms#235277
mistic merged 89 commits intoelastic:mainfrom
nickofthyme:lens-cb-integration

Conversation

@nickofthyme
Copy link
Contributor

@nickofthyme nickofthyme commented Sep 16, 2025

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 #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).

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.

# kibana.dev.yml
feature_flags.overrides:
  lens.apiFormat: true

Issues

Closes #229543
Closes #229546
Closed #237192

Checklist

  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list

@nickofthyme nickofthyme added Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// release_note:skip Skip the PR/issue when compiling release notes Feature:Lens backport:skip This PR does not require backporting labels Sep 16, 2025
@nickofthyme nickofthyme marked this pull request as ready for review November 5, 2025 18:26
@nickofthyme nickofthyme requested review from a team as code owners November 5, 2025 18:26
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-visualizations (Team:Visualizations)

@elastic elastic deleted a comment from elasticmachine Nov 5, 2025
Copy link
Contributor

@markov00 markov00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed after accepting my previous comments replies. Thanks Nick, all good for me!

Copy link
Contributor

@dej611 dej611 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@elastic elastic deleted a comment from elasticmachine Nov 10, 2025
@mistic mistic merged commit f2f865d into elastic:main Nov 11, 2025
13 checks passed
@nickofthyme nickofthyme deleted the lens-cb-integration branch November 11, 2025 15:25
eokoneyo pushed a commit to eokoneyo/kibana that referenced this pull request Dec 2, 2025
)

## 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v9.3.0

Projects

None yet

8 participants