diff --git a/web/app/components/base/form/components/form/actions.tsx b/web/app/components/base/form/components/form/actions.tsx index 4bdd398ad0..49ae87e3c0 100644 --- a/web/app/components/base/form/components/form/actions.tsx +++ b/web/app/components/base/form/components/form/actions.tsx @@ -4,8 +4,14 @@ import { useFormContext } from '../..' import Button from '../../../button' import { useTranslation } from 'react-i18next' +export type CustomActionsProps = { + form: FormType + isSubmitting: boolean + canSubmit: boolean +} + type ActionsProps = { - CustomActions?: (form: FormType) => React.ReactNode | React.JSX.Element + CustomActions?: (props: CustomActionsProps) => React.ReactNode | React.JSX.Element } const Actions = ({ @@ -20,7 +26,7 @@ const Actions = ({ ]) if (CustomActions) - return CustomActions(form) + return CustomActions({ form, isSubmitting, canSubmit }) return ( diff --git a/web/app/components/rag-pipeline/components/panel/test-run/document-processing/index.tsx b/web/app/components/rag-pipeline/components/panel/test-run/document-processing/index.tsx index a3a8494c94..bba6ed8ca1 100644 --- a/web/app/components/rag-pipeline/components/panel/test-run/document-processing/index.tsx +++ b/web/app/components/rag-pipeline/components/panel/test-run/document-processing/index.tsx @@ -2,8 +2,8 @@ import { generateZodSchema } from '@/app/components/base/form/form-scenarios/bas import { useConfigurations } from './hooks' import Options from './options' import Actions from './actions' -import type { FormType } from '@/app/components/base/form' import { useCallback } from 'react' +import type { CustomActionsProps } from '@/app/components/base/form/components/form/actions' type DocumentProcessingProps = { dataSourceNodeId: string @@ -19,8 +19,8 @@ const DocumentProcessing = ({ const { initialData, configurations } = useConfigurations(dataSourceNodeId) const schema = generateZodSchema(configurations) - const renderCustomActions = useCallback((form: FormType) => ( - + const renderCustomActions = useCallback((props: CustomActionsProps) => ( + ), [onBack]) return ( diff --git a/web/app/components/rag-pipeline/components/panel/test-run/document-processing/options.tsx b/web/app/components/rag-pipeline/components/panel/test-run/document-processing/options.tsx index 30901ad440..f61020a067 100644 --- a/web/app/components/rag-pipeline/components/panel/test-run/document-processing/options.tsx +++ b/web/app/components/rag-pipeline/components/panel/test-run/document-processing/options.tsx @@ -1,5 +1,5 @@ -import type { FormType } from '@/app/components/base/form' import { useAppForm } from '@/app/components/base/form' +import type { CustomActionsProps } from '@/app/components/base/form/components/form/actions' import BaseField from '@/app/components/base/form/form-scenarios/base/field' import type { BaseConfiguration } from '@/app/components/base/form/form-scenarios/base/types' import Toast from '@/app/components/base/toast' @@ -9,7 +9,7 @@ type OptionsProps = { initialData: Record configurations: BaseConfiguration[] schema: ZodSchema - CustomActions: (form: FormType) => React.JSX.Element + CustomActions: (props: CustomActionsProps) => React.JSX.Element onSubmit: (data: Record) => void }