kibana/x-pack/plugins/lens/public/mocks
Stratoula Kalafateli b55dae32f6
[ES|QL] Edits query in the dashboard (#169911)
## Summary

Part of https://github.com/elastic/kibana/issues/165928
Closes https://github.com/elastic/kibana/issues/144498

Allows the user to edit the ES|QL query from the dashboard. Also allows
the user to select one of the suggestions.

<img width="1886" alt="image"
src="9961c154-e414-4ce1-bff5-33ec5c30db69">
<img width="1883" alt="image"
src="6e8971d3-4a35-466f-804a-b8df58b09394">

### Testing
Navigate to Discover ES|QL mode and save a Lens chart to a dashboard.
Click the edit Visualization.

### Important notes
- We can very easily enable suggestions for the dataview panels but I am
going to do it on a follow up PR to keep this PR clean
- Creation is going to be added on a follow up PR
- Warnings are not rendered in the editor because I am using the limit 0
for performance reasons. We need to find another way to depict them via
the embeddable or store. It will be on a follow up PR.
- Errors are being displayed though. The user is not allowed to apply
the changes when an error occurs.
- Creating ES|QL charts from dashboard will happen to a follow up PR

### Running queries which don't return numeric fields
In these cases (i.e. `from logstash-* | keep clientip` we are returning
a table. I had to change the datatable logic for text based datasource
to not depend to isBucketed flag. This is something we had foreseen from
the [beginning of text based
languages](https://github.com/elastic/kibana/issues/144498)

<img width="1879" alt="image"
src="ca4b66fd-560d-4c1e-881d-b173458a06ae">

### Running queries which return a lot of fields
For queries with many fields Lens is going to suggest a huge table
trying to add the fields to the different dimensions. This is not
something we want:
- not performant
- user possibly will start removing fields from the dimensions
- this table is unreadable

For this reason we decided to select the first 5 fields and then the
user can easily adjust the dimensions with the fields they want.

<img width="1215" alt="image"
src="07d7ee78-0085-41b1-98a0-a77eefbc0dcd">


### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ] [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
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-11-23 12:26:40 +02:00
..
data_plugin_mock.ts [Lens] Enables text-based languages (SQL) (#140469) 2022-09-27 14:32:52 +03:00
data_views_service_mock.ts [Lens] library annotation groups (#152623) 2023-05-31 16:41:21 -04:00
datasource_mock.tsx [Lens] removes DatasourcePublicAPI (#170725) 2023-11-09 11:09:52 +01:00
dataview_mock.ts [ES|QL] Edits query in the dashboard (#169911) 2023-11-23 12:26:40 +02:00
expression_renderer_mock.tsx [Lens] Rewrite some tests to @testing-library/react (#170181) 2023-11-04 12:48:43 -07:00
index.ts [ES|QL] Edits query in the dashboard (#169911) 2023-11-23 12:26:40 +02:00
lens_plugin_mock.tsx [Textbased] Lens integration - move updateAll callback to middleware (#162165) 2023-07-25 12:49:26 +02:00
services_mock.tsx [Lens] Inline editing of lens panels on a dashboard or canvas (#166169) 2023-09-27 09:56:45 +02:00
store_mocks.tsx [testing] replace testing-library/dom package with testing-library/react (#170594) 2023-11-08 15:53:48 +01:00
suggestions_mock.ts [ES|QL] Edits query in the dashboard (#169911) 2023-11-23 12:26:40 +02:00
visualization_mock.tsx [Lens] removes DatasourcePublicAPI (#170725) 2023-11-09 11:09:52 +01:00