Jelajahi Sumber

fix: pin脚问题

leo 1 tahun lalu
induk
melakukan
f30547685a
3 mengubah file dengan 10 tambahan dan 3 penghapusan
  1. 0 1
      dagtest2.dag
  2. 1 1
      packages/yili-dag/src/request.ts
  3. 9 1
      packages/yili-dag/src/utils.ts

File diff ditekan karena terlalu besar
+ 0 - 1
dagtest2.dag


+ 1 - 1
packages/yili-dag/src/request.ts

@@ -156,7 +156,7 @@ export const getSchema = (table_name: string) =>
 // sql数据源表预览
 export const getSqlDsTable = (table_name: string) =>
   request({
-    url: `/jpt/datamanagement/table_content?table_name=${table_name}&page=${1}&size=${100}`,
+    url: `/jpt/dag/dag_node_content?table_name=${table_name}&page=${1}&size=${100}`,
     method: 'get'
   });
 

+ 9 - 1
packages/yili-dag/src/utils.ts

@@ -167,6 +167,7 @@ const generateInputs = (graph: any, id: any) => {
   const edges = graph.getIncomingEdges(id);
   if (edges?.length > 0) {
     edges.forEach((item: any, index: any) => {
+      // 获取source的输出pin脚
       const sourceNode = item.getSourceNode();
       const sourcePortID = item.getSourcePortId();
       const sourcePorts = sourceNode.getPortsByGroup('bottom');
@@ -177,7 +178,14 @@ const generateInputs = (graph: any, id: any) => {
           : sourcePorts.indexOf(
               sourcePorts.find((item: any) => item.id === sourcePortID)
             );
-      inputsResult[`input${index}`] = [sourceId, portNumber];
+      // 获取target输入pin脚
+      const targetNode = item.getTargetNode();
+      const targetPortID = item.getTargetPortId();
+      const targetPorts = targetNode.getPortsByGroup('top');
+      const inputPortIndex = targetPorts.indexOf(
+        targetPorts.find((item: any) => item.id === targetPortID)
+      );
+      inputsResult[`input${inputPortIndex}`] = [sourceId, portNumber];
     });
   }
   return inputsResult;

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini