mirror of
https://github.com/langgenius/dify.git
synced 2026-03-28 01:29:55 +08:00
Co-authored-by: CodingOnStar <hanxujiang@dify.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: lif <1835304752@qq.com> Co-authored-by: hjlarry <hjlarry@163.com> Co-authored-by: Stephen Zhou <hi@hyoban.cc> Co-authored-by: tmimmanuel <14046872+tmimmanuel@users.noreply.github.com> Co-authored-by: Desel72 <pedroluiscolmenares722@gmail.com> Co-authored-by: Renzo <170978465+RenzoMXD@users.noreply.github.com> Co-authored-by: Krishna Chaitanya <krishnabkc15@gmail.com> Co-authored-by: yyh <92089059+lyzno1@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
33 lines
1.4 KiB
TypeScript
33 lines
1.4 KiB
TypeScript
import type { NodeProps } from '@/app/components/workflow/types'
|
|
import { BlockEnum, isTriggerNode, NodeRunningStatus } from '@/app/components/workflow/types'
|
|
|
|
export const getNodeStatusBorders = (
|
|
runningStatus: NodeRunningStatus | undefined,
|
|
hasVarValue: boolean,
|
|
showSelectedBorder: boolean,
|
|
) => {
|
|
return {
|
|
showRunningBorder: (runningStatus === NodeRunningStatus.Running || runningStatus === NodeRunningStatus.Paused) && !showSelectedBorder,
|
|
showSuccessBorder: (runningStatus === NodeRunningStatus.Succeeded || (hasVarValue && !runningStatus)) && !showSelectedBorder,
|
|
showFailedBorder: runningStatus === NodeRunningStatus.Failed && !showSelectedBorder,
|
|
showExceptionBorder: runningStatus === NodeRunningStatus.Exception && !showSelectedBorder,
|
|
}
|
|
}
|
|
|
|
export const getLoopIndexTextKey = (runningStatus: NodeRunningStatus | undefined) => {
|
|
if (runningStatus === NodeRunningStatus.Running)
|
|
return 'nodes.loop.currentLoopCount'
|
|
if (runningStatus === NodeRunningStatus.Succeeded || runningStatus === NodeRunningStatus.Failed)
|
|
return 'nodes.loop.totalLoopCount'
|
|
|
|
return undefined
|
|
}
|
|
|
|
export const isEntryWorkflowNode = (type: NodeProps['data']['type']) => {
|
|
return isTriggerNode(type) || type === BlockEnum.Start
|
|
}
|
|
|
|
export const isContainerNode = (type: NodeProps['data']['type']) => {
|
|
return type === BlockEnum.Iteration || type === BlockEnum.Loop
|
|
}
|