-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Remove dependency cache. (#189729)
## Summary Fixes #153477. Fixes #153476. Part of #187772 (technical debt). Part of #153288 (migrate enzyme tests to react-testing-lib). Removes dependency cache. The major culprit making this PR large and not easy to split is that `getHttp()` from the dependency cache was used throughout the code base for services like `mlJobService` and `ml/mlApiServices` which then themselves were directly imported and not part of React component lifecycles. - For functional components this means mostly migrating to hooks that allow accessing services. - We still have a bit of a mix of usage of `withKibana` and `context` for class based React components. This was not consolidated in this PR, I took what's there and adjusted how services get used. These components access services via `this.props.kibana.services.*` or `this.context.services.*`. - Functions no longer access the global services provided via dependency cache but were updated to receive services via arguments. - Stateful services like `mlJobService` are exposed now via a factory that makes sure the service gets instantiated only once. - Some tests where the mocks needed quite some refactoring were ported to `react-testing-lib`. They no longer make use of snapshots or call component methods which should be considered implementation details. - We have a mix of usage of the plain `toasts` via `useMlKibana` and our own `toastNotificationServices` that wraps `toasts`. I didn't consolidate this in this PR but used what's available for the given code. - For class based components, service initializations were moved from `componentDidMount()` to `constructor()` where I spotted it. - We have a bit of a mix of naming: `ml`, `mlApiServices`, `useMlApiContext()` for the same thing. I didn't consolidate the naming in this PR, to avoid making this PR even larger. This can be done in a follow up, once this PR is in this should be more straightforward and less risky. - Turns out `explorer_chart_config_builder.js` is no longer used anywhere so I deleted it. - `jobs/jobs_list/components/utils.d.ts` was missing some definitions, tried to fix them. - Moved `stashJobForCloning` to be a method of `mlJobService`. - The `MetricSelector` component was an exact copy besides the i18n label, consolidated that so anomaly detection wizards use the same component. ### 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] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- Loading branch information
Showing
247 changed files
with
2,565 additions
and
3,136 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.