[ML] Remove dependency cache #153476
Labels
Meta
:ml
refactoring
technical debt
Improvement of the software architecture and operational architecture
v8.16.0
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
The following are removed as of #176788
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
fromml/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 issueThe text was updated successfully, but these errors were encountered: