[Discover] Use the current search draft when saving a search WIP#19
Draft
jughosta wants to merge 1 commit into218509-restore-search-statefrom
Draft
[Discover] Use the current search draft when saving a search WIP#19jughosta wants to merge 1 commit into218509-restore-search-statefrom
jughosta wants to merge 1 commit into218509-restore-search-statefrom
Conversation
Merged
6 tasks
jughosta
added a commit
to elastic/kibana
that referenced
this pull request
Jul 22, 2025
… range) (#227298) - Addresses #218509 ## Summary This PR introduces a way to keep track of the unsubmitted changes in UnifiedSearch component (`query`, `dateRangeFrom` and `dateRangeTo`) and restores when when switching tabs in Discover. It does not use `@kbn/restorable-state` because `src/platform/plugins/shared/unified_search/public/search_bar/search_bar.tsx` is a class component which would require a lot of refactoring otherwise. Instead, the PR introduces `draft` and `onDraftChange` optional props for UnifiedSearch. They allow to mount a search bar with a prefilled query state and it will be visually rendered as "dirty" (with "Update" button). - [x] unsubmitted KQL query and unsubmitted time range - [x] unsubmitted ES|QL query and unsubmitted time range Saving `uiState.searchDraft` per tab will allow us to address other issues too jughosta#19. ### Testing To enable tabs in Discover, run `localStorage.setItem('discoverExperimental:tabs', 'true')` in browser Console. ### Checklist - [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] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Bluefinger
pushed a commit
to Bluefinger/kibana
that referenced
this pull request
Jul 22, 2025
… range) (elastic#227298) - Addresses elastic#218509 ## Summary This PR introduces a way to keep track of the unsubmitted changes in UnifiedSearch component (`query`, `dateRangeFrom` and `dateRangeTo`) and restores when when switching tabs in Discover. It does not use `@kbn/restorable-state` because `src/platform/plugins/shared/unified_search/public/search_bar/search_bar.tsx` is a class component which would require a lot of refactoring otherwise. Instead, the PR introduces `draft` and `onDraftChange` optional props for UnifiedSearch. They allow to mount a search bar with a prefilled query state and it will be visually rendered as "dirty" (with "Update" button). - [x] unsubmitted KQL query and unsubmitted time range - [x] unsubmitted ES|QL query and unsubmitted time range Saving `uiState.searchDraft` per tab will allow us to address other issues too jughosta#19. ### Testing To enable tabs in Discover, run `localStorage.setItem('discoverExperimental:tabs', 'true')` in browser Console. ### Checklist - [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] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
maxcold
pushed a commit
to elastic/kibana
that referenced
this pull request
Jul 22, 2025
… range) (#227298) - Addresses #218509 ## Summary This PR introduces a way to keep track of the unsubmitted changes in UnifiedSearch component (`query`, `dateRangeFrom` and `dateRangeTo`) and restores when when switching tabs in Discover. It does not use `@kbn/restorable-state` because `src/platform/plugins/shared/unified_search/public/search_bar/search_bar.tsx` is a class component which would require a lot of refactoring otherwise. Instead, the PR introduces `draft` and `onDraftChange` optional props for UnifiedSearch. They allow to mount a search bar with a prefilled query state and it will be visually rendered as "dirty" (with "Update" button). - [x] unsubmitted KQL query and unsubmitted time range - [x] unsubmitted ES|QL query and unsubmitted time range Saving `uiState.searchDraft` per tab will allow us to address other issues too jughosta#19. ### Testing To enable tabs in Discover, run `localStorage.setItem('discoverExperimental:tabs', 'true')` in browser Console. ### Checklist - [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] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
kdelemme
pushed a commit
to kdelemme/kibana
that referenced
this pull request
Jul 23, 2025
… range) (elastic#227298) - Addresses elastic#218509 ## Summary This PR introduces a way to keep track of the unsubmitted changes in UnifiedSearch component (`query`, `dateRangeFrom` and `dateRangeTo`) and restores when when switching tabs in Discover. It does not use `@kbn/restorable-state` because `src/platform/plugins/shared/unified_search/public/search_bar/search_bar.tsx` is a class component which would require a lot of refactoring otherwise. Instead, the PR introduces `draft` and `onDraftChange` optional props for UnifiedSearch. They allow to mount a search bar with a prefilled query state and it will be visually rendered as "dirty" (with "Update" button). - [x] unsubmitted KQL query and unsubmitted time range - [x] unsubmitted ES|QL query and unsubmitted time range Saving `uiState.searchDraft` per tab will allow us to address other issues too jughosta#19. ### Testing To enable tabs in Discover, run `localStorage.setItem('discoverExperimental:tabs', 'true')` in browser Console. ### Checklist - [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] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
kertal
pushed a commit
to kertal/kibana
that referenced
this pull request
Jul 25, 2025
… range) (elastic#227298) - Addresses elastic#218509 ## Summary This PR introduces a way to keep track of the unsubmitted changes in UnifiedSearch component (`query`, `dateRangeFrom` and `dateRangeTo`) and restores when when switching tabs in Discover. It does not use `@kbn/restorable-state` because `src/platform/plugins/shared/unified_search/public/search_bar/search_bar.tsx` is a class component which would require a lot of refactoring otherwise. Instead, the PR introduces `draft` and `onDraftChange` optional props for UnifiedSearch. They allow to mount a search bar with a prefilled query state and it will be visually rendered as "dirty" (with "Update" button). - [x] unsubmitted KQL query and unsubmitted time range - [x] unsubmitted ES|QL query and unsubmitted time range Saving `uiState.searchDraft` per tab will allow us to address other issues too jughosta#19. ### Testing To enable tabs in Discover, run `localStorage.setItem('discoverExperimental:tabs', 'true')` in browser Console. ### Checklist - [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] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
crespocarlos
pushed a commit
to crespocarlos/kibana
that referenced
this pull request
Jul 25, 2025
… range) (elastic#227298) - Addresses elastic#218509 ## Summary This PR introduces a way to keep track of the unsubmitted changes in UnifiedSearch component (`query`, `dateRangeFrom` and `dateRangeTo`) and restores when when switching tabs in Discover. It does not use `@kbn/restorable-state` because `src/platform/plugins/shared/unified_search/public/search_bar/search_bar.tsx` is a class component which would require a lot of refactoring otherwise. Instead, the PR introduces `draft` and `onDraftChange` optional props for UnifiedSearch. They allow to mount a search bar with a prefilled query state and it will be visually rendered as "dirty" (with "Update" button). - [x] unsubmitted KQL query and unsubmitted time range - [x] unsubmitted ES|QL query and unsubmitted time range Saving `uiState.searchDraft` per tab will allow us to address other issues too jughosta#19. ### Testing To enable tabs in Discover, run `localStorage.setItem('discoverExperimental:tabs', 'true')` in browser Console. ### Checklist - [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] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Use
searchDraftwhen saving a search or when transitioning from Classic mode to ES|QL mode.Checklist
Delete any items that are not applicable to this PR.
Risk Matrix
Delete this section if it is not applicable to this PR.
Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.
When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:
For maintainers