From cd0ca9cae4a6050d475bc7814cf030881e8d08fa Mon Sep 17 00:00:00 2001 From: zhaoying Date: Thu, 19 Mar 2026 20:03:59 +0800 Subject: [PATCH] feat(web): end node support right port --- .../views/Workflow/components/PortClickHandler.tsx | 10 +--------- web/src/views/Workflow/constant.ts | 11 +---------- web/src/views/Workflow/hooks/useWorkflowGraph.ts | 6 +----- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/web/src/views/Workflow/components/PortClickHandler.tsx b/web/src/views/Workflow/components/PortClickHandler.tsx index cce82a5a..2cc0c3c5 100644 --- a/web/src/views/Workflow/components/PortClickHandler.tsx +++ b/web/src/views/Workflow/components/PortClickHandler.tsx @@ -2,7 +2,7 @@ * @Author: ZhaoYing * @Date: 2026-02-09 18:30:28 * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-03-20 11:24:26 + * @Last Modified time: 2026-03-24 11:11:56 */ import { useEffect, useState } from 'react'; import { Popover } from 'antd'; @@ -234,10 +234,6 @@ const PortClickHandler: React.FC = ({ graph }) => { const sourceNodeData = sourceNode?.getData(); const isChildOfLoop = sourceNodeData?.cycle && graph?.getNodes().find((n: any) => n.getData()?.id === sourceNodeData.cycle && n.getData()?.type === 'loop'); const isChildOfIteration = sourceNodeData?.cycle && graph?.getNodes().find((n: any) => n.getData()?.id === sourceNodeData.cycle && n.getData()?.type === 'iteration'); - - const sourcePortInfo = sourceNode?.getPorts().find((p: any) => p.id === sourcePort); - const sourcePortGroup = sourcePortInfo?.group || sourcePort; - const isLeftPort = sourcePortGroup === 'left'; let filteredNodes; if (isChildOfLoop) { @@ -252,10 +248,6 @@ const PortClickHandler: React.FC = ({ graph }) => { nodeType.type !== 'start' && nodeType.type !== 'cycle-start' && nodeType.type !== 'break' ); } - - if (isLeftPort) { - filteredNodes = filteredNodes.filter(nodeType => nodeType.type !== 'end'); - } if (filteredNodes.length === 0) return null; diff --git a/web/src/views/Workflow/constant.ts b/web/src/views/Workflow/constant.ts index ab15e7e5..6665bb86 100644 --- a/web/src/views/Workflow/constant.ts +++ b/web/src/views/Workflow/constant.ts @@ -2,7 +2,7 @@ * @Author: ZhaoYing * @Date: 2026-02-03 15:06:18 * @Last Modified by: ZhaoYing - * @Last Modified time: 2026-03-20 11:23:17 + * @Last Modified time: 2026-03-24 11:11:46 */ import LoopNode from './components/Nodes/LoopNode'; import NormalNode from './components/Nodes/NormalNode'; @@ -773,15 +773,6 @@ export const graphNodeLibrary: Record = { items: [defaultPortItems[1]], }, }, - end: { - width: nodeWidth, - height: 76, - shape: 'normal-node', - ports: { - groups: { left: defaultPortGroup}, - items: [defaultPortItems[0]], - }, - }, 'cycle-start': { width: 36, height: 36, diff --git a/web/src/views/Workflow/hooks/useWorkflowGraph.ts b/web/src/views/Workflow/hooks/useWorkflowGraph.ts index dbbbb3b6..86cb91d5 100644 --- a/web/src/views/Workflow/hooks/useWorkflowGraph.ts +++ b/web/src/views/Workflow/hooks/useWorkflowGraph.ts @@ -821,16 +821,12 @@ export const useWorkflowGraph = ({ // Node cannot connect to itself if (sourceCell?.id === targetCell?.id) return false; - - const sourceType = sourceCell?.getData()?.type; + const targetType = targetCell?.getData()?.type; // Start node cannot be connection target if (targetType === 'start') return false; - // End node cannot be connection source - if (sourceType === 'end') return false; - // Get source node and target node parent IDs const sourceParentId = sourceCell?.getData()?.cycle; const targetParentId = targetCell?.getData()?.cycle;