Stateful search bar default behaviors#56160
Merged
lizozom merged 40 commits intoelastic:masterfrom Feb 6, 2020
Merged
Conversation
added 2 commits
January 28, 2020 15:25
7 tasks
added 2 commits
January 28, 2020 18:41
Contributor
|
Pinging @elastic/kibana-app-arch (Team:AppArch) |
added 8 commits
January 29, 2020 11:08
…ata/stateful-search-bar-2
…ata/stateful-search-bar-2
Contributor
Author
|
@majagrubic I tagged you on this PR because you're working on the dashboard top nav integration |
…ata/stateful-search-bar-2
Member
added 2 commits
February 4, 2020 14:12
Contributor
Author
|
@kertal committed a fix for this literally 30 seconds ago |
Member
|
@lizozom this fixed the context display problem, guess the hopefully last problem here is the one you're currently working on: can't add filters in context view |
added 3 commits
February 4, 2020 19:59
Improve useSavedQuery hook in terface
…ata/stateful-search-bar-2
…izozom/kibana into newplatform/data/stateful-search-bar-2
Contributor
Author
|
@kertal I think I managed to stabilize this, but lets wait until CI is green :) |
kertal
approved these changes
Feb 5, 2020
Member
kertal
left a comment
There was a problem hiding this comment.
Code LGTM, context now works as expected! Thx a lot for cleaning up ancient discover/context code!
Contributor
Author
|
@elasticmachine merge upstream |
lizozom
pushed a commit
to lizozom/kibana
that referenced
this pull request
Feb 6, 2020
* Clean up discover * Clean up visualize * Clean up dashboard * use-default-behaviors * ts * Discover interval changing * timerange for interval definition in editor * ts * Revert most of changes to dashboard app because of changes in elastic#55443 * Fix spaces * Revert editor to scope PR! * typo * keep savedQuery state in create search bar * update saved query to save it with the state * revert all dashboard changes * saved queries * @kertal code review * fix applying filters from histogram * @Dosant code review * Merge changes from elastic#56643 to handle saved query errors Fix bug where saved query clean does not reset query * change string path * if * Extract useFilterManager and useTimefilter * Split useSavedQuery and restore capability of changing saved query in URL * Added some tests * context view * Remove useMemo * spaces * Support filter intial values Improve useSavedQuery hook in terface Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
lizozom
pushed a commit
that referenced
this pull request
Feb 6, 2020
* Clean up discover * Clean up visualize * Clean up dashboard * use-default-behaviors * ts * Discover interval changing * timerange for interval definition in editor * ts * Revert most of changes to dashboard app because of changes in #55443 * Fix spaces * Revert editor to scope PR! * typo * keep savedQuery state in create search bar * update saved query to save it with the state * revert all dashboard changes * saved queries * @kertal code review * fix applying filters from histogram * @Dosant code review * Merge changes from #56643 to handle saved query errors Fix bug where saved query clean does not reset query * change string path * if * Extract useFilterManager and useTimefilter * Split useSavedQuery and restore capability of changing saved query in URL * Added some tests * context view * Remove useMemo * spaces * Support filter intial values Improve useSavedQuery hook in terface Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This was referenced Feb 7, 2020
This was referenced Mar 10, 2020
Contributor
💔 Build FailedHistory
To update your PR or re-run it, just comment with: |
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
The goal of the stateful version of
SearchBar\TopNavMenuis to be an easy way to consume the services offered byplugins.data.querywhere developers should be able to provide minimal configuration and get a fully workingSearchBar.I used the
discoverapplication as a sample app integration with the stateful component. (These changes were tested on visualize \ dashboard, but to keep this PR as small as possible, I left them out).The React equivalent of the API used by discover is:
It is important to note that the SearchBar API is still undergoing changes so there might be still some inconsistencies to scope this PR
Current state (on master)
These features have default behaviors on master
These features don't have a default implementation
Hence when configuring a new
SearchBar(orTopNav) a developer had to provide an implementation for behaviors that don't have default behaviors.Moreover, most application haven't fully utilized this capability because it was partial and undocumented.
Default Behaviors
This PR adds all missing default behaviors and utilizes them to clean up
discover. In order not to refactor all places usingSearchBar\TopNavMenu, I made it opt-in using the flaguseDefaultBehavior.Filters
data.query.filterManagervia state.FilterBar, their state is automatically stored intodata.query.filterManager.data.query.filterManagerposts updates via an observable, you cannot pass in an additional callback into the statefulSearchBar.defaultFiltersUpdatedTimefilter \ Autorefresh settings
data.query.timefiltervia state.Timepicker, their state is automatically stored intodata.query.timefilter.timefilterposts updates via an observable, which is the preferred way to track changes. This is the only way to get notified of autorefresh changes, however, passing in a customonQuerySubmitcallback is still supported.defaultOnQuerySubmitanddefaultOnRefreshChangeQuery String settings
SearchBar.Timepicker, its state is automatically stored into the stateful SearchBar (will be moved to query string manager when available).onQuerySubmitand should be tracked by application state, since there's no API to retrieve them fromdataplugin.defaultOnQuerySubmit.Saved Queries
defaultOnClearSavedQuery,defaultOnSavedQueryUpdated,defaultOnQuerySaved.Next steps
onQuerySubmitas the only mean of getting updates on query changes.SearchBarDev Docs
The goal of the stateful version of SearchBar \ TopNavMenu is to be an easy way to consume the services offered by plugins.data.query where developers should be able to provide minimal configuration and get a fully working SearchBar.
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.For maintainers