mirror of https://github.com/langgenius/dify.git
refactor: enhance action button logic to include workflow running state
This commit is contained in:
parent
4bc0a1bd37
commit
365157c37d
|
|
@ -2,6 +2,8 @@ import React from 'react'
|
|||
import Button from '@/app/components/base/button'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import type { CustomActionsProps } from '@/app/components/base/form/components/form/actions'
|
||||
import { useStore } from '@/app/components/workflow/store'
|
||||
import { WorkflowRunningStatus } from '@/app/components/workflow/types'
|
||||
|
||||
type ActionsProps = {
|
||||
formParams: CustomActionsProps
|
||||
|
|
@ -14,6 +16,8 @@ const Actions = ({
|
|||
}: ActionsProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { form, isSubmitting, canSubmit } = formParams
|
||||
const workflowRunningData = useStore(s => s.workflowRunningData)
|
||||
const isRunning = workflowRunningData?.result.status === WorkflowRunningStatus.Running
|
||||
|
||||
return (
|
||||
<div className='flex items-center justify-end gap-x-2 p-4 pt-2'>
|
||||
|
|
@ -28,8 +32,8 @@ const Actions = ({
|
|||
onClick={() => {
|
||||
form.handleSubmit()
|
||||
}}
|
||||
disabled={isSubmitting || !canSubmit}
|
||||
loading={isSubmitting}
|
||||
disabled={isSubmitting || !canSubmit || isRunning}
|
||||
loading={isSubmitting || isRunning}
|
||||
>
|
||||
{t('datasetPipeline.operations.process')}
|
||||
</Button>
|
||||
|
|
|
|||
Loading…
Reference in New Issue