Skip to content
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

[ML] Remove dependency cache #153476

Closed
51 of 59 tasks
jgowdyelastic opened this issue Mar 22, 2023 · 1 comment · Fixed by #189729
Closed
51 of 59 tasks

[ML] Remove dependency cache #153476

jgowdyelastic opened this issue Mar 22, 2023 · 1 comment · Fixed by #189729
Assignees
Labels
Meta :ml refactoring technical debt Improvement of the software architecture and operational architecture v8.16.0

Comments

@jgowdyelastic
Copy link
Member

jgowdyelastic commented Mar 22, 2023

ML's dependancy cache is a system which provides access to external services as a static import.
It is used in 31 files.

Remove dependency cache items

  • timefilter
  • config
  • docLinks
  • toastNotifications
  • recentlyAccessed
  • fieldFormats
  • application
  • http
  • i18n
  • maps

The following are removed as of #176788

  • chrome
  • overlays
  • theme
  • autocomplete
  • basePath
  • savedSearch
  • security
  • dashboard
  • dataVisualizer
  • dataViews
  • share
  • lens

Util like files
These will need to be wrapped in provider function or converted to a service class to allow the dependencies to be passed in.

  • x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/outlier_exploration/use_outlier_data.ts
  • x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/services/analytics_service/stop_analytics.ts
  • x-pack/plugins/ml/public/application/explorer/explorer_utils.ts (DA)
  • x-pack/plugins/ml/public/application/jobs/components/custom_url_editor/utils.js
  • x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/edit_utils.js
  • x-pack/plugins/ml/public/application/jobs/jobs_list/components/utils.js
  • x-pack/plugins/ml/public/application/jobs/new_job/job_from_lens/route_resolver.ts
  • x-pack/plugins/ml/public/application/jobs/new_job/job_from_map/quick_create_job.ts
  • x-pack/plugins/ml/public/application/jobs/new_job/job_from_map/route_resolver.ts
  • x-pack/plugins/ml/public/application/jobs/new_job/recognize/resolvers.ts
  • x-pack/plugins/ml/public/application/services/http_service.ts
  • x-pack/plugins/ml/public/application/services/ml_api_service/index.ts
  • x-pack/plugins/ml/public/application/services/toast_notification_service/toast_notification_service.ts
  • x-pack/plugins/ml/public/application/settings/filter_lists/edit/utils.js
  • x-pack/plugins/ml/public/application/util/index_utils.ts
  • x-pack/plugins/ml/public/application/util/recently_accessed.ts
  • x-pack/plugins/ml/public/application/util/time_buckets.js

React classes
Convert to functional component to allow use of hooks or pass in dependencies as props.
An alternative is to use contextType to access kibana context from the class based component (see https://legacy.reactjs.org/docs/context.html#classcontexttype).
For javascript files, converting to a functional component would also involve rewriting in TypeScript.

  • x-pack/plugins/ml/public/application/components/annotations/annotation_flyout/index.tsx
  • x-pack/plugins/ml/public/application/components/validate_job/validate_job_view.js
  • x-pack/plugins/ml/public/application/settings/calendars/edit/new_calendar.js
  • x-pack/plugins/ml/public/application/settings/calendars/list/calendars_list.js
  • x-pack/plugins/ml/public/application/settings/calendars/list/delete_calendars.js
  • x-pack/plugins/ml/public/application/settings/filter_lists/components/delete_filter_list_modal/delete_filter_lists.js
  • x-pack/plugins/ml/public/application/settings/filter_lists/edit/edit_filter_list.js
  • x-pack/plugins/ml/public/application/settings/filter_lists/list/filter_lists.js

TypeScript functional components
Replace with context versions supplied by useMlKibana

  • x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_creation/components/configuration_step/configuration_step_form.tsx
  • x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/expandable_section/expandable_section_results.tsx
  • x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/exploration_results_table/exploration_results_table.tsx
  • x-pack/plugins/ml/public/application/license/expired_warning.tsx

Test files

  • x-pack/plugins/ml/public/application/components/annotations/annotation_flyout/index.test.tsx
  • x-pack/plugins/ml/public/application/components/validate_job/validate_job_view.test.js
  • x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/action_delete/delete_action_name.test.tsx
  • x-pack/plugins/ml/public/application/settings/calendars/edit/new_calendar.test.js
  • x-pack/plugins/ml/public/application/settings/calendars/list/calendars_list.test.js
  • x-pack/plugins/ml/public/application/settings/filter_lists/edit/edit_filter_list.test.js
  • x-pack/plugins/ml/public/application/settings/filter_lists/list/filter_lists.test.js
  • x-pack/plugins/ml/public/application/util/chart_utils.test.js

ML API service
We have a lot of use of the statically imported api service, normally imported as ml from ml/public/application/services/ml_api_service/index.ts
This uses http from the dependency cache. In order to remove this dependancy, the api service will also need to change. Related issue

@jgowdyelastic jgowdyelastic added Meta :ml refactoring technical debt Improvement of the software architecture and operational architecture labels Mar 22, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@walterra walterra self-assigned this Feb 15, 2024
walterra added a commit that referenced this issue Mar 5, 2024
…wer embeddable (#176788)

## Summary

Part of #176651 and #153476. Follow up to #175556.

Fixes the click on anomaly markers in the Single Metric Viewer
embeddable. This required refactoring some dependencies to be properly
passed in via React contexts instead of the legacy dependency cache.

[smv-embeddable-click-0001.webm](https://github.com/elastic/kibana/assets/230104/6d0bb0e5-bfde-4429-8876-bdc94ce646c8)

### 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Meta :ml refactoring technical debt Improvement of the software architecture and operational architecture v8.16.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants