Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Transforms: Improve transform list reloading behavior. (#164296)
## Summary - If the transform list fails to load, it does no longer show a non-refreshable full page error. Instead the error is shown in an inline callout and the refresh button is still present. - `AuthorizationProvider` is gone and has been replaced by a custom hook `useTransformCapabilities`. All client side code no longer relies on `privileges` being present but makes use of `capabilities` (like `canGetTransform` etc.). The custom route to fetch privileges and capabilities is also gone, instead capabilities are retrieved from Kibana's own `application.capabilities.transform` which we register server side. - Refactors all remote data fetching to use `react-query`. This gets rid of the custom code to refresh the transform list using observables, instead all CRUD actions now make use of `react-query`'s `useMutation` and trigger a cache invalidation of the transform list data to initiate a refetch. The `useApi` hook is gone, instead we now have specific hooks for data fetching that wrap `useQuery` (`useGetTransform`, `useGetTransformStats` etc.) and the existing hooks for actions have been refactored to use `useMutation` (`useStartTransforms`, `useStopTransforms` etc.). - Toasts for "success" messages have been removed. - All tests that made use of `toMatchSnapshot` have been refactored away from `enzyme` to `react-testing-lib` and no longer rely on snapshots, instead we make basic assertions on the rendered components. ### 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