Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lens] Allow datasource and visualization to display error in workspace #80127

Closed
flash1293 opened this issue Oct 12, 2020 · 4 comments · Fixed by #81439 or #82607
Closed

[Lens] Allow datasource and visualization to display error in workspace #80127

flash1293 opened this issue Oct 12, 2020 · 4 comments · Fixed by #81439 or #82607
Assignees
Labels
enhancement New value added to drive a business result Feature:Lens Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@flash1293
Copy link
Contributor

Currently datasource and visualization can't opt out of rendering a chart except for not emitting a visualization at all which will result in a prompt to drop a field into the workspace.

In some cases the current configuration is invalid - in this case both visualization and datasource should be able to render an error message in the workspace instead of showing a chart.

Screen Shot 2020-10-07 at 10 30 49 AM

Also, in some cases the datasources needs to know about the dimension group properties to show nice error messages guiding the user in the right direction.

Screen Shot 2020-10-07 at 10 30 57 AM (1)

To cover these use cases, the following changes need to be made to the frame level types:

  • DatasourceDimensionEditorProps is extended with dimensionGroups: VisualizationDimensionGroupConfig[]. This contains the latest return value of getConfiguration of the currently active visualization
  • Datasource is extended with getErrorMessage(state: T, dimensionGroups: VisualizationDimensionGroupConfig[]) => { shortMessage: ReactNode, longMessage: ReactNode } | undefined
  • Visualization is extended with getErrorMessage(state: T, frame: FramePublicAPI) => { shortMessage: ReactNode, longMessage: ReactNode } | undefined
  • The frame calls these methods before generating the expression and shows an error message instead of the expression in the workspace panel like in the screenshot above
@flash1293 flash1293 added enhancement New value added to drive a business result Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens labels Oct 12, 2020
@elasticmachine
Copy link
Contributor

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

@flash1293
Copy link
Contributor Author

To use it directly so this is not just a PR putting new APIs in place, we can show a nice error message for the case explained here: #78173

Currently it tries to run the broken expression in this case.

@flash1293
Copy link
Contributor Author

Another case where a nice error message can help is the following (two layers with one of them not configured completely):
Screenshot 2020-10-16 at 15 02 41

@dej611
Copy link
Contributor

dej611 commented Nov 4, 2020

A second part to fix this is still pending

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Lens Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
3 participants