@@ -220,18 +224,22 @@ watch(data, () => updateVariantPrioPresetsDebounced(), { deep: true })
Move Up
Move Down
@@ -243,15 +251,26 @@ watch(data, () => updateVariantPrioPresetsDebounced(), { deep: true })
Enabled:
- {{ data.variant_prio_enabled ? 'Yes' : 'No' }}
+ {{
+ presetsVariantPrioRetrieveRes.data.value?.variant_prio_enabled
+ ? 'Yes'
+ : 'No'
+ }}
Services/Algorithms:
-
+
N/A
-
+
{{ service.name }} ({{ service.version }})
diff --git a/frontend/src/seqvars/components/PresetsEditor/PresetsEditor.vue b/frontend/src/seqvars/components/PresetsEditor/PresetsEditor.vue
index b84da9d2b..8e4a74b8d 100644
--- a/frontend/src/seqvars/components/PresetsEditor/PresetsEditor.vue
+++ b/frontend/src/seqvars/components/PresetsEditor/PresetsEditor.vue
@@ -34,7 +34,6 @@ const emit = defineEmits<{
:project-uuid="projectUuid"
:preset-set="presetSet"
:preset-set-version="presetSetVersion"
- class="mt-3"
@message="emit('message', $event)"
/>
@@ -42,7 +41,6 @@ const emit = defineEmits<{
:project-uuid="projectUuid"
:preset-set="presetSet"
:preset-set-version="presetSetVersion"
- class="mt-3"
@message="emit('message', $event)"
/>
diff --git a/frontend/src/seqvars/components/PresetsEditor/QueryPresetsEditor.vue b/frontend/src/seqvars/components/PresetsEditor/QueryPresetsEditor.vue
index 9fe17b828..789b6189e 100644
--- a/frontend/src/seqvars/components/PresetsEditor/QueryPresetsEditor.vue
+++ b/frontend/src/seqvars/components/PresetsEditor/QueryPresetsEditor.vue
@@ -1,6 +1,6 @@
@@ -398,7 +522,7 @@ watch(
@@ -462,8 +588,9 @@ watch(
{{
- getEditableStateLabel(
- seqvarsPresetsStore.getEditableState(presetSetVersion),
- )
+ selectedPresetsSetVersion === undefined
+ ? '-'
+ : getEditableStateLabel(
+ getEditableState(selectedPresetsSetVersion),
+ )
}}
@@ -680,7 +812,7 @@ watch(
Discard Presets Version
-
+
Confirm to discard the presets version.
diff --git a/frontend/src/seqvars/components/PresetsEditor/lib/utils.ts b/frontend/src/seqvars/components/PresetsEditor/lib/utils.ts
index 71a61a4b6..3ad601ef5 100644
--- a/frontend/src/seqvars/components/PresetsEditor/lib/utils.ts
+++ b/frontend/src/seqvars/components/PresetsEditor/lib/utils.ts
@@ -149,3 +149,13 @@ export const parseGenomeRegion = (text: string): GenomeRegion => {
// Otherwise, we are good.
return { chromosome, range: { start, stop } }
}
+
+/** Helper that parses the given string to an int or to null if empty. */
+export const parseToIntOrNull = (text: string): number | null => {
+ return text === '' ? null : parseInt(text, 10)
+}
+
+/** Helper that parses the given string to a float or to null if empty. */
+export const parseToFloatOrNull = (text: string): number | null => {
+ return text === '' ? null : parseFloat(text)
+}
diff --git a/frontend/src/seqvars/components/QueryEditor/FrequencyControlsRow.vue b/frontend/src/seqvars/components/QueryEditor/FrequencyControlsRow.vue
index 605cddb82..916f35cf2 100644
--- a/frontend/src/seqvars/components/QueryEditor/FrequencyControlsRow.vue
+++ b/frontend/src/seqvars/components/QueryEditor/FrequencyControlsRow.vue
@@ -80,7 +80,7 @@ const applyMutation = async (
type="checkbox"
@change="
async () => {
- applyMutation({
+ await applyMutation({
...modelValue.settings.frequency[db],
enabled: !modelValue.settings.frequency[db]!.enabled,
})
diff --git a/frontend/src/seqvars/queries/seqvarQueryPresetSet.ts b/frontend/src/seqvars/queries/seqvarQueryPresetSet.ts
new file mode 100644
index 000000000..cc1619ccf
--- /dev/null
+++ b/frontend/src/seqvars/queries/seqvarQueryPresetSet.ts
@@ -0,0 +1,239 @@
+/**
+ * Queries for seqvars query presets sets and related powered by TanStack Query.
+ */
+import {
+ QueryClient,
+ useMutation,
+ useQuery,
+ useQueryClient,
+} from '@tanstack/vue-query'
+import { SeqvarsApiQuerypresetssetUpdateData } from '@varfish-org/varfish-api/lib'
+import {
+ seqvarsApiQuerypresetssetCopyFromCreateMutation,
+ seqvarsApiQuerypresetssetDestroyMutation,
+ seqvarsApiQuerypresetssetListOptions,
+ seqvarsApiQuerypresetssetRetrieveOptions,
+ seqvarsApiQuerypresetssetUpdateMutation,
+} from '@varfish-org/varfish-api/lib/@tanstack/vue-query.gen'
+import { deepmergeCustom } from 'deepmerge-ts'
+import { MaybeRefOrGetter, toValue } from 'vue'
+
+/**
+ * Helper to invalidate query keys for lists and retrieval for a single query presets set
+ *
+ * @param queryClient Query client to use.
+ * @param project UUID of the project.
+ * @param querypresetsset UUID of the query presets set, optional.
+ * @param destroy Whether to destroy the query instead of invalidating it.
+ */
+const invalidateSeqvarQueryPresetsSetKeys = (
+ queryClient: QueryClient,
+ {
+ project,
+ querypresetsset,
+ }: {
+ project: string
+ querypresetsset?: string
+ },
+ { destroy }: { destroy?: boolean } = { destroy: false },
+) => {
+ queryClient.invalidateQueries({
+ queryKey: seqvarsApiQuerypresetssetListOptions({ path: { project } })
+ .queryKey,
+ })
+ if (querypresetsset !== undefined) {
+ const arg = {
+ queryKey: seqvarsApiQuerypresetssetRetrieveOptions({
+ path: {
+ project,
+ querypresetsset,
+ },
+ }).queryKey,
+ }
+ if (destroy) {
+ queryClient.removeQueries(arg)
+ } else {
+ queryClient.invalidateQueries(arg)
+ }
+ }
+}
+
+// NB: for some reason, the infinite query feature does not work here :(
+/**
+ * Query for a list of seqvar query presets sets within a project.
+ *
+ * Uses the list API of TanStack Query.
+ *
+ * The objects returned when listed are fairly flat and contain UUIDs to
+ * related objects.
+ *
+ * @param projectUuid UUID of the project to load preset sets for.
+ * @returns Query result with pages of presets sets.
+ */
+export const useSeqvarQueryPresetsSetListQuery = ({
+ projectUuid,
+}: {
+ projectUuid: MaybeRefOrGetter
+}) => {
+ return useQuery({
+ ...seqvarsApiQuerypresetssetListOptions({
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ path: { project: () => toValue(projectUuid)! },
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ query: () => ({
+ page: 1,
+ page_size: 100,
+ }),
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () => !!toValue(projectUuid),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ getNextPageParam: (lastPage) => lastPage.next,
+ })
+}
+
+/**
+ * Query for a single seqvar query presets set details within a project.
+ *
+ * The objects returned when retrieved are more nested and contain the actual
+ * data.
+ *
+ * @param projectUuid
+ * UUID of the project that contains the presets sets.
+ * @param seqvarQueryUuid UUID of the seqvar presets sets to load.
+ */
+export const useSeqvarQueryPresetsSetRetrieveQuery = ({
+ projectUuid,
+ presetsSetUuid,
+}: {
+ projectUuid: MaybeRefOrGetter
+ presetsSetUuid: MaybeRefOrGetter
+}) =>
+ useQuery({
+ ...seqvarsApiQuerypresetssetRetrieveOptions({
+ path: {
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ project: () => toValue(projectUuid)!,
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetsset: () => toValue(presetsSetUuid)!,
+ },
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () => !!toValue(projectUuid) && !!toValue(presetsSetUuid),
+ })
+
+// /**
+// * Query for a list of seqvar query presets sets within a project.
+// *
+// * @param projectUuid UUID of the project to load queries for.
+// * @param presetsSetsUuids UUIDs of the seqvar queries to load.
+// * @returns Query result with page of seqvars queries.
+// */
+// export const useSeqvarQueryPresetsSetRetrieveQueries = ({
+// projectUuid,
+// presetsSetUuids,
+// }: {
+// projectUuid: MaybeRefOrGetter
+// presetsSetUuids: MaybeRefOrGetter
+// }) =>
+// useQueries({
+// queries: computed(() =>
+// (toValue(presetsSetUuids) ?? []).map((presetsSetUuid) => ({
+// ...seqvarsApiQuerypresetssetRetrieveOptions({
+// path: {
+// project: toValue(projectUuid)!,
+// querypresetsset: presetsSetUuid,
+// },
+// }),
+// enabled: () =>
+// !!toValue(projectUuid) && !!toValue(presetsSetUuid)?.length,
+// })),
+// ),
+// // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+// combine: (results) => {
+// return {
+// data: results
+// .map((result) => result.data)
+// .filter((data) => data !== undefined),
+// pending: results.some((result) => result.isPending),
+// }
+// },
+// })
+
+/**
+ * Mutation for copying a `SeqvarsQueryPresetSet` object.
+ */
+export const useSeqvarQueryPresetsSetCopyFromMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetssetCopyFromCreateMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarQueryPresetsSetKeys(queryClient, context.path)
+ },
+ })
+}
+
+/**
+ * Mutation for updating a `SeqvarsQueryPresetSet` object.
+ */
+export const useSeqvarQueryPresetsSetUpdateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetssetUpdateMutation(),
+ // Perform optimistic updates but prepare rollback by snapshotting the data.
+ onMutate: async (data: SeqvarsApiQuerypresetssetUpdateData) => {
+ // Cancel any outgoing refetches to prevent optimistic updates.
+ const queryKey = seqvarsApiQuerypresetssetRetrieveOptions({
+ path: data.path,
+ }).queryKey
+ await queryClient.cancelQueries({ queryKey })
+ // Snapshot the previous value.
+ const previousValue = queryClient.getQueryData(queryKey)
+ // Optimistically update to the new value.
+ const newValue =
+ previousValue === undefined
+ ? undefined
+ : deepmergeCustom({ mergeArrays: false })(previousValue, data.body)
+ queryClient.setQueryData(queryKey, newValue)
+ // Return a context with the previous and new data.
+ return { previousValue, newValue }
+ },
+ // If the mutation fails, rollback with context we returned above.
+ onError: (_err, variables, context) => {
+ if (!!context?.previousValue) {
+ queryClient.setQueryData(
+ seqvarsApiQuerypresetssetRetrieveOptions({ path: variables.path })
+ .queryKey,
+ context.previousValue,
+ )
+ }
+ },
+ // Always refetch after error or success.
+ onSettled: (data) => {
+ if (!!data) {
+ // Refetch after success or error.
+ invalidateSeqvarQueryPresetsSetKeys(queryClient, {
+ project: data.project,
+ querypresetsset: data.sodar_uuid,
+ })
+ }
+ },
+ })
+}
+
+/**
+ * Mutation for the deletion of a `SeqvarsQueryPresetSet` object.
+ */
+export const useSeqvarQueryPresetsSetDestroyMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetssetDestroyMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarQueryPresetsSetKeys(queryClient, context.path, {
+ destroy: true,
+ })
+ },
+ })
+}
diff --git a/frontend/src/seqvars/queries/seqvarQueryPresetSetVersion.ts b/frontend/src/seqvars/queries/seqvarQueryPresetSetVersion.ts
new file mode 100644
index 000000000..6a477f632
--- /dev/null
+++ b/frontend/src/seqvars/queries/seqvarQueryPresetSetVersion.ts
@@ -0,0 +1,324 @@
+/**
+ * Queries for seqvars query presets set versions and related powered by TanStack Query.
+ */
+import {
+ QueryClient,
+ useMutation,
+ useQueries,
+ useQuery,
+ useQueryClient,
+} from '@tanstack/vue-query'
+import {
+ SeqvarsApiQuerypresetssetversionUpdateData,
+ SeqvarsQueryPresetsSetVersionDetails,
+} from '@varfish-org/varfish-api/lib'
+import {
+ seqvarsApiQuerypresetssetversionCopyFromCreateMutation,
+ seqvarsApiQuerypresetssetversionDestroyMutation,
+ seqvarsApiQuerypresetssetversionListOptions,
+ seqvarsApiQuerypresetssetversionRetrieveOptions,
+ seqvarsApiQuerypresetssetversionUpdateMutation,
+} from '@varfish-org/varfish-api/lib/@tanstack/vue-query.gen'
+import { deepmerge } from 'deepmerge-ts'
+import { MaybeRefOrGetter, computed, toValue } from 'vue'
+
+/**
+ * Enumeration for preset set version states.
+ */
+export enum PresetSetVersionState {
+ ACTIVE = 'active',
+ DRAFT = 'draft',
+ RETIRED = 'retired',
+}
+
+/**
+ * Enumerations for representing that a presets version is editable or the reason
+ * why it is not.
+ */
+export enum EditableState {
+ EDITABLE,
+ IS_ACTIVE,
+ IS_RETIRED,
+ IS_FACTORY_DEFAULT,
+ IS_NOT_SET,
+}
+
+/**
+ * Return user-readable string for the editable state.
+ */
+export const getEditableStateLabel = (state: EditableState): string => {
+ let token = ''
+ switch (state) {
+ case EditableState.EDITABLE:
+ return (
+ 'This preset set version is in draft state and thus editable. ' +
+ 'You will need to activate it to make it useable in queries.'
+ )
+ case EditableState.IS_FACTORY_DEFAULT:
+ return (
+ 'This preset set version is a factory default. You can clone ' +
+ 'the whole preset sets and make changes to the clone.'
+ )
+ case EditableState.IS_ACTIVE:
+ token = 'active'
+ break
+ case EditableState.IS_RETIRED:
+ token = 'retired'
+ break
+ case EditableState.IS_NOT_SET:
+ return 'Preset set is currently unset.'
+ }
+ return (
+ `This preset set version is ${token} and thus not editable. ` +
+ 'You need to create a new draft version, make changes there, ' +
+ 'and then activate it to make it useable in queries.'
+ )
+}
+
+/** Helper for obtaining editable state from a presets set version. */
+export const getEditableState = (
+ version: SeqvarsQueryPresetsSetVersionDetails,
+) => {
+ if (version === undefined) {
+ return EditableState.IS_NOT_SET
+ } else if (version.presetsset.is_factory_default) {
+ return EditableState.IS_FACTORY_DEFAULT
+ } else if (version.status === PresetSetVersionState.ACTIVE) {
+ return EditableState.IS_ACTIVE
+ } else if (version.status === PresetSetVersionState.RETIRED) {
+ return EditableState.IS_RETIRED
+ } else {
+ return EditableState.EDITABLE
+ }
+}
+
+/**
+ * Helper to invalidate query keys for lists and retrieval for a single query presets set version.
+ *
+ * @param queryClient Query client to use.
+ * @param querypresetsset UUID of the query presets set.
+ * @param querypresetssetversion UUID of the query presets set version, optional.
+ * @param destroy Whether to destroy the query instead of invalidating it.
+ */
+export const invalidateSeqvarQueryPresetsSetVersionKeys = (
+ queryClient: QueryClient,
+ {
+ querypresetsset,
+ querypresetssetversion,
+ }: {
+ querypresetsset: string
+ querypresetssetversion?: string
+ },
+ { destroy }: { destroy?: boolean } = { destroy: false },
+) => {
+ queryClient.invalidateQueries({
+ queryKey: seqvarsApiQuerypresetssetversionListOptions({
+ path: { querypresetsset },
+ }).queryKey,
+ })
+ if (querypresetssetversion !== undefined) {
+ const arg = {
+ queryKey: seqvarsApiQuerypresetssetversionRetrieveOptions({
+ path: {
+ querypresetsset,
+ querypresetssetversion,
+ },
+ }).queryKey,
+ }
+ if (destroy) {
+ queryClient.removeQueries(arg)
+ } else {
+ queryClient.invalidateQueries(arg)
+ }
+ }
+}
+
+// NB: for some reason, the infinite query feature does not work here :(
+/**
+ * Query for a list of seqvar query presets set versions within a presets set.
+ *
+ * Uses the list API of TanStack Query.
+ *
+ * The objects returned when listed are fairly flat and contain UUIDs to
+ * related objects.
+ *
+ * @param presetsSetUuid UUID of the presets set to load presets set versions for.
+ * @returns Query result with page of presets set versions.
+ */
+export const useSeqvarQueryPresetsSetVersionListQuery = ({
+ presetsSetUuid,
+}: {
+ presetsSetUuid: MaybeRefOrGetter
+}) => {
+ return useQuery({
+ ...seqvarsApiQuerypresetssetversionListOptions({
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ path: { querypresetsset: () => toValue(presetsSetUuid)! },
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ query: () => ({
+ page: 1,
+ page_size: 100,
+ }),
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () => !!toValue(presetsSetUuid),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ getNextPageParam: (lastPage) => lastPage.next,
+ })
+}
+
+/**
+ * Query for a single seqvar query presets set details within a presets set.
+ *
+ * The objects returned when retrieved are more nested and contain the actual
+ * data.
+ *
+ * @param presetsSetUuid UUID of the presets set that contains the presets set version.
+ * @param presetsSetVersionUuid UUID of the seqvar presets set version to load.
+ */
+export const useSeqvarQueryPresetsSetVersionRetrieveQuery = ({
+ presetsSetUuid,
+ presetsSetVersionUuid,
+}: {
+ presetsSetUuid: MaybeRefOrGetter
+ presetsSetVersionUuid: MaybeRefOrGetter
+}) =>
+ useQuery({
+ ...seqvarsApiQuerypresetssetversionRetrieveOptions({
+ path: {
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetsset: () => toValue(presetsSetUuid)!,
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetssetversion: () => toValue(presetsSetVersionUuid)!,
+ },
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () =>
+ !!toValue(presetsSetUuid) && !!toValue(presetsSetVersionUuid),
+ })
+
+/**
+ * Query for a list of seqvar query presets set versions within a presets set.
+ *
+ * @param presetsSetUuid UUID of the presets set to load versions for.
+ * @param presetsSetVersionUuids UUIDs of the seqvar querie version to load.
+ * @returns Query result with page of presets set versions.
+ */
+export const useSeqvarQueryPresetsSetVersionRetrieveQueries = ({
+ presetsSetUuid,
+ presetsSetVersionUuids,
+}: {
+ presetsSetUuid: MaybeRefOrGetter
+ presetsSetVersionUuids: MaybeRefOrGetter
+}) =>
+ useQueries({
+ queries: computed(() =>
+ (toValue(presetsSetVersionUuids) ?? []).map(
+ (seqvarQueryPresetsSetUuid) => ({
+ ...seqvarsApiQuerypresetssetversionRetrieveOptions({
+ path: {
+ querypresetsset: toValue(presetsSetUuid)!,
+ querypresetssetversion: seqvarQueryPresetsSetUuid,
+ },
+ }),
+ enabled: () =>
+ !!toValue(presetsSetUuid) &&
+ !!toValue(seqvarQueryPresetsSetUuid)?.length,
+ }),
+ ),
+ ),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ combine: (results) => {
+ return {
+ data: results
+ .map((result) => result.data)
+ .filter((data) => data !== undefined),
+ pending: results.some((result) => result.isPending),
+ }
+ },
+ })
+
+/**
+ * Mutation for the copying a `SeqvarsQueryPresetSetVersion` object.
+ */
+export const useSeqvarQueryPresetsSetVersionCopyFromMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetssetversionCopyFromCreateMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarQueryPresetsSetVersionKeys(queryClient, context.path)
+ },
+ })
+}
+
+/**
+ * Mutation for updating a `SeqvarsQueryPresetSetVersion` object.
+ */
+export const useSeqvarQueryPresetsSetVersionUpdateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetssetversionUpdateMutation(),
+ // Perform optimistic updates but prepare rollback by snapshotting the data.
+ onMutate: async (data: SeqvarsApiQuerypresetssetversionUpdateData) => {
+ // Cancel any outgoing refetches to prevent optimistic updates.
+ const queryKey = seqvarsApiQuerypresetssetversionRetrieveOptions({
+ path: data.path,
+ }).queryKey
+ await queryClient.cancelQueries({ queryKey })
+ // Snapshot the previous value.
+ const previousValue = queryClient.getQueryData(queryKey)
+ // Optimistically update to the new value.
+ //
+ // Note that the explicit case of `data.body` is necessary as we would lose the
+ // server-maintained fields such as `date_created` and `date_modified` otherwise.
+ const newValue =
+ previousValue === undefined && data.body === undefined
+ ? undefined
+ : deepmerge(
+ previousValue,
+ data.body as SeqvarsQueryPresetsSetVersionDetails,
+ )
+ queryClient.setQueryData(queryKey, newValue)
+ // Return a context with the previous and new data.
+ return { previousValue, newValue }
+ },
+ // If the mutation fails, rollback with context we returned above.
+ onError: (_err, variables, context) => {
+ if (!!context?.previousValue) {
+ queryClient.setQueryData(
+ seqvarsApiQuerypresetssetversionRetrieveOptions({
+ path: variables.path,
+ }).queryKey,
+ context.previousValue,
+ )
+ }
+ },
+ // Always refetch after error or success.
+ onSettled: (data) => {
+ if (!!data) {
+ // Refetch after success or error.
+ invalidateSeqvarQueryPresetsSetVersionKeys(queryClient, {
+ querypresetsset: data.presetsset,
+ querypresetssetversion: data.sodar_uuid,
+ })
+ }
+ },
+ })
+}
+
+/**
+ * Mutation for the deletion of a `SeqvarsQueryPresetSetVersion` object.
+ */
+export const useSeqvarQueryPresetsSetVersionDestroyMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetssetversionDestroyMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarQueryPresetsSetVersionKeys(queryClient, context.path, {
+ destroy: true,
+ })
+ },
+ })
+}
diff --git a/frontend/src/seqvars/queries/seqvarQueryPresetsClinvar.ts b/frontend/src/seqvars/queries/seqvarQueryPresetsClinvar.ts
new file mode 100644
index 000000000..d9739d854
--- /dev/null
+++ b/frontend/src/seqvars/queries/seqvarQueryPresetsClinvar.ts
@@ -0,0 +1,210 @@
+/**
+ * Queries for seqvars query clinvar presets powered by TanStack Query.
+ */
+import {
+ QueryClient,
+ useMutation,
+ useQuery,
+ useQueryClient,
+} from '@tanstack/vue-query'
+import {
+ SeqvarsApiQuerypresetsclinvarUpdateData,
+ SeqvarsQueryPresetsClinvar,
+} from '@varfish-org/varfish-api/lib'
+import {
+ seqvarsApiQuerypresetsclinvarCreateMutation,
+ seqvarsApiQuerypresetsclinvarDestroyMutation,
+ seqvarsApiQuerypresetsclinvarListOptions,
+ seqvarsApiQuerypresetsclinvarRetrieveOptions,
+ seqvarsApiQuerypresetsclinvarUpdateMutation,
+} from '@varfish-org/varfish-api/lib/@tanstack/vue-query.gen'
+import { deepmerge } from 'deepmerge-ts'
+import { MaybeRefOrGetter, toValue } from 'vue'
+
+/**
+ * Helper to invalidate query keys for lists and retrieval for a single query clinvar presets.
+ *
+ * @param queryClient Query client to use.
+ * @param querypresetssetversion UUID of the query presets set version.
+ * @param querypresetsclinvar UUID of the query clinvar presets.
+ * @param destroy Whether to destroy the presets instead of invalidating it.
+ */
+const invalidateSeqvarsQueryPresetsClinvarKeys = (
+ queryClient: QueryClient,
+ {
+ querypresetssetversion,
+ querypresetsclinvar,
+ }: {
+ querypresetssetversion: string
+ querypresetsclinvar?: string
+ },
+ { destroy }: { destroy?: boolean } = { destroy: false },
+) => {
+ // Below, is the code for invalidating the clinvar prests.
+ queryClient.invalidateQueries({
+ queryKey: seqvarsApiQuerypresetsclinvarListOptions({
+ path: { querypresetssetversion },
+ }).queryKey,
+ })
+ if (querypresetsclinvar !== undefined) {
+ const arg = {
+ queryKey: seqvarsApiQuerypresetsclinvarRetrieveOptions({
+ path: {
+ querypresetssetversion,
+ querypresetsclinvar,
+ },
+ }).queryKey,
+ }
+ if (destroy) {
+ queryClient.removeQueries(arg)
+ } else {
+ queryClient.invalidateQueries(arg)
+ }
+ }
+}
+
+/**
+ * Query for a list of seqvar query clinvar presets sets within a presets set version.
+ *
+ * Uses the list API of TanStack Query.
+ *
+ * Note that the listed objects are identical to the ones returned for a single
+ * retrieve (there is no `*Details` variant, only the slimmer `*Request` one).
+ *
+ * @param querypresetssetversion UUID of the presets set version.
+ * @returns Query result with pages of clinvar presets.
+ */
+export const useSeqvarsQueryPresetsClinvarListQuery = ({
+ projectUuid,
+}: {
+ projectUuid: MaybeRefOrGetter
+}) => {
+ return useQuery({
+ ...seqvarsApiQuerypresetsclinvarListOptions({
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ path: { project: () => toValue(projectUuid)! },
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ query: () => ({
+ page: 1,
+ page_size: 100,
+ }),
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () => !!toValue(projectUuid),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ getNextPageParam: (lastPage) => lastPage.next,
+ })
+}
+
+/**
+ * Query for a single seqvar query clinvar presets set details within a presets set version.
+ *
+ * Note that the listed objects are identical to the ones returned for a single
+ * retrieve (there is no `*Details` variant, only the slimmer `*Request` one).
+ *
+ * @param presetsSetVersionUuid
+ * UUID of the presets set version that contains the clinvar preset.
+ * @param presetsClinvarUuid UUID of the clinvar presets to load.
+ */
+export const useSeqvarsQueryPresetsClinvarRetrieveQuery = ({
+ presetsSetVersionUuid,
+ presetsClinvarUuid,
+}: {
+ presetsSetVersionUuid: MaybeRefOrGetter
+ presetsClinvarUuid: MaybeRefOrGetter
+}) =>
+ useQuery({
+ ...seqvarsApiQuerypresetsclinvarRetrieveOptions({
+ path: {
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetssetversion: () => toValue(presetsSetVersionUuid)!,
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetsclinvar: () => toValue(presetsClinvarUuid)!,
+ },
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () =>
+ !!toValue(presetsSetVersionUuid) && !!toValue(presetsClinvarUuid),
+ })
+
+/**
+ * Mutation for creating a `SeqvarsQueryPresetsClinvar` object.
+ */
+export const useSeqvarsQueryPresetsClinvarCreateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetsclinvarCreateMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsClinvarKeys(queryClient, context.path)
+ },
+ })
+}
+
+/**
+ * Mutation for updating a `SeqvarsQueryPresetsClinvar` object.
+ */
+export const useSeqvarsQueryPresetsClinvarUpdateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetsclinvarUpdateMutation(),
+ // Perform optimistic updates but prepare rollback by snapshotting the data.
+ onMutate: async (data: SeqvarsApiQuerypresetsclinvarUpdateData) => {
+ // Cancel any outgoing refetches to prevent optimistic updates.
+ const queryKey = seqvarsApiQuerypresetsclinvarRetrieveOptions({
+ path: data.path,
+ }).queryKey
+ await queryClient.cancelQueries({ queryKey })
+ // Snapshot the previous value.
+ const previousValue = queryClient.getQueryData(queryKey)
+ // Optimistically update to the new value.
+ //
+ // Note that the explicit case of `data.body` is necessary as we would lose the
+ // server-maintained fields such as `date_created` and `date_modified` otherwise.
+ const newValue =
+ previousValue === undefined && data.body === undefined
+ ? undefined
+ : deepmerge(previousValue, data.body as SeqvarsQueryPresetsClinvar)
+ queryClient.setQueryData(queryKey, newValue)
+ // Return a context with the previous and new data.
+ return { previousValue, newValue }
+ },
+ // If the mutation fails, rollback with context we returned above.
+ onError: (_err, variables, context) => {
+ if (!!context?.previousValue) {
+ queryClient.setQueryData(
+ seqvarsApiQuerypresetsclinvarRetrieveOptions({
+ path: variables.path,
+ }).queryKey,
+ context.previousValue,
+ )
+ }
+ },
+ // Always refetch after error or success.
+ onSettled: (data) => {
+ if (!!data) {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsClinvarKeys(queryClient, {
+ querypresetssetversion: data.presetssetversion,
+ querypresetsclinvar: data.sodar_uuid,
+ })
+ }
+ },
+ })
+}
+
+/**
+ * Mutation for the deletion of a `SeqvarsQueryPresetsClinvar` object.
+ */
+export const useSeqvarsQueryPresetsClinvarDestroyMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetsclinvarDestroyMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsClinvarKeys(queryClient, context.path, {
+ destroy: true,
+ })
+ },
+ })
+}
diff --git a/frontend/src/seqvars/queries/seqvarQueryPresetsColumns.ts b/frontend/src/seqvars/queries/seqvarQueryPresetsColumns.ts
new file mode 100644
index 000000000..b7cf1c59c
--- /dev/null
+++ b/frontend/src/seqvars/queries/seqvarQueryPresetsColumns.ts
@@ -0,0 +1,210 @@
+/**
+ * Queries for seqvars query columns presets powered by TanStack Query.
+ */
+import {
+ QueryClient,
+ useMutation,
+ useQuery,
+ useQueryClient,
+} from '@tanstack/vue-query'
+import {
+ SeqvarsApiQuerypresetscolumnsUpdateData,
+ SeqvarsQueryPresetsColumns,
+} from '@varfish-org/varfish-api/lib'
+import {
+ seqvarsApiQuerypresetscolumnsCreateMutation,
+ seqvarsApiQuerypresetscolumnsDestroyMutation,
+ seqvarsApiQuerypresetscolumnsListOptions,
+ seqvarsApiQuerypresetscolumnsRetrieveOptions,
+ seqvarsApiQuerypresetscolumnsUpdateMutation,
+} from '@varfish-org/varfish-api/lib/@tanstack/vue-query.gen'
+import { deepmerge } from 'deepmerge-ts'
+import { MaybeRefOrGetter, toValue } from 'vue'
+
+/**
+ * Helper to invalidate query keys for lists and retrieval for a single query columns presets.
+ *
+ * @param queryClient Query client to use.
+ * @param querypresetssetversion UUID of the query presets set version.
+ * @param querypresetscolumns UUID of the query columns presets.
+ * @param destroy Whether to destroy the presets instead of invalidating it.
+ */
+const invalidateSeqvarsQueryPresetsColumnsKeys = (
+ queryClient: QueryClient,
+ {
+ querypresetssetversion,
+ querypresetscolumns,
+ }: {
+ querypresetssetversion: string
+ querypresetscolumns?: string
+ },
+ { destroy }: { destroy?: boolean } = { destroy: false },
+) => {
+ // Below, is the code for invalidating the columns prests.
+ queryClient.invalidateQueries({
+ queryKey: seqvarsApiQuerypresetscolumnsListOptions({
+ path: { querypresetssetversion },
+ }).queryKey,
+ })
+ if (querypresetscolumns !== undefined) {
+ const arg = {
+ queryKey: seqvarsApiQuerypresetscolumnsRetrieveOptions({
+ path: {
+ querypresetssetversion,
+ querypresetscolumns,
+ },
+ }).queryKey,
+ }
+ if (destroy) {
+ queryClient.removeQueries(arg)
+ } else {
+ queryClient.invalidateQueries(arg)
+ }
+ }
+}
+
+/**
+ * Query for a list of seqvar query columns presets sets within a presets set version.
+ *
+ * Uses the list API of TanStack Query.
+ *
+ * Note that the listed objects are identical to the ones returned for a single
+ * retrieve (there is no `*Details` variant, only the slimmer `*Request` one).
+ *
+ * @param querypresetssetversion UUID of the presets set version.
+ * @returns Query result with pages of columns presets.
+ */
+export const useSeqvarsQueryPresetsColumnsListQuery = ({
+ projectUuid,
+}: {
+ projectUuid: MaybeRefOrGetter
+}) => {
+ return useQuery({
+ ...seqvarsApiQuerypresetscolumnsListOptions({
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ path: { project: () => toValue(projectUuid)! },
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ query: () => ({
+ page: 1,
+ page_size: 100,
+ }),
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () => !!toValue(projectUuid),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ getNextPageParam: (lastPage) => lastPage.next,
+ })
+}
+
+/**
+ * Query for a single seqvar query columns presets set details within a presets set version.
+ *
+ * Note that the listed objects are identical to the ones returned for a single
+ * retrieve (there is no `*Details` variant, only the slimmer `*Request` one).
+ *
+ * @param presetsSetVersionUuid
+ * UUID of the presets set version that contains the columns preset.
+ * @param presetsColumnsUuid UUID of the columns presets to load.
+ */
+export const useSeqvarsQueryPresetsColumnsRetrieveQuery = ({
+ presetsSetVersionUuid,
+ presetsColumnsUuid,
+}: {
+ presetsSetVersionUuid: MaybeRefOrGetter
+ presetsColumnsUuid: MaybeRefOrGetter
+}) =>
+ useQuery({
+ ...seqvarsApiQuerypresetscolumnsRetrieveOptions({
+ path: {
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetssetversion: () => toValue(presetsSetVersionUuid)!,
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetscolumns: () => toValue(presetsColumnsUuid)!,
+ },
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () =>
+ !!toValue(presetsSetVersionUuid) && !!toValue(presetsColumnsUuid),
+ })
+
+/**
+ * Mutation for creating a `SeqvarsQueryPresetsColumns` object.
+ */
+export const useSeqvarsQueryPresetsColumnsCreateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetscolumnsCreateMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsColumnsKeys(queryClient, context.path)
+ },
+ })
+}
+
+/**
+ * Mutation for updating a `SeqvarsQueryPresetsColumns` object.
+ */
+export const useSeqvarsQueryPresetsColumnsUpdateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetscolumnsUpdateMutation(),
+ // Perform optimistic updates but prepare rollback by snapshotting the data.
+ onMutate: async (data: SeqvarsApiQuerypresetscolumnsUpdateData) => {
+ // Cancel any outgoing refetches to prevent optimistic updates.
+ const queryKey = seqvarsApiQuerypresetscolumnsRetrieveOptions({
+ path: data.path,
+ }).queryKey
+ await queryClient.cancelQueries({ queryKey })
+ // Snapshot the previous value.
+ const previousValue = queryClient.getQueryData(queryKey)
+ // Optimistically update to the new value.
+ //
+ // Note that the explicit case of `data.body` is necessary as we would lose the
+ // server-maintained fields such as `date_created` and `date_modified` otherwise.
+ const newValue =
+ previousValue === undefined && data.body === undefined
+ ? undefined
+ : deepmerge(previousValue, data.body as SeqvarsQueryPresetsColumns)
+ queryClient.setQueryData(queryKey, newValue)
+ // Return a context with the previous and new data.
+ return { previousValue, newValue }
+ },
+ // If the mutation fails, rollback with context we returned above.
+ onError: (_err, variables, context) => {
+ if (!!context?.previousValue) {
+ queryClient.setQueryData(
+ seqvarsApiQuerypresetscolumnsRetrieveOptions({
+ path: variables.path,
+ }).queryKey,
+ context.previousValue,
+ )
+ }
+ },
+ // Always refetch after error or success.
+ onSettled: (data) => {
+ if (!!data) {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsColumnsKeys(queryClient, {
+ querypresetssetversion: data.presetssetversion,
+ querypresetscolumns: data.sodar_uuid,
+ })
+ }
+ },
+ })
+}
+
+/**
+ * Mutation for the deletion of a `SeqvarsQueryPresetsColumns` object.
+ */
+export const useSeqvarsQueryPresetsColumnsDestroyMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetscolumnsDestroyMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsColumnsKeys(queryClient, context.path, {
+ destroy: true,
+ })
+ },
+ })
+}
diff --git a/frontend/src/seqvars/queries/seqvarQueryPresetsConsequence.ts b/frontend/src/seqvars/queries/seqvarQueryPresetsConsequence.ts
new file mode 100644
index 000000000..979b8d6a0
--- /dev/null
+++ b/frontend/src/seqvars/queries/seqvarQueryPresetsConsequence.ts
@@ -0,0 +1,213 @@
+/**
+ * Queries for seqvars query consequence presets powered by TanStack Query.
+ */
+import {
+ QueryClient,
+ useMutation,
+ useQuery,
+ useQueryClient,
+} from '@tanstack/vue-query'
+import {
+ SeqvarsApiQuerypresetsconsequenceUpdateData,
+ SeqvarsQueryPresetsConsequence,
+} from '@varfish-org/varfish-api/lib'
+import {
+ seqvarsApiQuerypresetsconsequenceCreateMutation,
+ seqvarsApiQuerypresetsconsequenceDestroyMutation,
+ seqvarsApiQuerypresetsconsequenceListOptions,
+ seqvarsApiQuerypresetsconsequenceRetrieveOptions,
+ seqvarsApiQuerypresetsconsequenceUpdateMutation,
+} from '@varfish-org/varfish-api/lib/@tanstack/vue-query.gen'
+import { deepmerge } from 'deepmerge-ts'
+import { MaybeRefOrGetter, toValue } from 'vue'
+
+/**
+ * Helper to invalidate query keys for lists and retrieval for a single query consequence presets.
+ *
+ * @param queryClient Query client to use.
+ * @param querypresetssetversion UUID of the query presets set version.
+ * @param querypresetsconsequence UUID of the query consequence presets.
+ * @param destroy Whether to destroy the presets instead of invalidating it.
+ */
+const invalidateSeqvarsQueryPresetsConsequenceKeys = (
+ queryClient: QueryClient,
+ {
+ querypresetssetversion,
+ querypresetsconsequence,
+ }: {
+ querypresetssetversion: string
+ querypresetsconsequence?: string
+ },
+ { destroy }: { destroy?: boolean } = { destroy: false },
+) => {
+ // Below, is the code for invalidating the consequence prests.
+ queryClient.invalidateQueries({
+ queryKey: seqvarsApiQuerypresetsconsequenceListOptions({
+ path: { querypresetssetversion },
+ }).queryKey,
+ })
+ if (querypresetsconsequence !== undefined) {
+ const arg = {
+ queryKey: seqvarsApiQuerypresetsconsequenceRetrieveOptions({
+ path: {
+ querypresetssetversion,
+ querypresetsconsequence,
+ },
+ }).queryKey,
+ }
+ if (destroy) {
+ queryClient.removeQueries(arg)
+ } else {
+ queryClient.invalidateQueries(arg)
+ }
+ }
+}
+
+/**
+ * Query for a list of seqvar query consequence presets sets within a presets set version.
+ *
+ * Uses the list API of TanStack Query.
+ *
+ * Note that the listed objects are identical to the ones returned for a single
+ * retrieve (there is no `*Details` variant, only the slimmer `*Request` one).
+ *
+ * @param querypresetssetversion UUID of the presets set version.
+ * @returns Query result with pages of consequence presets.
+ */
+export const useSeqvarsQueryPresetsConsequenceListQuery = ({
+ projectUuid,
+}: {
+ projectUuid: MaybeRefOrGetter
+}) => {
+ return useQuery({
+ ...seqvarsApiQuerypresetsconsequenceListOptions({
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ path: { project: () => toValue(projectUuid)! },
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ query: () => ({
+ page: 1,
+ page_size: 100,
+ }),
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () => !!toValue(projectUuid),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ getNextPageParam: (lastPage) => lastPage.next,
+ })
+}
+
+/**
+ * Query for a single seqvar query consequence presets set details within a presets set version.
+ *
+ * Note that the listed objects are identical to the ones returned for a single
+ * retrieve (there is no `*Details` variant, only the slimmer `*Request` one).
+ *
+ * @param presetsSetVersionUuid
+ * UUID of the presets set version that contains the consequence preset.
+ * @param presetsConsequenceUuid UUID of the consequence presets to load.
+ */
+export const useSeqvarsQueryPresetsConsequenceRetrieveQuery = ({
+ presetsSetVersionUuid,
+ presetsConsequenceUuid,
+}: {
+ presetsSetVersionUuid: MaybeRefOrGetter
+ presetsConsequenceUuid: MaybeRefOrGetter
+}) =>
+ useQuery({
+ ...seqvarsApiQuerypresetsconsequenceRetrieveOptions({
+ path: {
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetssetversion: () => toValue(presetsSetVersionUuid)!,
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetsconsequence: () => toValue(presetsConsequenceUuid)!,
+ },
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () =>
+ !!toValue(presetsSetVersionUuid) && !!toValue(presetsConsequenceUuid),
+ })
+
+/**
+ * Mutation for creating a `SeqvarsQueryPresetsConsequence` object.
+ */
+export const useSeqvarsQueryPresetsConsequenceCreateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetsconsequenceCreateMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsConsequenceKeys(queryClient, context.path)
+ },
+ })
+}
+
+/**
+ * Mutation for updating a `SeqvarsQueryPresetsConsequence` object.
+ */
+export const useSeqvarsQueryPresetsConsequenceUpdateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetsconsequenceUpdateMutation(),
+ // Perform optimistic updates but prepare rollback by snapshotting the data.
+ onMutate: async (data: SeqvarsApiQuerypresetsconsequenceUpdateData) => {
+ // Cancel any outgoing refetches to prevent optimistic updates.
+ const queryKey = seqvarsApiQuerypresetsconsequenceRetrieveOptions({
+ path: data.path,
+ }).queryKey
+ await queryClient.cancelQueries({ queryKey })
+ // Snapshot the previous value.
+ const previousValue = queryClient.getQueryData(queryKey)
+ // Optimistically update to the new value.
+ //
+ // Note that the explicit case of `data.body` is necessary as we would lose the
+ // server-maintained fields such as `date_created` and `date_modified` otherwise.
+ const newValue =
+ previousValue === undefined && data.body === undefined
+ ? undefined
+ : deepmerge(
+ previousValue,
+ data.body as SeqvarsQueryPresetsConsequence,
+ )
+ queryClient.setQueryData(queryKey, newValue)
+ // Return a context with the previous and new data.
+ return { previousValue, newValue }
+ },
+ // If the mutation fails, rollback with context we returned above.
+ onError: (_err, variables, context) => {
+ if (!!context?.previousValue) {
+ queryClient.setQueryData(
+ seqvarsApiQuerypresetsconsequenceRetrieveOptions({
+ path: variables.path,
+ }).queryKey,
+ context.previousValue,
+ )
+ }
+ },
+ // Always refetch after error or success.
+ onSettled: (data) => {
+ if (!!data) {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsConsequenceKeys(queryClient, {
+ querypresetssetversion: data.presetssetversion,
+ querypresetsconsequence: data.sodar_uuid,
+ })
+ }
+ },
+ })
+}
+
+/**
+ * Mutation for the deletion of a `SeqvarsQueryPresetsConsequence` object.
+ */
+export const useSeqvarsQueryPresetsConsequenceDestroyMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetsconsequenceDestroyMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsConsequenceKeys(queryClient, context.path, {
+ destroy: true,
+ })
+ },
+ })
+}
diff --git a/frontend/src/seqvars/queries/seqvarQueryPresetsFrequency.ts b/frontend/src/seqvars/queries/seqvarQueryPresetsFrequency.ts
new file mode 100644
index 000000000..3e3ef0849
--- /dev/null
+++ b/frontend/src/seqvars/queries/seqvarQueryPresetsFrequency.ts
@@ -0,0 +1,210 @@
+/**
+ * Queries for seqvars query frequency presets powered by TanStack Query.
+ */
+import {
+ QueryClient,
+ useMutation,
+ useQuery,
+ useQueryClient,
+} from '@tanstack/vue-query'
+import {
+ SeqvarsApiQuerypresetsfrequencyUpdateData,
+ SeqvarsQueryPresetsFrequency,
+} from '@varfish-org/varfish-api/lib'
+import {
+ seqvarsApiQuerypresetsfrequencyCreateMutation,
+ seqvarsApiQuerypresetsfrequencyDestroyMutation,
+ seqvarsApiQuerypresetsfrequencyListOptions,
+ seqvarsApiQuerypresetsfrequencyRetrieveOptions,
+ seqvarsApiQuerypresetsfrequencyUpdateMutation,
+} from '@varfish-org/varfish-api/lib/@tanstack/vue-query.gen'
+import { deepmerge } from 'deepmerge-ts'
+import { MaybeRefOrGetter, toValue } from 'vue'
+
+/**
+ * Helper to invalidate query keys for lists and retrieval for a single query frequency presets.
+ *
+ * @param queryClient Query client to use.
+ * @param querypresetssetversion UUID of the query presets set version.
+ * @param querypresetsfrequency UUID of the query frequency presets.
+ * @param destroy Whether to destroy the presets instead of invalidating it.
+ */
+const invalidateSeqvarsQueryPresetsFrequencyKeys = (
+ queryClient: QueryClient,
+ {
+ querypresetssetversion,
+ querypresetsfrequency,
+ }: {
+ querypresetssetversion: string
+ querypresetsfrequency?: string
+ },
+ { destroy }: { destroy?: boolean } = { destroy: false },
+) => {
+ // Below, is the code for invalidating the frequency prests.
+ queryClient.invalidateQueries({
+ queryKey: seqvarsApiQuerypresetsfrequencyListOptions({
+ path: { querypresetssetversion },
+ }).queryKey,
+ })
+ if (querypresetsfrequency !== undefined) {
+ const arg = {
+ queryKey: seqvarsApiQuerypresetsfrequencyRetrieveOptions({
+ path: {
+ querypresetssetversion,
+ querypresetsfrequency,
+ },
+ }).queryKey,
+ }
+ if (destroy) {
+ queryClient.removeQueries(arg)
+ } else {
+ queryClient.invalidateQueries(arg)
+ }
+ }
+}
+
+/**
+ * Query for a list of seqvar query frequency presets sets within a presets set version.
+ *
+ * Uses the list API of TanStack Query.
+ *
+ * Note that the listed objects are identical to the ones returned for a single
+ * retrieve (there is no `*Details` variant, only the slimmer `*Request` one).
+ *
+ * @param querypresetssetversion UUID of the presets set version.
+ * @returns Query result with pages of frequency presets.
+ */
+export const useSeqvarsQueryPresetsFrequencyListQuery = ({
+ projectUuid,
+}: {
+ projectUuid: MaybeRefOrGetter
+}) => {
+ return useQuery({
+ ...seqvarsApiQuerypresetsfrequencyListOptions({
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ path: { project: () => toValue(projectUuid)! },
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ query: () => ({
+ page: 1,
+ page_size: 100,
+ }),
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () => !!toValue(projectUuid),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ getNextPageParam: (lastPage) => lastPage.next,
+ })
+}
+
+/**
+ * Query for a single seqvar query frequency presets set details within a presets set version.
+ *
+ * Note that the listed objects are identical to the ones returned for a single
+ * retrieve (there is no `*Details` variant, only the slimmer `*Request` one).
+ *
+ * @param presetsSetVersionUuid
+ * UUID of the presets set version that contains the frequency preset.
+ * @param presetsFrequencyUuid UUID of the frequency presets to load.
+ */
+export const useSeqvarsQueryPresetsFrequencyRetrieveQuery = ({
+ presetsSetVersionUuid,
+ presetsFrequencyUuid,
+}: {
+ presetsSetVersionUuid: MaybeRefOrGetter
+ presetsFrequencyUuid: MaybeRefOrGetter
+}) =>
+ useQuery({
+ ...seqvarsApiQuerypresetsfrequencyRetrieveOptions({
+ path: {
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetssetversion: () => toValue(presetsSetVersionUuid)!,
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetsfrequency: () => toValue(presetsFrequencyUuid)!,
+ },
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () =>
+ !!toValue(presetsSetVersionUuid) && !!toValue(presetsFrequencyUuid),
+ })
+
+/**
+ * Mutation for creating a `SeqvarsQueryPresetsFrequency` object.
+ */
+export const useSeqvarsQueryPresetsFrequencyCreateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetsfrequencyCreateMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsFrequencyKeys(queryClient, context.path)
+ },
+ })
+}
+
+/**
+ * Mutation for updating a `SeqvarsQueryPresetsFrequency` object.
+ */
+export const useSeqvarsQueryPresetsFrequencyUpdateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetsfrequencyUpdateMutation(),
+ // Perform optimistic updates but prepare rollback by snapshotting the data.
+ onMutate: async (data: SeqvarsApiQuerypresetsfrequencyUpdateData) => {
+ // Cancel any outgoing refetches to prevent optimistic updates.
+ const queryKey = seqvarsApiQuerypresetsfrequencyRetrieveOptions({
+ path: data.path,
+ }).queryKey
+ await queryClient.cancelQueries({ queryKey })
+ // Snapshot the previous value.
+ const previousValue = queryClient.getQueryData(queryKey)
+ // Optimistically update to the new value.
+ //
+ // Note that the explicit case of `data.body` is necessary as we would lose the
+ // server-maintained fields such as `date_created` and `date_modified` otherwise.
+ const newValue =
+ previousValue === undefined && data.body === undefined
+ ? undefined
+ : deepmerge(previousValue, data.body as SeqvarsQueryPresetsFrequency)
+ queryClient.setQueryData(queryKey, newValue)
+ // Return a context with the previous and new data.
+ return { previousValue, newValue }
+ },
+ // If the mutation fails, rollback with context we returned above.
+ onError: (_err, variables, context) => {
+ if (!!context?.previousValue) {
+ queryClient.setQueryData(
+ seqvarsApiQuerypresetsfrequencyRetrieveOptions({
+ path: variables.path,
+ }).queryKey,
+ context.previousValue,
+ )
+ }
+ },
+ // Always refetch after error or success.
+ onSettled: (data) => {
+ if (!!data) {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsFrequencyKeys(queryClient, {
+ querypresetssetversion: data.presetssetversion,
+ querypresetsfrequency: data.sodar_uuid,
+ })
+ }
+ },
+ })
+}
+
+/**
+ * Mutation for the deletion of a `SeqvarsQueryPresetsFrequency` object.
+ */
+export const useSeqvarsQueryPresetsFrequencyDestroyMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetsfrequencyDestroyMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsFrequencyKeys(queryClient, context.path, {
+ destroy: true,
+ })
+ },
+ })
+}
diff --git a/frontend/src/seqvars/queries/seqvarQueryPresetsLocus.ts b/frontend/src/seqvars/queries/seqvarQueryPresetsLocus.ts
new file mode 100644
index 000000000..bda285c5d
--- /dev/null
+++ b/frontend/src/seqvars/queries/seqvarQueryPresetsLocus.ts
@@ -0,0 +1,210 @@
+/**
+ * Queries for seqvars query locus presets powered by TanStack Query.
+ */
+import {
+ QueryClient,
+ useMutation,
+ useQuery,
+ useQueryClient,
+} from '@tanstack/vue-query'
+import {
+ SeqvarsApiQuerypresetslocusUpdateData,
+ SeqvarsQueryPresetsLocus,
+} from '@varfish-org/varfish-api/lib'
+import {
+ seqvarsApiQuerypresetslocusCreateMutation,
+ seqvarsApiQuerypresetslocusDestroyMutation,
+ seqvarsApiQuerypresetslocusListOptions,
+ seqvarsApiQuerypresetslocusRetrieveOptions,
+ seqvarsApiQuerypresetslocusUpdateMutation,
+} from '@varfish-org/varfish-api/lib/@tanstack/vue-query.gen'
+import { deepmerge } from 'deepmerge-ts'
+import { MaybeRefOrGetter, toValue } from 'vue'
+
+/**
+ * Helper to invalidate query keys for lists and retrieval for a single query locus presets.
+ *
+ * @param queryClient Query client to use.
+ * @param querypresetssetversion UUID of the query presets set version.
+ * @param querypresetslocus UUID of the query locus presets.
+ * @param destroy Whether to destroy the presets instead of invalidating it.
+ */
+const invalidateSeqvarsQueryPresetsLocusKeys = (
+ queryClient: QueryClient,
+ {
+ querypresetssetversion,
+ querypresetslocus,
+ }: {
+ querypresetssetversion: string
+ querypresetslocus?: string
+ },
+ { destroy }: { destroy?: boolean } = { destroy: false },
+) => {
+ // Below, is the code for invalidating the locus prests.
+ queryClient.invalidateQueries({
+ queryKey: seqvarsApiQuerypresetslocusListOptions({
+ path: { querypresetssetversion },
+ }).queryKey,
+ })
+ if (querypresetslocus !== undefined) {
+ const arg = {
+ queryKey: seqvarsApiQuerypresetslocusRetrieveOptions({
+ path: {
+ querypresetssetversion,
+ querypresetslocus,
+ },
+ }).queryKey,
+ }
+ if (destroy) {
+ queryClient.removeQueries(arg)
+ } else {
+ queryClient.invalidateQueries(arg)
+ }
+ }
+}
+
+/**
+ * Query for a list of seqvar query locus presets sets within a presets set version.
+ *
+ * Uses the list API of TanStack Query.
+ *
+ * Note that the listed objects are identical to the ones returned for a single
+ * retrieve (there is no `*Details` variant, only the slimmer `*Request` one).
+ *
+ * @param querypresetssetversion UUID of the presets set version.
+ * @returns Query result with pages of locus presets.
+ */
+export const useSeqvarsQueryPresetsLocusListQuery = ({
+ projectUuid,
+}: {
+ projectUuid: MaybeRefOrGetter
+}) => {
+ return useQuery({
+ ...seqvarsApiQuerypresetslocusListOptions({
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ path: { project: () => toValue(projectUuid)! },
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ query: () => ({
+ page: 1,
+ page_size: 100,
+ }),
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () => !!toValue(projectUuid),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ getNextPageParam: (lastPage) => lastPage.next,
+ })
+}
+
+/**
+ * Query for a single seqvar query locus presets set details within a presets set version.
+ *
+ * Note that the listed objects are identical to the ones returned for a single
+ * retrieve (there is no `*Details` variant, only the slimmer `*Request` one).
+ *
+ * @param presetsSetVersionUuid
+ * UUID of the presets set version that contains the locus preset.
+ * @param presetsLocusUuid UUID of the locus presets to load.
+ */
+export const useSeqvarsQueryPresetsLocusRetrieveQuery = ({
+ presetsSetVersionUuid,
+ presetsLocusUuid,
+}: {
+ presetsSetVersionUuid: MaybeRefOrGetter
+ presetsLocusUuid: MaybeRefOrGetter
+}) =>
+ useQuery({
+ ...seqvarsApiQuerypresetslocusRetrieveOptions({
+ path: {
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetssetversion: () => toValue(presetsSetVersionUuid)!,
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetslocus: () => toValue(presetsLocusUuid)!,
+ },
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () =>
+ !!toValue(presetsSetVersionUuid) && !!toValue(presetsLocusUuid),
+ })
+
+/**
+ * Mutation for creating a `SeqvarsQueryPresetsLocus` object.
+ */
+export const useSeqvarsQueryPresetsLocusCreateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetslocusCreateMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsLocusKeys(queryClient, context.path)
+ },
+ })
+}
+
+/**
+ * Mutation for updating a `SeqvarsQueryPresetsLocus` object.
+ */
+export const useSeqvarsQueryPresetsLocusUpdateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetslocusUpdateMutation(),
+ // Perform optimistic updates but prepare rollback by snapshotting the data.
+ onMutate: async (data: SeqvarsApiQuerypresetslocusUpdateData) => {
+ // Cancel any outgoing refetches to prevent optimistic updates.
+ const queryKey = seqvarsApiQuerypresetslocusRetrieveOptions({
+ path: data.path,
+ }).queryKey
+ await queryClient.cancelQueries({ queryKey })
+ // Snapshot the previous value.
+ const previousValue = queryClient.getQueryData(queryKey)
+ // Optimistically update to the new value.
+ //
+ // Note that the explicit case of `data.body` is necessary as we would lose the
+ // server-maintained fields such as `date_created` and `date_modified` otherwise.
+ const newValue =
+ previousValue === undefined && data.body === undefined
+ ? undefined
+ : deepmerge(previousValue, data.body as SeqvarsQueryPresetsLocus)
+ queryClient.setQueryData(queryKey, newValue)
+ // Return a context with the previous and new data.
+ return { previousValue, newValue }
+ },
+ // If the mutation fails, rollback with context we returned above.
+ onError: (_err, variables, context) => {
+ if (!!context?.previousValue) {
+ queryClient.setQueryData(
+ seqvarsApiQuerypresetslocusRetrieveOptions({
+ path: variables.path,
+ }).queryKey,
+ context.previousValue,
+ )
+ }
+ },
+ // Always refetch after error or success.
+ onSettled: (data) => {
+ if (!!data) {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsLocusKeys(queryClient, {
+ querypresetssetversion: data.presetssetversion,
+ querypresetslocus: data.sodar_uuid,
+ })
+ }
+ },
+ })
+}
+
+/**
+ * Mutation for the deletion of a `SeqvarsQueryPresetsLocus` object.
+ */
+export const useSeqvarsQueryPresetsLocusDestroyMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetslocusDestroyMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsLocusKeys(queryClient, context.path, {
+ destroy: true,
+ })
+ },
+ })
+}
diff --git a/frontend/src/seqvars/queries/seqvarQueryPresetsPhenotypePrio.ts b/frontend/src/seqvars/queries/seqvarQueryPresetsPhenotypePrio.ts
new file mode 100644
index 000000000..9afefec6e
--- /dev/null
+++ b/frontend/src/seqvars/queries/seqvarQueryPresetsPhenotypePrio.ts
@@ -0,0 +1,217 @@
+/**
+ * Queries for seqvars query phenotypeprio presets powered by TanStack Query.
+ */
+import {
+ QueryClient,
+ useMutation,
+ useQuery,
+ useQueryClient,
+} from '@tanstack/vue-query'
+import {
+ SeqvarsApiQuerypresetsphenotypeprioUpdateData,
+ SeqvarsQueryPresetsPhenotypePrio,
+} from '@varfish-org/varfish-api/lib'
+import {
+ seqvarsApiQuerypresetsphenotypeprioCreateMutation,
+ seqvarsApiQuerypresetsphenotypeprioDestroyMutation,
+ seqvarsApiQuerypresetsphenotypeprioListOptions,
+ seqvarsApiQuerypresetsphenotypeprioRetrieveOptions,
+ seqvarsApiQuerypresetsphenotypeprioUpdateMutation,
+} from '@varfish-org/varfish-api/lib/@tanstack/vue-query.gen'
+import { deepmerge } from 'deepmerge-ts'
+import { MaybeRefOrGetter, toValue } from 'vue'
+
+/**
+ * Helper to invalidate query keys for lists and retrieval for a single query phenotypeprio presets.
+ *
+ * @param queryClient Query client to use.
+ * @param querypresetssetversion UUID of the query presets set version.
+ * @param querypresetsphenotypeprio UUID of the query phenotypeprio presets.
+ * @param destroy Whether to destroy the presets instead of invalidating it.
+ */
+const invalidateSeqvarsQueryPresetsPhenotypePrioKeys = (
+ queryClient: QueryClient,
+ {
+ querypresetssetversion,
+ querypresetsphenotypeprio,
+ }: {
+ querypresetssetversion: string
+ querypresetsphenotypeprio?: string
+ },
+ { destroy }: { destroy?: boolean } = { destroy: false },
+) => {
+ // Below, is the code for invalidating the phenotypeprio prests.
+ queryClient.invalidateQueries({
+ queryKey: seqvarsApiQuerypresetsphenotypeprioListOptions({
+ path: { querypresetssetversion },
+ }).queryKey,
+ })
+ if (querypresetsphenotypeprio !== undefined) {
+ const arg = {
+ queryKey: seqvarsApiQuerypresetsphenotypeprioRetrieveOptions({
+ path: {
+ querypresetssetversion,
+ querypresetsphenotypeprio,
+ },
+ }).queryKey,
+ }
+ if (destroy) {
+ queryClient.removeQueries(arg)
+ } else {
+ queryClient.invalidateQueries(arg)
+ }
+ }
+}
+
+/**
+ * Query for a list of seqvar query phenotypeprio presets sets within a presets set version.
+ *
+ * Uses the list API of TanStack Query.
+ *
+ * Note that the listed objects are identical to the ones returned for a single
+ * retrieve (there is no `*Details` variant, only the slimmer `*Request` one).
+ *
+ * @param querypresetssetversion UUID of the presets set version.
+ * @returns Query result with pages of phenotypeprio presets.
+ */
+export const useSeqvarsQueryPresetsPhenotypePrioListQuery = ({
+ projectUuid,
+}: {
+ projectUuid: MaybeRefOrGetter
+}) => {
+ return useQuery({
+ ...seqvarsApiQuerypresetsphenotypeprioListOptions({
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ path: { project: () => toValue(projectUuid)! },
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ query: () => ({
+ page: 1,
+ page_size: 100,
+ }),
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () => !!toValue(projectUuid),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ getNextPageParam: (lastPage) => lastPage.next,
+ })
+}
+
+/**
+ * Query for a single seqvar query phenotypeprio presets set details within a presets set version.
+ *
+ * Note that the listed objects are identical to the ones returned for a single
+ * retrieve (there is no `*Details` variant, only the slimmer `*Request` one).
+ *
+ * @param presetsSetVersionUuid
+ * UUID of the presets set version that contains the phenotypeprio preset.
+ * @param presetsPhenotypePrioUuid UUID of the phenotypeprio presets to load.
+ */
+export const useSeqvarsQueryPresetsPhenotypePrioRetrieveQuery = ({
+ presetsSetVersionUuid,
+ presetsPhenotypePrioUuid,
+}: {
+ presetsSetVersionUuid: MaybeRefOrGetter
+ presetsPhenotypePrioUuid: MaybeRefOrGetter
+}) =>
+ useQuery({
+ ...seqvarsApiQuerypresetsphenotypeprioRetrieveOptions({
+ path: {
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetssetversion: () => toValue(presetsSetVersionUuid)!,
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetsphenotypeprio: () => toValue(presetsPhenotypePrioUuid)!,
+ },
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () =>
+ !!toValue(presetsSetVersionUuid) && !!toValue(presetsPhenotypePrioUuid),
+ })
+
+/**
+ * Mutation for creating a `SeqvarsQueryPresetsPhenotypePrio` object.
+ */
+export const useSeqvarsQueryPresetsPhenotypePrioCreateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetsphenotypeprioCreateMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsPhenotypePrioKeys(queryClient, context.path)
+ },
+ })
+}
+
+/**
+ * Mutation for updating a `SeqvarsQueryPresetsPhenotypePrio` object.
+ */
+export const useSeqvarsQueryPresetsPhenotypePrioUpdateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetsphenotypeprioUpdateMutation(),
+ // Perform optimistic updates but prepare rollback by snapshotting the data.
+ onMutate: async (data: SeqvarsApiQuerypresetsphenotypeprioUpdateData) => {
+ // Cancel any outgoing refetches to prevent optimistic updates.
+ const queryKey = seqvarsApiQuerypresetsphenotypeprioRetrieveOptions({
+ path: data.path,
+ }).queryKey
+ await queryClient.cancelQueries({ queryKey })
+ // Snapshot the previous value.
+ const previousValue = queryClient.getQueryData(queryKey)
+ // Optimistically update to the new value.
+ //
+ // Note that the explicit case of `data.body` is necessary as we would lose the
+ // server-maintained fields such as `date_created` and `date_modified` otherwise.
+ const newValue =
+ previousValue === undefined && data.body === undefined
+ ? undefined
+ : deepmerge(
+ previousValue,
+ data.body as SeqvarsQueryPresetsPhenotypePrio,
+ )
+ queryClient.setQueryData(queryKey, newValue)
+ // Return a context with the previous and new data.
+ return { previousValue, newValue }
+ },
+ // If the mutation fails, rollback with context we returned above.
+ onError: (_err, variables, context) => {
+ if (!!context?.previousValue) {
+ queryClient.setQueryData(
+ seqvarsApiQuerypresetsphenotypeprioRetrieveOptions({
+ path: variables.path,
+ }).queryKey,
+ context.previousValue,
+ )
+ }
+ },
+ // Always refetch after error or success.
+ onSettled: (data) => {
+ if (!!data) {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsPhenotypePrioKeys(queryClient, {
+ querypresetssetversion: data.presetssetversion,
+ querypresetsphenotypeprio: data.sodar_uuid,
+ })
+ }
+ },
+ })
+}
+
+/**
+ * Mutation for the deletion of a `SeqvarsQueryPresetsPhenotypePrio` object.
+ */
+export const useSeqvarsQueryPresetsPhenotypePrioDestroyMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetsphenotypeprioDestroyMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsPhenotypePrioKeys(
+ queryClient,
+ context.path,
+ {
+ destroy: true,
+ },
+ )
+ },
+ })
+}
diff --git a/frontend/src/seqvars/queries/seqvarQueryPresetsPredefinedQuery.ts b/frontend/src/seqvars/queries/seqvarQueryPresetsPredefinedQuery.ts
new file mode 100644
index 000000000..53c364fd3
--- /dev/null
+++ b/frontend/src/seqvars/queries/seqvarQueryPresetsPredefinedQuery.ts
@@ -0,0 +1,210 @@
+/**
+ * Queries for seqvars predefined query powered by TanStack Query.
+ */
+import {
+ QueryClient,
+ useMutation,
+ useQuery,
+ useQueryClient,
+} from '@tanstack/vue-query'
+import {
+ SeqvarsApiPredefinedqueryUpdateData,
+ SeqvarsPredefinedQuery,
+} from '@varfish-org/varfish-api/lib'
+import {
+ seqvarsApiPredefinedqueryCreateMutation,
+ seqvarsApiPredefinedqueryDestroyMutation,
+ seqvarsApiPredefinedqueryListOptions,
+ seqvarsApiPredefinedqueryRetrieveOptions,
+ seqvarsApiPredefinedqueryUpdateMutation,
+} from '@varfish-org/varfish-api/lib/@tanstack/vue-query.gen'
+import { deepmerge } from 'deepmerge-ts'
+import { MaybeRefOrGetter, toValue } from 'vue'
+
+/**
+ * Helper to invalidate query keys for lists and retrieval for a single predefined query.
+ *
+ * @param queryClient Query client to use.
+ * @param querypresetssetversion UUID of the query presets set version.
+ * @param predefinedquery UUID of the predefined query.
+ * @param destroy Whether to destroy the presets instead of invalidating it.
+ */
+const invalidateSeqvarsPredefinedQueryKeys = (
+ queryClient: QueryClient,
+ {
+ querypresetssetversion,
+ predefinedquery,
+ }: {
+ querypresetssetversion: string
+ predefinedquery?: string
+ },
+ { destroy }: { destroy?: boolean } = { destroy: false },
+) => {
+ // Below, is the code for invalidating the columns prests.
+ queryClient.invalidateQueries({
+ queryKey: seqvarsApiPredefinedqueryListOptions({
+ path: { querypresetssetversion },
+ }).queryKey,
+ })
+ if (predefinedquery !== undefined) {
+ const arg = {
+ queryKey: seqvarsApiPredefinedqueryRetrieveOptions({
+ path: {
+ querypresetssetversion,
+ predefinedquery,
+ },
+ }).queryKey,
+ }
+ if (destroy) {
+ queryClient.removeQueries(arg)
+ } else {
+ queryClient.invalidateQueries(arg)
+ }
+ }
+}
+
+/**
+ * Query for a list of seqvar predefined query sets within a presets set version.
+ *
+ * Uses the list API of TanStack Query.
+ *
+ * Note that the listed objects are identical to the ones returned for a single
+ * retrieve (there is no `*Details` variant, only the slimmer `*Request` one).
+ *
+ * @param querypresetssetversion UUID of the presets set version.
+ * @returns Query result with pages of columns presets.
+ */
+export const useSeqvarsPredefinedQueryListQuery = ({
+ projectUuid,
+}: {
+ projectUuid: MaybeRefOrGetter
+}) => {
+ return useQuery({
+ ...seqvarsApiPredefinedqueryListOptions({
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ path: { project: () => toValue(projectUuid)! },
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ query: () => ({
+ page: 1,
+ page_size: 100,
+ }),
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () => !!toValue(projectUuid),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ getNextPageParam: (lastPage) => lastPage.next,
+ })
+}
+
+/**
+ * Query for a single seqvar predefined query set details within a presets set version.
+ *
+ * Note that the listed objects are identical to the ones returned for a single
+ * retrieve (there is no `*Details` variant, only the slimmer `*Request` one).
+ *
+ * @param presetsSetVersionUuid
+ * UUID of the presets set version that contains the columns preset.
+ * @param presetsPredefinedQueryUuid UUID of the columns presets to load.
+ */
+export const useSeqvarsPredefinedQueryRetrieveQuery = ({
+ presetsSetVersionUuid,
+ presetsPredefinedQueryUuid,
+}: {
+ presetsSetVersionUuid: MaybeRefOrGetter
+ presetsPredefinedQueryUuid: MaybeRefOrGetter
+}) =>
+ useQuery({
+ ...seqvarsApiPredefinedqueryRetrieveOptions({
+ path: {
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetssetversion: () => toValue(presetsSetVersionUuid)!,
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ predefinedquery: () => toValue(presetsPredefinedQueryUuid)!,
+ },
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () =>
+ !!toValue(presetsSetVersionUuid) && !!toValue(presetsPredefinedQueryUuid),
+ })
+
+/**
+ * Mutation for creating a `SeqvarsPredefinedQuery` object.
+ */
+export const useSeqvarsPredefinedQueryCreateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiPredefinedqueryCreateMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarsPredefinedQueryKeys(queryClient, context.path)
+ },
+ })
+}
+
+/**
+ * Mutation for updating a `SeqvarsPredefinedQuery` object.
+ */
+export const useSeqvarsPredefinedQueryUpdateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiPredefinedqueryUpdateMutation(),
+ // Perform optimistic updates but prepare rollback by snapshotting the data.
+ onMutate: async (data: SeqvarsApiPredefinedqueryUpdateData) => {
+ // Cancel any outgoing refetches to prevent optimistic updates.
+ const queryKey = seqvarsApiPredefinedqueryRetrieveOptions({
+ path: data.path,
+ }).queryKey
+ await queryClient.cancelQueries({ queryKey })
+ // Snapshot the previous value.
+ const previousValue = queryClient.getQueryData(queryKey)
+ // Optimistically update to the new value.
+ //
+ // Note that the explicit case of `data.body` is necessary as we would lose the
+ // server-maintained fields such as `date_created` and `date_modified` otherwise.
+ const newValue =
+ previousValue === undefined && data.body === undefined
+ ? undefined
+ : deepmerge(previousValue, data.body as SeqvarsPredefinedQuery)
+ queryClient.setQueryData(queryKey, newValue)
+ // Return a context with the previous and new data.
+ return { previousValue, newValue }
+ },
+ // If the mutation fails, rollback with context we returned above.
+ onError: (_err, variables, context) => {
+ if (!!context?.previousValue) {
+ queryClient.setQueryData(
+ seqvarsApiPredefinedqueryRetrieveOptions({
+ path: variables.path,
+ }).queryKey,
+ context.previousValue,
+ )
+ }
+ },
+ // Always refetch after error or success.
+ onSettled: (data) => {
+ if (!!data) {
+ // Refetch after success or error.
+ invalidateSeqvarsPredefinedQueryKeys(queryClient, {
+ querypresetssetversion: data.presetssetversion,
+ predefinedquery: data.sodar_uuid,
+ })
+ }
+ },
+ })
+}
+
+/**
+ * Mutation for the deletion of a `SeqvarsPredefinedQuery` object.
+ */
+export const useSeqvarsPredefinedQueryDestroyMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiPredefinedqueryDestroyMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarsPredefinedQueryKeys(queryClient, context.path, {
+ destroy: true,
+ })
+ },
+ })
+}
diff --git a/frontend/src/seqvars/queries/seqvarQueryPresetsQuality.ts b/frontend/src/seqvars/queries/seqvarQueryPresetsQuality.ts
new file mode 100644
index 000000000..d1e693dd5
--- /dev/null
+++ b/frontend/src/seqvars/queries/seqvarQueryPresetsQuality.ts
@@ -0,0 +1,210 @@
+/**
+ * Queries for seqvars query quality presets powered by TanStack Query.
+ */
+import {
+ QueryClient,
+ useMutation,
+ useQuery,
+ useQueryClient,
+} from '@tanstack/vue-query'
+import {
+ SeqvarsApiQuerypresetsqualityUpdateData,
+ SeqvarsQueryPresetsQuality,
+} from '@varfish-org/varfish-api/lib'
+import {
+ seqvarsApiQuerypresetsqualityCreateMutation,
+ seqvarsApiQuerypresetsqualityDestroyMutation,
+ seqvarsApiQuerypresetsqualityListOptions,
+ seqvarsApiQuerypresetsqualityRetrieveOptions,
+ seqvarsApiQuerypresetsqualityUpdateMutation,
+} from '@varfish-org/varfish-api/lib/@tanstack/vue-query.gen'
+import { deepmerge } from 'deepmerge-ts'
+import { MaybeRefOrGetter, toValue } from 'vue'
+
+/**
+ * Helper to invalidate query keys for lists and retrieval for a single query quality presets.
+ *
+ * @param queryClient Query client to use.
+ * @param querypresetssetversion UUID of the query presets set version.
+ * @param querypresetsquality UUID of the query quality presets.
+ * @param destroy Whether to destroy the presets instead of invalidating it.
+ */
+const invalidateSeqvarsQueryPresetsQualityKeys = (
+ queryClient: QueryClient,
+ {
+ querypresetssetversion,
+ querypresetsquality,
+ }: {
+ querypresetssetversion: string
+ querypresetsquality?: string
+ },
+ { destroy }: { destroy?: boolean } = { destroy: false },
+) => {
+ // Below, is the code for invalidating the quality prests.
+ queryClient.invalidateQueries({
+ queryKey: seqvarsApiQuerypresetsqualityListOptions({
+ path: { querypresetssetversion },
+ }).queryKey,
+ })
+ if (querypresetsquality !== undefined) {
+ const arg = {
+ queryKey: seqvarsApiQuerypresetsqualityRetrieveOptions({
+ path: {
+ querypresetssetversion,
+ querypresetsquality,
+ },
+ }).queryKey,
+ }
+ if (destroy) {
+ queryClient.removeQueries(arg)
+ } else {
+ queryClient.invalidateQueries(arg)
+ }
+ }
+}
+
+/**
+ * Query for a list of seqvar query quality presets sets within a presets set version.
+ *
+ * Uses the list API of TanStack Query.
+ *
+ * Note that the listed objects are identical to the ones returned for a single
+ * retrieve (there is no `*Details` variant, only the slimmer `*Request` one).
+ *
+ * @param querypresetssetversion UUID of the presets set version.
+ * @returns Query result with pages of quality presets.
+ */
+export const useSeqvarsQueryPresetsQualityListQuery = ({
+ projectUuid,
+}: {
+ projectUuid: MaybeRefOrGetter
+}) => {
+ return useQuery({
+ ...seqvarsApiQuerypresetsqualityListOptions({
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ path: { project: () => toValue(projectUuid)! },
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ query: () => ({
+ page: 1,
+ page_size: 100,
+ }),
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () => !!toValue(projectUuid),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ getNextPageParam: (lastPage) => lastPage.next,
+ })
+}
+
+/**
+ * Query for a single seqvar query quality presets set details within a presets set version.
+ *
+ * Note that the listed objects are identical to the ones returned for a single
+ * retrieve (there is no `*Details` variant, only the slimmer `*Request` one).
+ *
+ * @param presetsSetVersionUuid
+ * UUID of the presets set version that contains the quality preset.
+ * @param presetsQualityUuid UUID of the quality presets to load.
+ */
+export const useSeqvarsQueryPresetsQualityRetrieveQuery = ({
+ presetsSetVersionUuid,
+ presetsQualityUuid,
+}: {
+ presetsSetVersionUuid: MaybeRefOrGetter
+ presetsQualityUuid: MaybeRefOrGetter
+}) =>
+ useQuery({
+ ...seqvarsApiQuerypresetsqualityRetrieveOptions({
+ path: {
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetssetversion: () => toValue(presetsSetVersionUuid)!,
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetsquality: () => toValue(presetsQualityUuid)!,
+ },
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () =>
+ !!toValue(presetsSetVersionUuid) && !!toValue(presetsQualityUuid),
+ })
+
+/**
+ * Mutation for creating a `SeqvarsQueryPresetsQuality` object.
+ */
+export const useSeqvarsQueryPresetsQualityCreateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetsqualityCreateMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsQualityKeys(queryClient, context.path)
+ },
+ })
+}
+
+/**
+ * Mutation for updating a `SeqvarsQueryPresetsQuality` object.
+ */
+export const useSeqvarsQueryPresetsQualityUpdateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetsqualityUpdateMutation(),
+ // Perform optimistic updates but prepare rollback by snapshotting the data.
+ onMutate: async (data: SeqvarsApiQuerypresetsqualityUpdateData) => {
+ // Cancel any outgoing refetches to prevent optimistic updates.
+ const queryKey = seqvarsApiQuerypresetsqualityRetrieveOptions({
+ path: data.path,
+ }).queryKey
+ await queryClient.cancelQueries({ queryKey })
+ // Snapshot the previous value.
+ const previousValue = queryClient.getQueryData(queryKey)
+ // Optimistically update to the new value.
+ //
+ // Note that the explicit case of `data.body` is necessary as we would lose the
+ // server-maintained fields such as `date_created` and `date_modified` otherwise.
+ const newValue =
+ previousValue === undefined && data.body === undefined
+ ? undefined
+ : deepmerge(previousValue, data.body as SeqvarsQueryPresetsQuality)
+ queryClient.setQueryData(queryKey, newValue)
+ // Return a context with the previous and new data.
+ return { previousValue, newValue }
+ },
+ // If the mutation fails, rollback with context we returned above.
+ onError: (_err, variables, context) => {
+ if (!!context?.previousValue) {
+ queryClient.setQueryData(
+ seqvarsApiQuerypresetsqualityRetrieveOptions({
+ path: variables.path,
+ }).queryKey,
+ context.previousValue,
+ )
+ }
+ },
+ // Always refetch after error or success.
+ onSettled: (data) => {
+ if (!!data) {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsQualityKeys(queryClient, {
+ querypresetssetversion: data.presetssetversion,
+ querypresetsquality: data.sodar_uuid,
+ })
+ }
+ },
+ })
+}
+
+/**
+ * Mutation for the deletion of a `SeqvarsQueryPresetsQuality` object.
+ */
+export const useSeqvarsQueryPresetsQualityDestroyMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetsqualityDestroyMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsQualityKeys(queryClient, context.path, {
+ destroy: true,
+ })
+ },
+ })
+}
diff --git a/frontend/src/seqvars/queries/seqvarQueryPresetsVariantPrio.ts b/frontend/src/seqvars/queries/seqvarQueryPresetsVariantPrio.ts
new file mode 100644
index 000000000..eb279a088
--- /dev/null
+++ b/frontend/src/seqvars/queries/seqvarQueryPresetsVariantPrio.ts
@@ -0,0 +1,213 @@
+/**
+ * Queries for seqvars query variantprio presets powered by TanStack Query.
+ */
+import {
+ QueryClient,
+ useMutation,
+ useQuery,
+ useQueryClient,
+} from '@tanstack/vue-query'
+import {
+ SeqvarsApiQuerypresetsvariantprioUpdateData,
+ SeqvarsQueryPresetsVariantPrio,
+} from '@varfish-org/varfish-api/lib'
+import {
+ seqvarsApiQuerypresetsvariantprioCreateMutation,
+ seqvarsApiQuerypresetsvariantprioDestroyMutation,
+ seqvarsApiQuerypresetsvariantprioListOptions,
+ seqvarsApiQuerypresetsvariantprioRetrieveOptions,
+ seqvarsApiQuerypresetsvariantprioUpdateMutation,
+} from '@varfish-org/varfish-api/lib/@tanstack/vue-query.gen'
+import { deepmerge } from 'deepmerge-ts'
+import { MaybeRefOrGetter, toValue } from 'vue'
+
+/**
+ * Helper to invalidate query keys for lists and retrieval for a single query variantprio presets.
+ *
+ * @param queryClient Query client to use.
+ * @param querypresetssetversion UUID of the query presets set version.
+ * @param querypresetsvariantprio UUID of the query variantprio presets.
+ * @param destroy Whether to destroy the presets instead of invalidating it.
+ */
+const invalidateSeqvarsQueryPresetsVariantPrioKeys = (
+ queryClient: QueryClient,
+ {
+ querypresetssetversion,
+ querypresetsvariantprio,
+ }: {
+ querypresetssetversion: string
+ querypresetsvariantprio?: string
+ },
+ { destroy }: { destroy?: boolean } = { destroy: false },
+) => {
+ // Below, is the code for invalidating the variantprio prests.
+ queryClient.invalidateQueries({
+ queryKey: seqvarsApiQuerypresetsvariantprioListOptions({
+ path: { querypresetssetversion },
+ }).queryKey,
+ })
+ if (querypresetsvariantprio !== undefined) {
+ const arg = {
+ queryKey: seqvarsApiQuerypresetsvariantprioRetrieveOptions({
+ path: {
+ querypresetssetversion,
+ querypresetsvariantprio,
+ },
+ }).queryKey,
+ }
+ if (destroy) {
+ queryClient.removeQueries(arg)
+ } else {
+ queryClient.invalidateQueries(arg)
+ }
+ }
+}
+
+/**
+ * Query for a list of seqvar query variantprio presets sets within a presets set version.
+ *
+ * Uses the list API of TanStack Query.
+ *
+ * Note that the listed objects are identical to the ones returned for a single
+ * retrieve (there is no `*Details` variant, only the slimmer `*Request` one).
+ *
+ * @param querypresetssetversion UUID of the presets set version.
+ * @returns Query result with pages of variantprio presets.
+ */
+export const useSeqvarsQueryPresetsVariantPrioListQuery = ({
+ projectUuid,
+}: {
+ projectUuid: MaybeRefOrGetter
+}) => {
+ return useQuery({
+ ...seqvarsApiQuerypresetsvariantprioListOptions({
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ path: { project: () => toValue(projectUuid)! },
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ query: () => ({
+ page: 1,
+ page_size: 100,
+ }),
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () => !!toValue(projectUuid),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ getNextPageParam: (lastPage) => lastPage.next,
+ })
+}
+
+/**
+ * Query for a single seqvar query variantprio presets set details within a presets set version.
+ *
+ * Note that the listed objects are identical to the ones returned for a single
+ * retrieve (there is no `*Details` variant, only the slimmer `*Request` one).
+ *
+ * @param presetsSetVersionUuid
+ * UUID of the presets set version that contains the variantprio preset.
+ * @param presetsVariantPrioUuid UUID of the variantprio presets to load.
+ */
+export const useSeqvarsQueryPresetsVariantPrioRetrieveQuery = ({
+ presetsSetVersionUuid,
+ presetsVariantPrioUuid,
+}: {
+ presetsSetVersionUuid: MaybeRefOrGetter
+ presetsVariantPrioUuid: MaybeRefOrGetter
+}) =>
+ useQuery({
+ ...seqvarsApiQuerypresetsvariantprioRetrieveOptions({
+ path: {
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetssetversion: () => toValue(presetsSetVersionUuid)!,
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ querypresetsvariantprio: () => toValue(presetsVariantPrioUuid)!,
+ },
+ }),
+ // @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
+ enabled: () =>
+ !!toValue(presetsSetVersionUuid) && !!toValue(presetsVariantPrioUuid),
+ })
+
+/**
+ * Mutation for creating a `SeqvarsQueryPresetsVariantPrio` object.
+ */
+export const useSeqvarsQueryPresetsVariantPrioCreateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetsvariantprioCreateMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsVariantPrioKeys(queryClient, context.path)
+ },
+ })
+}
+
+/**
+ * Mutation for updating a `SeqvarsQueryPresetsVariantPrio` object.
+ */
+export const useSeqvarsQueryPresetsVariantPrioUpdateMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetsvariantprioUpdateMutation(),
+ // Perform optimistic updates but prepare rollback by snapshotting the data.
+ onMutate: async (data: SeqvarsApiQuerypresetsvariantprioUpdateData) => {
+ // Cancel any outgoing refetches to prevent optimistic updates.
+ const queryKey = seqvarsApiQuerypresetsvariantprioRetrieveOptions({
+ path: data.path,
+ }).queryKey
+ await queryClient.cancelQueries({ queryKey })
+ // Snapshot the previous value.
+ const previousValue = queryClient.getQueryData(queryKey)
+ // Optimistically update to the new value.
+ //
+ // Note that the explicit case of `data.body` is necessary as we would lose the
+ // server-maintained fields such as `date_created` and `date_modified` otherwise.
+ const newValue =
+ previousValue === undefined && data.body === undefined
+ ? undefined
+ : deepmerge(
+ previousValue,
+ data.body as SeqvarsQueryPresetsVariantPrio,
+ )
+ queryClient.setQueryData(queryKey, newValue)
+ // Return a context with the previous and new data.
+ return { previousValue, newValue }
+ },
+ // If the mutation fails, rollback with context we returned above.
+ onError: (_err, variables, context) => {
+ if (!!context?.previousValue) {
+ queryClient.setQueryData(
+ seqvarsApiQuerypresetsvariantprioRetrieveOptions({
+ path: variables.path,
+ }).queryKey,
+ context.previousValue,
+ )
+ }
+ },
+ // Always refetch after error or success.
+ onSettled: (data) => {
+ if (!!data) {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsVariantPrioKeys(queryClient, {
+ querypresetssetversion: data.presetssetversion,
+ querypresetsvariantprio: data.sodar_uuid,
+ })
+ }
+ },
+ })
+}
+
+/**
+ * Mutation for the deletion of a `SeqvarsQueryPresetsVariantPrio` object.
+ */
+export const useSeqvarsQueryPresetsVariantPrioDestroyMutation = () => {
+ const queryClient = useQueryClient()
+ return useMutation({
+ ...seqvarsApiQuerypresetsvariantprioDestroyMutation(),
+ onSettled: (_data, _variables, context) => {
+ // Refetch after success or error.
+ invalidateSeqvarsQueryPresetsVariantPrioKeys(queryClient, context.path, {
+ destroy: true,
+ })
+ },
+ })
+}
diff --git a/frontend/src/seqvars/views/PresetSets/PresetSets.vue b/frontend/src/seqvars/views/PresetSets/PresetSets.vue
index 2a03fd10c..484fe71f4 100644
--- a/frontend/src/seqvars/views/PresetSets/PresetSets.vue
+++ b/frontend/src/seqvars/views/PresetSets/PresetSets.vue
@@ -1,4 +1,5 @@