mirror of
https://github.com/langgenius/dify.git
synced 2026-08-28 20:26:50 +08:00
feat(workflow): integrate workflow run validation before execution
This commit is contained in:
parent
3a876fd437
commit
a264a609db
@ -30,6 +30,7 @@ import { BlockEnum } from '@/app/components/workflow/types'
|
|||||||
import {
|
import {
|
||||||
useNodesSyncDraft,
|
useNodesSyncDraft,
|
||||||
} from '@/app/components/workflow/hooks'
|
} from '@/app/components/workflow/hooks'
|
||||||
|
import { useWorkflowRunValidation } from '@/app/components/workflow/hooks/use-checklist'
|
||||||
import useInspectVarsCrud from '@/app/components/workflow/hooks/use-inspect-vars-crud'
|
import useInspectVarsCrud from '@/app/components/workflow/hooks/use-inspect-vars-crud'
|
||||||
import { useInvalidLastRun } from '@/service/use-workflow'
|
import { useInvalidLastRun } from '@/service/use-workflow'
|
||||||
import { useStore, useWorkflowStore } from '@/app/components/workflow/store'
|
import { useStore, useWorkflowStore } from '@/app/components/workflow/store'
|
||||||
@ -145,6 +146,8 @@ const useLastRun = <T>({
|
|||||||
isRunAfterSingleRun,
|
isRunAfterSingleRun,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { validateBeforeRun } = useWorkflowRunValidation()
|
||||||
|
|
||||||
const {
|
const {
|
||||||
hideSingleRun,
|
hideSingleRun,
|
||||||
handleRun: doCallRunApi,
|
handleRun: doCallRunApi,
|
||||||
@ -217,6 +220,8 @@ const useLastRun = <T>({
|
|||||||
const invalidLastRun = useInvalidLastRun(flowType, flowId, id)
|
const invalidLastRun = useInvalidLastRun(flowType, flowId, id)
|
||||||
|
|
||||||
const handleRunWithParams = async (data: Record<string, any>) => {
|
const handleRunWithParams = async (data: Record<string, any>) => {
|
||||||
|
if (!validateBeforeRun())
|
||||||
|
return
|
||||||
const { isValid } = checkValid()
|
const { isValid } = checkValid()
|
||||||
if (!isValid)
|
if (!isValid)
|
||||||
return
|
return
|
||||||
@ -315,6 +320,8 @@ const useLastRun = <T>({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleSingleRun = () => {
|
const handleSingleRun = () => {
|
||||||
|
if (!validateBeforeRun())
|
||||||
|
return
|
||||||
const { isValid } = checkValid()
|
const { isValid } = checkValid()
|
||||||
if (!isValid)
|
if (!isValid)
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user