Skip to content

Commit

Permalink
[ES|QL] Query history (#178302)
Browse files Browse the repository at this point in the history
## Summary

Closes #173217

Implements the query history component in the ESQL editor. The query
history component displays the 20 most recent queries and it doesn't
duplicate. If the user reruns a query it will update an existing one and
not create a new entry.

<img width="1676" alt="image"
src="https://github.com/elastic/kibana/assets/17003240/23c8822d-3520-4952-b6cf-9cf7bb486389">

<img width="1678" alt="image"
src="https://github.com/elastic/kibana/assets/17003240/3fdeccbc-5763-46c6-a940-e2b39dd95179">

### Important notes

Right now, the query history component has been implemented at:

- Unified search ES|QL editor
- Lens inline editing component
- Alerts
- Maps

I have hid it from ML data visualizer because it was very difficult to
implement it there. There is a quite complex logic fetching the fields
statistics so it was a bit complicated to add it there. ML team can
follow up as they know the logic already and would be easier for them to
adjust.

#### Flajy test runner
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5553

### Checklist

Delete any items that are not applicable to this PR.

- [x] 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)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] 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))
- [ ] 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)
- [x] 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))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
stratoula and kibanamachine authored Mar 28, 2024
1 parent fc7d417 commit 884b94e
Show file tree
Hide file tree
Showing 22 changed files with 1,484 additions and 240 deletions.
1 change: 1 addition & 0 deletions packages/kbn-text-based-editor/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ module.exports = {
preset: '@kbn/test',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-text-based-editor'],
setupFilesAfterEnv: ['<rootDir>/packages/kbn-text-based-editor/setup_tests.ts'],
};
10 changes: 10 additions & 0 deletions packages/kbn-text-based-editor/setup_tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

// eslint-disable-next-line import/no-extraneous-dependencies
import '@testing-library/jest-dom';
Loading

0 comments on commit 884b94e

Please sign in to comment.