|
|
|
|
@ -14,6 +14,17 @@ export const convertAppFlowData = (appFlowData: any[]) => {
|
|
|
|
|
|
|
|
|
|
// 处理每个应用流程数据项(每个应用作为一个节点)
|
|
|
|
|
appFlowData.forEach((app: any, index: number) => {
|
|
|
|
|
// 添加过滤逻辑:如果 eventListenes 和 eventSends 都为空,则不生成节点
|
|
|
|
|
const hasEventListenes = app.eventListenes && app.eventListenes.length > 0 &&
|
|
|
|
|
app.eventListenes.some((event: any) => event && !event.topic?.includes('**empty**'));
|
|
|
|
|
const hasEventSends = app.eventSends && app.eventSends.length > 0 &&
|
|
|
|
|
app.eventSends.some((event: any) => event && !event.topic?.includes('**empty**'));
|
|
|
|
|
|
|
|
|
|
// 如果两者都为空,则跳过当前应用节点的创建
|
|
|
|
|
if (!hasEventListenes && !hasEventSends) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 构造节点数据
|
|
|
|
|
const node: any = {
|
|
|
|
|
id: app.appId || `app_${index}`,
|
|
|
|
|
@ -29,7 +40,7 @@ export const convertAppFlowData = (appFlowData: any[]) => {
|
|
|
|
|
dataType: '',
|
|
|
|
|
defaultValue: '',
|
|
|
|
|
topic: event.topic
|
|
|
|
|
})) : [],
|
|
|
|
|
})).filter((event: any) => event && !event.topic?.includes('**empty**')) : [],
|
|
|
|
|
// eventSends 作为 apiOuts(输出)
|
|
|
|
|
apiOuts: app.eventSends ? app.eventSends.map((event: any) => ({
|
|
|
|
|
name: event.eventName,
|
|
|
|
|
@ -37,7 +48,7 @@ export const convertAppFlowData = (appFlowData: any[]) => {
|
|
|
|
|
dataType: '',
|
|
|
|
|
defaultValue: '',
|
|
|
|
|
topic: event.topic
|
|
|
|
|
})) : [],
|
|
|
|
|
})).filter((event: any) => event && !event.topic?.includes('**empty**')) : [],
|
|
|
|
|
// 提取 dataIns 和 dataOuts 属性
|
|
|
|
|
dataIns: [],
|
|
|
|
|
dataOuts: []
|
|
|
|
|
|