elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.81k stars 8.2k forks source link

[Lens] Context shape and state loading should be unified #150412

Open dej611 opened 1 year ago

dej611 commented 1 year ago

There are currently 4 context shape types in Lens and relative flows:

  1. No context for regular flows (new Lens viz, new Lens viz from dashboard, opening existing Lens viz, etc..)
    • this is the regular flow where state is extracted from a document, if it exists, or created an empty state
  2. Discover to Lens context
    • this is a custom flow from where from a Discover field it is possible to leverage the Lens suggestion system to produce a new Lens state
  3. Agg-based/TSVB "open in Lens" context (ad hoc state shape => Lens state)
    • this is a tricky one as we already know what the final state should be, but it passes thru the suggestion system as 2. but some special flags to force chart types and other choices.
  4. Lens (locator) to Lens context (share plugin)
    • this is very similar to 1. when a document exists but it has still some special branching

My idea would be to refactor part of these different context types into 3 context shapes:

Basically 3. and 4. from the previous list should be merged together into a unique shape, most probably the Lens state shape. It would also be great to unify the bootstrapping flow of 1. with existing document with the new Lens state shape of the 3. and 4. case in order to reduce the amount of code.

elasticmachine commented 1 year ago

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