feat(web): end node support right port

This commit is contained in:
zhaoying
2026-03-19 20:03:59 +08:00
parent 3369b702e4
commit cd0ca9cae4
3 changed files with 3 additions and 24 deletions

View File

@@ -2,7 +2,7 @@
* @Author: ZhaoYing * @Author: ZhaoYing
* @Date: 2026-02-09 18:30:28 * @Date: 2026-02-09 18:30:28
* @Last Modified by: ZhaoYing * @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 { useEffect, useState } from 'react';
import { Popover } from 'antd'; import { Popover } from 'antd';
@@ -235,10 +235,6 @@ const PortClickHandler: React.FC<PortClickHandlerProps> = ({ graph }) => {
const isChildOfLoop = sourceNodeData?.cycle && graph?.getNodes().find((n: any) => n.getData()?.id === sourceNodeData.cycle && n.getData()?.type === 'loop'); 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 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; let filteredNodes;
if (isChildOfLoop) { if (isChildOfLoop) {
// Use same filtering as AddNode for child nodes of loop, but allow break // Use same filtering as AddNode for child nodes of loop, but allow break
@@ -253,10 +249,6 @@ const PortClickHandler: React.FC<PortClickHandlerProps> = ({ graph }) => {
); );
} }
if (isLeftPort) {
filteredNodes = filteredNodes.filter(nodeType => nodeType.type !== 'end');
}
if (filteredNodes.length === 0) return null; if (filteredNodes.length === 0) return null;
return ( return (

View File

@@ -2,7 +2,7 @@
* @Author: ZhaoYing * @Author: ZhaoYing
* @Date: 2026-02-03 15:06:18 * @Date: 2026-02-03 15:06:18
* @Last Modified by: ZhaoYing * @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 LoopNode from './components/Nodes/LoopNode';
import NormalNode from './components/Nodes/NormalNode'; import NormalNode from './components/Nodes/NormalNode';
@@ -773,15 +773,6 @@ export const graphNodeLibrary: Record<string, NodeConfig> = {
items: [defaultPortItems[1]], items: [defaultPortItems[1]],
}, },
}, },
end: {
width: nodeWidth,
height: 76,
shape: 'normal-node',
ports: {
groups: { left: defaultPortGroup},
items: [defaultPortItems[0]],
},
},
'cycle-start': { 'cycle-start': {
width: 36, width: 36,
height: 36, height: 36,

View File

@@ -822,15 +822,11 @@ export const useWorkflowGraph = ({
// Node cannot connect to itself // Node cannot connect to itself
if (sourceCell?.id === targetCell?.id) return false; if (sourceCell?.id === targetCell?.id) return false;
const sourceType = sourceCell?.getData()?.type;
const targetType = targetCell?.getData()?.type; const targetType = targetCell?.getData()?.type;
// Start node cannot be connection target // Start node cannot be connection target
if (targetType === 'start') return false; if (targetType === 'start') return false;
// End node cannot be connection source
if (sourceType === 'end') return false;
// Get source node and target node parent IDs // Get source node and target node parent IDs
const sourceParentId = sourceCell?.getData()?.cycle; const sourceParentId = sourceCell?.getData()?.cycle;
const targetParentId = targetCell?.getData()?.cycle; const targetParentId = targetCell?.getData()?.cycle;