mirror of https://github.com/langgenius/dify.git
fix(workflow): enhance node-run to include schedule triggers
This commit is contained in:
parent
e074ba84d1
commit
5df94fd866
|
|
@ -318,7 +318,7 @@ const useLastRun = <T>({
|
|||
const { isValid } = checkValid()
|
||||
if (!isValid)
|
||||
return
|
||||
if (blockType === BlockEnum.TriggerWebhook || blockType === BlockEnum.TriggerPlugin)
|
||||
if (blockType === BlockEnum.TriggerWebhook || blockType === BlockEnum.TriggerPlugin || blockType === BlockEnum.TriggerSchedule)
|
||||
setShowVariableInspectPanel(true)
|
||||
if (isCustomRunNode) {
|
||||
showSingleRun()
|
||||
|
|
|
|||
|
|
@ -338,9 +338,10 @@ const useOneStepRun = <T>({
|
|||
}
|
||||
}, [])
|
||||
|
||||
const isScheduleTriggerNode = data.type === BlockEnum.TriggerSchedule
|
||||
const isWebhookTriggerNode = data.type === BlockEnum.TriggerWebhook
|
||||
const isPluginTriggerNode = data.type === BlockEnum.TriggerPlugin
|
||||
const isTriggerNode = isWebhookTriggerNode || isPluginTriggerNode
|
||||
const isTriggerNode = isWebhookTriggerNode || isPluginTriggerNode || isScheduleTriggerNode
|
||||
|
||||
const startTriggerListening = useCallback(() => {
|
||||
if (!isTriggerNode)
|
||||
|
|
@ -382,6 +383,18 @@ const useOneStepRun = <T>({
|
|||
setListeningTriggerIsAll,
|
||||
])
|
||||
|
||||
const runScheduleSingleRun = useCallback(async (): Promise<any | null> => {
|
||||
handleNodeDataUpdate({
|
||||
id,
|
||||
data: {
|
||||
...data,
|
||||
_isSingleRun: false,
|
||||
_singleRunningStatus: NodeRunningStatus.Listening,
|
||||
},
|
||||
})
|
||||
return {}
|
||||
}, [handleNodeDataUpdate])
|
||||
|
||||
const runWebhookSingleRun = useCallback(async (): Promise<any | null> => {
|
||||
const urlPath = `/apps/${flowId}/workflows/draft/nodes/${id}/trigger/run`
|
||||
|
||||
|
|
@ -641,7 +654,10 @@ const useOneStepRun = <T>({
|
|||
let hasError = false
|
||||
try {
|
||||
if (!isIteration && !isLoop) {
|
||||
if (isWebhookTriggerNode) {
|
||||
if (isScheduleTriggerNode) {
|
||||
await runScheduleSingleRun()
|
||||
}
|
||||
else if (isWebhookTriggerNode) {
|
||||
res = await runWebhookSingleRun()
|
||||
if (!res) {
|
||||
if (webhookSingleRunActiveRef.current) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue