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] Transforms: Improves transform list reloading behavior. #164296

Merged
Merged
Changes from 1 commit
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
3919a8b
migrate transform list to use react-query
walterra Aug 21, 2023
ec2bd1c
refactor inline useQuery to custom hook. cleanup useApi.
walterra Aug 21, 2023
04ae3c0
migrate wizard to use react-query
walterra Aug 22, 2023
2daa660
fix i18n
walterra Aug 22, 2023
c23dc68
migrate cloning to use react-query
walterra Aug 22, 2023
a8ee0ea
remove getTransformStats from useApi
walterra Aug 22, 2023
a2978b2
migrate update to use react-query
walterra Aug 22, 2023
1f55030
migrate preview to use react-query
walterra Aug 22, 2023
7d5107b
migrate reauthorize to use react-query
walterra Aug 22, 2023
e7d1c0e
migrate reset to use react-query
walterra Aug 22, 2023
9c47fe6
migrate stop to use react-query
walterra Aug 22, 2023
cb904c0
migrate schedule now to use react-query
walterra Aug 22, 2023
1526d62
migrate more to react-query
walterra Aug 22, 2023
8cade10
migrate rest of useApi to react-query
walterra Aug 22, 2023
0614d00
remove unnecessary type guards
walterra Aug 22, 2023
5f04ab7
remove unnecessary type guards
walterra Aug 22, 2023
c4b4d53
cleanup
walterra Aug 22, 2023
be3e0fc
cleanup
walterra Aug 22, 2023
3080150
refactor IndexService into custom hooks using react-query
walterra Aug 22, 2023
d302856
fix tests
walterra Aug 23, 2023
5fbaec2
remove success toasts
walterra Aug 23, 2023
b986a42
fix i18n
walterra Aug 23, 2023
32c12eb
refactor AuthorizationProvider into useAuthorization hook.
walterra Aug 24, 2023
27233be
fix react-query caching
walterra Aug 24, 2023
6a00eef
cleanup
walterra Aug 24, 2023
4802a9a
fix authorization hooks
walterra Aug 24, 2023
9acea75
cleanup
walterra Aug 24, 2023
c135c95
cleanup
walterra Aug 24, 2023
70a8d63
return mutate only instead of whole mutation from custom hooks
walterra Aug 24, 2023
61b300a
cleanup
walterra Aug 24, 2023
bfbb3dc
migrate enzyme-snapshots to react-testing-lib
walterra Aug 24, 2023
a6a7c70
client side code no longer relies on privileges
walterra Aug 25, 2023
9d44654
fix jest tests
walterra Aug 25, 2023
6beaef4
fix i18n
walterra Aug 25, 2023
b4da48b
error modal
walterra Aug 25, 2023
06042c7
migrate to updated toMountPoint
walterra Aug 25, 2023
c4d1811
linting
walterra Aug 25, 2023
ed56944
tweak react-query default settings
walterra Aug 25, 2023
cc7426d
move useRefreshTransformList to hooks folder
walterra Aug 25, 2023
95ff5c0
remove ununused code. tweak empty list state
walterra Aug 25, 2023
1c4c3c2
adds retry button to warning callout for no transform nodes.
walterra Aug 25, 2023
4ce9526
fix jest test
walterra Aug 25, 2023
9319b13
Merge branch 'main' into ml-transform-fix-transform-list-reload
walterra Aug 28, 2023
04aa299
Merge branch 'main' into ml-transform-fix-transform-list-reload
walterra Aug 28, 2023
07212e8
Merge branch 'main' into ml-transform-fix-transform-list-reload
walterra Aug 30, 2023
d7db6af
Merge branch 'main' into ml-transform-fix-transform-list-reload
walterra Aug 31, 2023
f25ea75
add null checks
walterra Aug 31, 2023
c6b72a6
cleanup types
walterra Aug 31, 2023
ee46ca2
fix passing on populated fields
walterra Aug 31, 2023
1fa7a2e
refactor useCreateTransform for consistency
walterra Aug 31, 2023
493f52d
move fetching transform nodes to its own hook
walterra Aug 31, 2023
9b02239
refactor EuiPageContent_Deprecated
walterra Aug 31, 2023
a47947c
revert space after preview text
walterra Aug 31, 2023
4efc4bd
tweak capabilities checks
walterra Aug 31, 2023
0a26daf
fix i18n
walterra Aug 31, 2023
279e526
fix handling options default
walterra Aug 31, 2023
534ac1f
Merge branch 'main' into ml-transform-fix-transform-list-reload
walterra Aug 31, 2023
28aeedd
Merge branch 'main' into ml-transform-fix-transform-list-reload
walterra Sep 1, 2023
f0e555f
fix populated fields cleanup
walterra Sep 1, 2023
0a73faa
Merge branch 'main' into ml-transform-fix-transform-list-reload
walterra Sep 1, 2023
6144781
Merge branch 'main' into ml-transform-fix-transform-list-reload
walterra Sep 1, 2023
2091a57
Merge branch 'main' into ml-transform-fix-transform-list-reload
walterra Sep 1, 2023
d10bdb9
Merge branch 'main' into ml-transform-fix-transform-list-reload
walterra Sep 1, 2023
ecedbad
Merge branch 'main' into ml-transform-fix-transform-list-reload
walterra Sep 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
return mutate only instead of whole mutation from custom hooks
walterra committed Aug 24, 2023
commit 70a8d63ca4b86bb2d50eb0a397b1bdb134dfe9a5
Original file line number Diff line number Diff line change
@@ -60,5 +60,5 @@ export const useCreateTransform = (
},
});

return mutation;
return mutation.mutate;
};
Original file line number Diff line number Diff line change
@@ -211,5 +211,5 @@ export const useDeleteTransforms = () => {
},
});

return mutation;
return mutation.mutate;
};
Original file line number Diff line number Diff line change
@@ -77,5 +77,5 @@ export const useReauthorizeTransforms = () => {
},
});

return mutation;
return mutation.mutate;
};
Original file line number Diff line number Diff line change
@@ -78,5 +78,5 @@ export const useResetTransforms = () => {
},
});

return mutation;
return mutation.mutate;
};
Original file line number Diff line number Diff line change
@@ -78,5 +78,5 @@ export const useScheduleNowTransforms = () => {
},
});

return mutation;
return mutation.mutate;
};
Original file line number Diff line number Diff line change
@@ -70,5 +70,5 @@ export const useStartTransforms = () => {
},
});

return mutation;
return mutation.mutate;
};
Original file line number Diff line number Diff line change
@@ -66,5 +66,5 @@ export const useStopTransforms = () => {
},
});

return mutation;
return mutation.mutate;
};
Original file line number Diff line number Diff line change
@@ -36,5 +36,5 @@ export const useUpdateTransform = (
onSuccess: () => refreshTransformList(),
});

return mutation;
return mutation.mutate;
};
Original file line number Diff line number Diff line change
@@ -123,8 +123,8 @@ export const StepCreateForm: FC<StepCreateFormProps> = React.memo(
}, [created, started, dataViewId]);

const { overlays, theme } = useAppDependencies();
const { mutate: startTransforms } = useStartTransforms();
const { mutate: createTransform } = useCreateTransform(transformId, transformConfig);
const startTransforms = useStartTransforms();
const createTransform = useCreateTransform(transformId, transformConfig);

function createTransformHandler(startAfterCreation = false) {
setLoading(true);
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ export type DeleteAction = ReturnType<typeof useDeleteAction>;
export const useDeleteAction = (forceDisable: boolean) => {
const { canDeleteTransform } = useAuthorization().capabilities;

const { mutate: deleteTransforms } = useDeleteTransforms();
const deleteTransforms = useDeleteTransforms();

const [isModalVisible, setModalVisible] = useState(false);
const [items, setItems] = useState<TransformListRow[]>([]);
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ export type ReauthorizeAction = ReturnType<typeof useReauthorizeAction>;
export const useReauthorizeAction = (forceDisable: boolean, transformNodes: number) => {
const { canStartStopTransform } = useAuthorization().capabilities;

const { mutate: reauthorizeTransforms } = useReauthorizeTransforms();
const reauthorizeTransforms = useReauthorizeTransforms();

const [isModalVisible, setModalVisible] = useState(false);
const [items, setItems] = useState<TransformListRow[]>([]);
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ export type ResetAction = ReturnType<typeof useResetAction>;
export const useResetAction = (forceDisable: boolean) => {
const { canResetTransform } = useAuthorization().capabilities;

const { mutate: resetTransforms } = useResetTransforms();
const resetTransforms = useResetTransforms();

const [isModalVisible, setModalVisible] = useState(false);
const [items, setItems] = useState<TransformListRow[]>([]);
Original file line number Diff line number Diff line change
@@ -22,8 +22,7 @@ import {
export type ScheduleNowAction = ReturnType<typeof useScheduleNowAction>;
export const useScheduleNowAction = (forceDisable: boolean, transformNodes: number) => {
const { canScheduleNowTransform } = useAuthorization().capabilities;

const { mutate: scheduleNowTransforms } = useScheduleNowTransforms();
const scheduleNowTransforms = useScheduleNowTransforms();

const action: TransformListAction = useMemo(
() => ({
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ export type StartAction = ReturnType<typeof useStartAction>;
export const useStartAction = (forceDisable: boolean, transformNodes: number) => {
const { canStartStopTransform } = useAuthorization().capabilities;

const { mutate: startTransforms } = useStartTransforms();
const startTransforms = useStartTransforms();

const [isModalVisible, setModalVisible] = useState(false);
const [items, setItems] = useState<TransformListRow[]>([]);
Original file line number Diff line number Diff line change
@@ -16,20 +16,17 @@ export type StopAction = ReturnType<typeof useStopAction>;

export const useStopAction = (forceDisable: boolean) => {
const { canStartStopTransform } = useAuthorization().capabilities;

const { mutate: stopTransforms } = useStopTransforms();
const stopTransforms = useStopTransforms();
const [isModalVisible, setModalVisible] = useState(false);
const [items, setItems] = useState<TransformListRow[]>([]);

const closeModal = () => setModalVisible(false);

const openModal = (newItems: TransformListRow[]) => {
if (Array.isArray(newItems)) {
setItems(newItems);
setModalVisible(true);
}
};

const stopAndCloseModal = useCallback(
(transformSelection: TransformListRow[]) => {
setModalVisible(false);
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ export const EditTransformUpdateButton: FC<EditTransformUpdateButtonProps> = ({
const config = useEditTransformFlyout('config');
const { apiError } = useEditTransformFlyout('actions');

const { mutate: updateTransfrom } = useUpdateTransform(config.id, requestConfig);
const updateTransfrom = useUpdateTransform(config.id, requestConfig);

async function submitFormHandler() {
apiError(undefined);
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ import {
export const TransformManagement: FC = () => {
const { esTransform } = useDocumentationLinks();

const { mutate: deleteTransforms } = useDeleteTransforms();
const deleteTransforms = useDeleteTransforms();

const {
isInitialLoading,