-
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
[Enterprise Search] Refactor product server route registrations to their own files/folders #82663
Conversation
- super basic, leaves out assertions to avoid brittleness
export function registerGroupRoutes(dependencies: IRouteDependencies) { | ||
registerGroupsRoute(dependencies); | ||
registerSearchGroupsRoute(dependencies); | ||
registerGroupRoute(dependencies); |
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.
@scottybollinger I wasn't sure if you wanted to move all these registrations to the new index.ts or keep them grouped in this file for simplicity - let me know if you have a preference and I can make that change in this PR
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.
Moving it is fine. Thanks! Will definitely have an effect on #82669 but I can make changes after we merge this or vice versa.
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.
Sweet, thanks Scotty! I'll move them here shortly.
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.
Moved in ac5ddaa - hope I got it right, feel free to tweak further in #82669 if I didn't
import { registerAppSearchRoutes } from './'; | ||
|
||
describe('registerAppSearchRoutes', () => { | ||
it('runs without errors', () => { |
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.
I def know these aren't great tests - it basically just confirms that the parent fn runs w/o assertions, which is not my favorite but in this case I'm not sure it's worth the LOE to expand them further since:
- we weren't testing route registration calls originally anyway in plugin.ts
- In theory each individual
registerXRoute
should have its own fleshed out unit testing in any case
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.
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.
LGTM! Thanks for doing this!
💚 Build SucceededMetrics [docs]distributable file count
History
To update your PR or re-run it, just comment with: |
…eir own files/folders (elastic#82663) * Refactor all AS & WS route registrations to their own file/folders * Remove WS in route registrations since the main fn is already specific * Cover index.ts files - super basic, leaves out assertions to avoid brittleness * Move WS group routes to index.ts
* master: (127 commits) [ILM] Fix breadcrumbs (elastic#82594) [UX]Swap env filter with percentile (elastic#82246) Add platform's missing READMEs (elastic#82268) [Discover] Adding uiMetric to track Visualize link click (elastic#82344) [Search] Add used index pattern name to the search agg error field (elastic#82604) improve client-side SO client get pooling (elastic#82603) [Security Solution] Unskips Overview tests (elastic#82459) Embeddables/migrations (elastic#82296) [Enterprise Search] Refactor product server route registrations to their own files/folders (elastic#82663) Moving reinstall function outside of promise.all (elastic#82672) Load choropleth layer correctly (elastic#82628) Master backport elastic#81233 (elastic#82642) [Fleet] Allow snake cased Kibana assets (elastic#77515) Reduce saved objects authorization checks (elastic#82204) [data.search] Add request handler context and asScoped pattern (elastic#80775) [ML] Fixes formatting of fields in index data visualizer (elastic#82593) Usage collector readme (elastic#82548) [Lens] Visualization validation and better error messages (elastic#81439) [ML] Add annotation markers to time series brush area to indicate annotations exist outside of selected range (elastic#81490) chore(NA): install microdnf in UBI docker build only (elastic#82611) ...
Summary
I was adding a new Engine server route to App Search and noticed our
server/plugin.ts
was getting a little bloated/unwieldy. I decided to refactor/move all App Search and Workplace Search server route registrations to their own individual files (e.g.server/routes/index.ts
) rather than being at the top level ofserver/plugin.ts
.Benefits:
Checklist