-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Discover] Deangularize discover controller #96766
[Discover] Deangularize discover controller #96766
Conversation
…-26-discover-refactor-histogram-query
…-12-discover-split-search-source-queries
…-12-discover-split-search-source-queries
…-12-discover-split-search-source-queries
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested around and didn't manage to break it, LGTM
This definitely needs at least one other pair of eyes due to the large complexity involved.
src/plugins/discover/public/application/apps/main/components/layout/discover_layout.tsx
Outdated
Show resolved
Hide resolved
…-12-discover-split-search-source-queries
@Dosant thx for the hint, I've adapted the code and added a test for this
also fixed this, could you have another look? many thx! |
src/plugins/discover/public/application/apps/main/components/layout/discover_layout.tsx
Outdated
Show resolved
Hide resolved
src/plugins/discover/public/application/apps/main/utils/update_search_source.ts
Outdated
Show resolved
Hide resolved
src/plugins/discover/public/application/apps/main/services/use_saved_search.ts
Outdated
Show resolved
Hide resolved
…_saved_search.ts Co-authored-by: Tim Roes <[email protected]>
…_search_source.ts Co-authored-by: Tim Roes <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retested those pieces. LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Despite my minor comments left, code LGTM. I'd see some optimizations especially around how we could optimize state handling in the saved search and state hook, but I am fine having those done in another PR, since we should get this PR through to unblock other work.
Tested it on Chrome Linux with playing around in Discover a bit and couldn't find anything breaking so far.
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: cc @kertal |
Co-authored-by: Tim Roes <[email protected]>
Co-authored-by: Tim Roes <[email protected]> Co-authored-by: Tim Roes <[email protected]>
Summary
This PR reduces Discover's Angular controller to a minimum (mainly router functions).
Changes
discover.js
logic is migrated into hooks and a wrapper component, only URL logic is left behind (Future PR)New
is selected (will remove that once we migrate the while plugin to react router)src/plugins/discover/public/application/apps/main/
Note that splitting the single request into 3 requests for number of hits, aggregation data for the histogram and documents was part of this PR, but for a better scope this was removed and there will be the follow up PR #100326.
Reviewing
Best to start with the new controller like component
DiscoverMainApp
https://github.com/elastic/kibana/blob/b78f2b13404b56873e0b428d883354a55970028c/src/plugins/discover/public/application/apps/main/discover_main_app.tsx
It contains the old controller logic splitted into 4 hooks ,
useDiscoverState
,useUrl
,useSearchSession
,useSavedSearchData
, and some inline codeThe majority of other changes are just different paths, so I'd recommend using Github's
viewed
button, and then to review the relevant stuffTesting
There shall be no regressions!
Checklist