feat: backup schedule creation form

This commit is contained in:
Nicolas Meienberger
2025-10-28 22:34:56 +01:00
parent 37a22b260f
commit d1c1adaba7
14 changed files with 746 additions and 610 deletions

View File

@@ -28,6 +28,7 @@ import {
deleteBackupSchedule,
getBackupSchedule,
updateBackupSchedule,
getBackupScheduleForVolume,
runBackupNow,
} from "../sdk.gen";
import { queryOptions, type UseMutationOptions, type DefaultError } from "@tanstack/react-query";
@@ -73,6 +74,7 @@ import type {
GetBackupScheduleData,
UpdateBackupScheduleData,
UpdateBackupScheduleResponse,
GetBackupScheduleForVolumeData,
RunBackupNowData,
RunBackupNowResponse,
} from "../types.gen";
@@ -842,6 +844,27 @@ export const updateBackupScheduleMutation = (
return mutationOptions;
};
export const getBackupScheduleForVolumeQueryKey = (options: Options<GetBackupScheduleForVolumeData>) =>
createQueryKey("getBackupScheduleForVolume", options);
/**
* Get a backup schedule for a specific volume
*/
export const getBackupScheduleForVolumeOptions = (options: Options<GetBackupScheduleForVolumeData>) => {
return queryOptions({
queryFn: async ({ queryKey, signal }) => {
const { data } = await getBackupScheduleForVolume({
...options,
...queryKey[0],
signal,
throwOnError: true,
});
return data;
},
queryKey: getBackupScheduleForVolumeQueryKey(options),
});
};
export const runBackupNowQueryKey = (options: Options<RunBackupNowData>) => createQueryKey("runBackupNow", options);
/**