|
|
|
@ -130,7 +130,6 @@ export const useFlowCallbacks = (
|
|
|
|
if (!sourceNode || !targetNode) {
|
|
|
|
if (!sourceNode || !targetNode) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取源节点和目标节点的参数信息
|
|
|
|
// 获取源节点和目标节点的参数信息
|
|
|
|
const sourceParams: any = sourceNode.data?.parameters || {};
|
|
|
|
const sourceParams: any = sourceNode.data?.parameters || {};
|
|
|
|
const targetParams: any = targetNode.data?.parameters || {};
|
|
|
|
const targetParams: any = targetNode.data?.parameters || {};
|
|
|
|
@ -181,10 +180,8 @@ export const useFlowCallbacks = (
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 检查源节点和目标节点是否都有事件信息
|
|
|
|
// 检查源节点和目标节点是否都有事件信息
|
|
|
|
const sourceApi = (sourceParams.apiOuts || []).find((api: any) =>
|
|
|
|
const sourceApi = (sourceParams.apiOuts || []).find((api: any) => (api?.eventId || api.name || api.id) === params.sourceHandle);
|
|
|
|
api.name === params.sourceHandle || api.id === params.sourceHandle);
|
|
|
|
const targetApi = (targetParams.apiIns || []).find((api: any) => (api?.eventId || api.name || api.id) === params.targetHandle);
|
|
|
|
const targetApi = (targetParams.apiIns || []).find((api: any) =>
|
|
|
|
|
|
|
|
api.name === params.targetHandle || api.id === params.targetHandle);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果源节点有事件topic信息
|
|
|
|
// 如果源节点有事件topic信息
|
|
|
|
if (sourceApi && sourceApi.topic) {
|
|
|
|
if (sourceApi && sourceApi.topic) {
|
|
|
|
@ -192,8 +189,9 @@ export const useFlowCallbacks = (
|
|
|
|
if (!targetApi || !targetApi.topic || targetApi.topic.includes('**empty**')) {
|
|
|
|
if (!targetApi || !targetApi.topic || targetApi.topic.includes('**empty**')) {
|
|
|
|
edgeParams.data = {
|
|
|
|
edgeParams.data = {
|
|
|
|
...edgeParams.data,
|
|
|
|
...edgeParams.data,
|
|
|
|
|
|
|
|
lineType: 'api',
|
|
|
|
displayData: {
|
|
|
|
displayData: {
|
|
|
|
name: sourceApi.name,
|
|
|
|
name: sourceApi.eventName,
|
|
|
|
eventId: sourceApi.eventId,
|
|
|
|
eventId: sourceApi.eventId,
|
|
|
|
topic: sourceApi.topic
|
|
|
|
topic: sourceApi.topic
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -205,8 +203,9 @@ export const useFlowCallbacks = (
|
|
|
|
!targetApi.topic.includes('**empty**')) {
|
|
|
|
!targetApi.topic.includes('**empty**')) {
|
|
|
|
edgeParams.data = {
|
|
|
|
edgeParams.data = {
|
|
|
|
...edgeParams.data,
|
|
|
|
...edgeParams.data,
|
|
|
|
|
|
|
|
lineType: 'api',
|
|
|
|
displayData: {
|
|
|
|
displayData: {
|
|
|
|
name: sourceApi.name,
|
|
|
|
name: sourceApi.eventName,
|
|
|
|
eventId: sourceApi.eventId,
|
|
|
|
eventId: sourceApi.eventId,
|
|
|
|
topic: sourceApi.topic
|
|
|
|
topic: sourceApi.topic
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -217,8 +216,9 @@ export const useFlowCallbacks = (
|
|
|
|
else if (targetApi && targetApi.topic && !targetApi.topic.includes('**empty**')) {
|
|
|
|
else if (targetApi && targetApi.topic && !targetApi.topic.includes('**empty**')) {
|
|
|
|
edgeParams.data = {
|
|
|
|
edgeParams.data = {
|
|
|
|
...edgeParams.data,
|
|
|
|
...edgeParams.data,
|
|
|
|
|
|
|
|
lineType: 'api',
|
|
|
|
displayData: {
|
|
|
|
displayData: {
|
|
|
|
name: targetApi.name,
|
|
|
|
name: targetApi.eventName,
|
|
|
|
eventId: targetApi.eventId,
|
|
|
|
eventId: targetApi.eventId,
|
|
|
|
topic: targetApi.topic
|
|
|
|
topic: targetApi.topic
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -257,8 +257,8 @@ export const useFlowCallbacks = (
|
|
|
|
const sourceHandleType = getHandleType(newConnection.sourceHandle, sourceParams);
|
|
|
|
const sourceHandleType = getHandleType(newConnection.sourceHandle, sourceParams);
|
|
|
|
const targetHandleType = getHandleType(newConnection.targetHandle, targetParams);
|
|
|
|
const targetHandleType = getHandleType(newConnection.targetHandle, targetParams);
|
|
|
|
|
|
|
|
|
|
|
|
console.log("sourceHandleType:",sourceHandleType);
|
|
|
|
console.log('sourceHandleType:', sourceHandleType);
|
|
|
|
console.log("targetHandleType:",targetHandleType);
|
|
|
|
console.log('targetHandleType:', targetHandleType);
|
|
|
|
|
|
|
|
|
|
|
|
// 验证连接类型是否匹配 (api只能连api, data只能连data)
|
|
|
|
// 验证连接类型是否匹配 (api只能连api, data只能连data)
|
|
|
|
if (sourceHandleType !== targetHandleType) {
|
|
|
|
if (sourceHandleType !== targetHandleType) {
|
|
|
|
|