diff --git a/frontend/src/components/canvas/CanvasContainer.tsx b/frontend/src/components/canvas/CanvasContainer.tsx index 2e74c83..9ec2726 100644 --- a/frontend/src/components/canvas/CanvasContainer.tsx +++ b/frontend/src/components/canvas/CanvasContainer.tsx @@ -78,6 +78,11 @@ export function CanvasContainer({ onConnect: onConnectProp, onEdgeDoubleClick, o return true }, [snapshotHistory]) + const isValidConnection = useCallback( + (connection: { source: string | null; target: string | null }) => connection.source !== connection.target, + [] + ) + return (
connection.source !== connection.target} + isValidConnection={isValidConnection} > ({ maskIp: (ip: string) => ip, })) +vi.mock('@/utils/propertyIcons', () => ({ + resolvePropertyIcon: (icon: string | null) => icon ? Server : null, +})) + vi.mock('@/utils/handleUtils', () => ({ BOTTOM_HANDLE_IDS: ['bottom'], BOTTOM_HANDLE_POSITIONS: { 1: [50] }, })) +beforeEach(() => { mockZoom = 1 }) + function makeNode(data: Partial): Node { return { id: 'n1', diff --git a/frontend/src/components/canvas/nodes/BaseNode.tsx b/frontend/src/components/canvas/nodes/BaseNode.tsx index e760c87..8b95b7e 100644 --- a/frontend/src/components/canvas/nodes/BaseNode.tsx +++ b/frontend/src/components/canvas/nodes/BaseNode.tsx @@ -115,10 +115,10 @@ export function BaseNode({ id, data, selected, icon: typeIcon, width, height }: <>
- {visibleProperties.map((prop, i) => { + {visibleProperties.map((prop) => { const Icon = resolvePropertyIcon(prop.icon) return ( -
+
{Icon && } {prop.key} ยท {prop.value}