[Discover] Restore Unified Search UI state on tab change (query, time range)#227298
[Discover] Restore Unified Search UI state on tab change (query, time range)#227298jughosta merged 26 commits intoelastic:mainfrom
Conversation
…o 218509-restore-search-state
…ch-state # Conflicts: # packages/kbn-optimizer/limits.yml
This comment was marked as outdated.
This comment was marked as outdated.
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#8659[✅] src/platform/test/functional/apps/discover/tabs/config.ts: 10/10 tests passed. |
|
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
pheyos
left a comment
There was a problem hiding this comment.
src/platform/test/functional/page_objects/unified_tabs.ts changes LGTM
davismcphee
left a comment
There was a problem hiding this comment.
Works great, thanks for addressing it! Left some comments and questions, but nothing blocking.
...tform/plugins/shared/discover/public/application/main/components/top_nav/discover_topnav.tsx
Outdated
Show resolved
Hide resolved
...tform/plugins/shared/discover/public/application/main/components/top_nav/discover_topnav.tsx
Outdated
Show resolved
Hide resolved
...tform/plugins/shared/discover/public/application/main/components/top_nav/discover_topnav.tsx
Outdated
Show resolved
Hide resolved
...tform/plugins/shared/discover/public/application/main/components/top_nav/discover_topnav.tsx
Show resolved
Hide resolved
src/platform/plugins/shared/unified_search/public/query_string_input/query_bar_top_row.tsx
Outdated
Show resolved
Hide resolved
💔 Build Failed
Failed CI StepsTest Failures
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
History
cc @jughosta |
jughosta
left a comment
There was a problem hiding this comment.
@davismcphee Thanks for the review! I addressed your suggestions.
...tform/plugins/shared/discover/public/application/main/components/top_nav/discover_topnav.tsx
Show resolved
Hide resolved
...tform/plugins/shared/discover/public/application/main/components/top_nav/discover_topnav.tsx
Outdated
Show resolved
Hide resolved
...tform/plugins/shared/discover/public/application/main/components/top_nav/discover_topnav.tsx
Outdated
Show resolved
Hide resolved
src/platform/plugins/shared/unified_search/public/query_string_input/query_bar_top_row.tsx
Outdated
Show resolved
Hide resolved
ThomThomson
left a comment
There was a problem hiding this comment.
Changes LGTM! We don't have enough unified search knowledge on the team to determine if this is the ideal way to solve this, but the code looks pretty straightforward, so approving to unblock!
...tform/plugins/shared/discover/public/application/main/components/top_nav/discover_topnav.tsx
Show resolved
Hide resolved
… 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>
… 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>
… 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>
… 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>
… 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>
Summary
This PR introduces a way to keep track of the unsubmitted changes in UnifiedSearch component (
query,dateRangeFromanddateRangeTo) and restores when when switching tabs in Discover. It does not use@kbn/restorable-statebecausesrc/platform/plugins/shared/unified_search/public/search_bar/search_bar.tsxis a class component which would require a lot of refactoring otherwise. Instead, the PR introducesdraftandonDraftChangeoptional 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).Saving
uiState.searchDraftper 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
release_note:*label is applied per the guidelinesbackport:*labels.