mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 18:08:07 +08:00
feat: comprehensive trigger node system with Schedule Trigger implementation (#24039)
Co-authored-by: zhangxuhe1 <xuhezhang6@gmail.com>
This commit is contained in:
@ -20,6 +20,7 @@ import type { NodeProps } from '../../types'
|
||||
import {
|
||||
BlockEnum,
|
||||
NodeRunningStatus,
|
||||
TRIGGER_NODE_TYPES,
|
||||
} from '../../types'
|
||||
import {
|
||||
useNodesReadOnly,
|
||||
@ -42,6 +43,7 @@ import NodeControl from './components/node-control'
|
||||
import ErrorHandleOnNode from './components/error-handle/error-handle-on-node'
|
||||
import RetryOnNode from './components/retry/retry-on-node'
|
||||
import AddVariablePopupWithPosition from './components/add-variable-popup-with-position'
|
||||
import TriggerContainer from './components/trigger-container'
|
||||
import cn from '@/utils/classnames'
|
||||
import BlockIcon from '@/app/components/workflow/block-icon'
|
||||
import Tooltip from '@/app/components/base/tooltip'
|
||||
@ -136,7 +138,9 @@ const BaseNode: FC<BaseNodeProps> = ({
|
||||
return null
|
||||
}, [data._loopIndex, data._runningStatus, t])
|
||||
|
||||
return (
|
||||
const isTriggerNode = TRIGGER_NODE_TYPES.includes(data.type as any)
|
||||
|
||||
const nodeContent = (
|
||||
<div
|
||||
className={cn(
|
||||
'flex rounded-2xl border-[2px]',
|
||||
@ -291,13 +295,13 @@ const BaseNode: FC<BaseNodeProps> = ({
|
||||
</div>
|
||||
{
|
||||
data.type !== BlockEnum.Iteration && data.type !== BlockEnum.Loop && (
|
||||
cloneElement(children, { id, data })
|
||||
cloneElement(children, { data } as any)
|
||||
)
|
||||
}
|
||||
{
|
||||
(data.type === BlockEnum.Iteration || data.type === BlockEnum.Loop) && (
|
||||
<div className='grow pb-1 pl-1 pr-1'>
|
||||
{cloneElement(children, { id, data })}
|
||||
{cloneElement(children, { data } as any)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -332,6 +336,12 @@ const BaseNode: FC<BaseNodeProps> = ({
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
return isTriggerNode ? (
|
||||
<TriggerContainer status="enabled">
|
||||
{nodeContent}
|
||||
</TriggerContainer>
|
||||
) : nodeContent
|
||||
}
|
||||
|
||||
export default memo(BaseNode)
|
||||
|
||||
Reference in New Issue
Block a user