- clean execution header - enable test on workflows + add snack bar - display snack bar error if workflow cannot be tested Behaviour still need to be validated by @Bonapara <img width="880" alt="Capture d’écran 2024-11-15 à 12 16 36" src="https://github.com/user-attachments/assets/1dab0c3b-157c-449f-aee7-4c8cf2e369a6"> <img width="880" alt="Capture d’écran 2024-11-15 à 12 16 48" src="https://github.com/user-attachments/assets/16279611-0a58-4fe6-b117-0192714a6d5c">
32 lines
896 B
TypeScript
32 lines
896 B
TypeScript
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
|
|
import { RUN_WORKFLOW_VERSION } from '@/workflow/graphql/mutations/runWorkflowVersion';
|
|
import { useMutation } from '@apollo/client';
|
|
import {
|
|
RunWorkflowVersionMutation,
|
|
RunWorkflowVersionMutationVariables,
|
|
} from '~/generated/graphql';
|
|
|
|
export const useRunWorkflowVersion = () => {
|
|
const apolloMetadataClient = useApolloMetadataClient();
|
|
const [mutate] = useMutation<
|
|
RunWorkflowVersionMutation,
|
|
RunWorkflowVersionMutationVariables
|
|
>(RUN_WORKFLOW_VERSION, {
|
|
client: apolloMetadataClient,
|
|
});
|
|
|
|
const runWorkflowVersion = async ({
|
|
workflowVersionId,
|
|
payload,
|
|
}: {
|
|
workflowVersionId: string;
|
|
payload?: Record<string, any>;
|
|
}) => {
|
|
await mutate({
|
|
variables: { input: { workflowVersionId, payload } },
|
|
});
|
|
};
|
|
|
|
return { runWorkflowVersion };
|
|
};
|