Skip to content

[Lens] Expose active data in some places#79851

Merged
flash1293 merged 13 commits intoelastic:masterfrom
flash1293:lens/expose-active-data
Nov 6, 2020
Merged

[Lens] Expose active data in some places#79851
flash1293 merged 13 commits intoelastic:masterfrom
flash1293:lens/expose-active-data

Conversation

@flash1293
Copy link
Copy Markdown
Contributor

@flash1293 flash1293 commented Oct 7, 2020

Fixes #79194

Pull the current data table into the Lens editor state and pass it to visualizations and datasources.

This is a prerequisite for #74509 and #68405

Changes breakdown

expressions

The data$ observable of the underlying loader is exposed in the react component using a callback (onData$). If set, it's called every time the data observable is emitting a new value with the this value and current inspector adapter contents

lens

  • Extending the merge_tables expression function to record all tables in the tables inspector adapter x-pack/plugins/lens/public/editor_frame_service/merge_tables.ts
  • Extending the Lens state by activeData?: Record<string, Datatable>, containing the last rendered data table per layer. This information might be outdated or not available, all consumers have to make sure to check before actually using it. x-pack/plugins/lens/public/editor_frame_service/editor_frame/state_management.ts
  • In the workspace panel, using the onData$ callback to get notified about arrived data and putting it into the state using dispatch x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx
  • Passing the active data (if it exists) to visualization and datasource in a bunch of relevant functions:
    • Part of frame public api (covers visualization functions)
    • getDatasourceSuggestionsFromCurrentState (to suggest different tables based on current data, e.g. by looking at cardinality)
    • DatasourceDimensionProps (to use this information in the dimension editor or dimension trigger, e.g. for visual indication of empty data, high cardinality, ...)
    • DatasourceLayerPanelProps (to use this information in the layer panel, e.g. for visual indication of empty data, high cardinality, ...)

There are a bunch of other places where we could pass this information but I don't see a good use case yet. If we ever decide to use it there as well, it shouldn't be hard to wire it up in the same way.

@flash1293 flash1293 added Feature:Lens release_note:skip Skip the PR/issue when compiling release notes v7.11.0 v8.0.0 labels Nov 4, 2020
@flash1293
Copy link
Copy Markdown
Contributor Author

Jenkins, test this.

@flash1293 flash1293 marked this pull request as ready for review November 4, 2020 16:34
@flash1293 flash1293 requested a review from a team November 4, 2020 16:34
@flash1293 flash1293 requested a review from a team as a code owner November 4, 2020 16:34
@flash1293 flash1293 added Team:AppArch Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// labels Nov 4, 2020
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@elasticmachine
Copy link
Copy Markdown
Contributor

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

@botelastic botelastic bot added the Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) label Nov 5, 2020
Copy link
Copy Markdown
Contributor

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

apparch changes LGTM

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

async chunks size

id before after diff
lens 1.0MB 1.0MB +672.0B

page load bundle size

id before after diff
expressions 188.6KB 188.8KB +283.0B
lens 49.7KB 50.0KB +234.0B
total +517.0B

History

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

Copy link
Copy Markdown
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.

LGTM

@flash1293 flash1293 merged commit 651345b into elastic:master Nov 6, 2020
flash1293 added a commit to flash1293/kibana that referenced this pull request Nov 6, 2020
# Conflicts:
#	x-pack/plugins/lens/public/editor_frame_service/editor_frame/suggestion_panel.tsx
#	x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) 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// v7.11.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Lens] Lens editor should be able to use the active data in configuration

5 participants