import { getClient } from "@/api/AxiosClient"; import { useCredentialGetter } from "@/hooks/useCredentialGetter"; import { useQuery } from "@tanstack/react-query"; import { useLocation, useParams } from "react-router-dom"; import { RunWorkflowForm } from "./RunWorkflowForm"; import { WorkflowApiResponse } from "./types/workflowTypes"; import { Skeleton } from "@/components/ui/skeleton"; import { ProxyLocation } from "@/api/types"; import { getInitialValues } from "./utils"; function WorkflowRunParameters() { const credentialGetter = useCredentialGetter(); const { workflowPermanentId } = useParams(); const location = useLocation(); const { data: workflow, isFetching } = useQuery({ queryKey: ["workflow", workflowPermanentId], queryFn: async () => { const client = await getClient(credentialGetter); return client .get(`/workflows/${workflowPermanentId}`) .then((response) => response.data); }, refetchOnWindowFocus: false, }); const workflowParameters = workflow?.workflow_definition.parameters.filter( (parameter) => parameter.parameter_type === "workflow", ); const proxyLocation = location.state ? (location.state.proxyLocation as ProxyLocation) : null; const maxScreenshotScrolls = location.state?.maxScreenshotScrolls ?? null; const webhookCallbackUrl = location.state ? (location.state.webhookCallbackUrl as string) : null; const extraHttpHeaders = location.state ? (location.state.extraHttpHeaders as Record) : null; const initialValues = getInitialValues(location, workflowParameters ?? []); const header = (

Parameters{workflow?.title ? ` - ${workflow.title}` : ""}

Fill the placeholder values that you have linked throughout your workflow.

); if (isFetching) { return (
{header}
); } if (!workflow || !workflowParameters || !initialValues) { return
Workflow not found
; } return (
{header}
); } export { WorkflowRunParameters };