2 次代码提交 581bd2dd40 ... 5765e3dfb7

作者 SHA1 备注 提交日期
  Leo 5765e3dfb7 Merge branch 'yili' of http://gogsb.soaringnova.com/ylproj/jupyterlab into yili 1 年之前
  Leo ef37be0bd5 fix: bug修复 1 年之前

文件差异内容过多而无法显示
+ 0 - 0
dagtest2.dag


+ 0 - 2
packages/filebrowser/src/api/config.ts

@@ -3,8 +3,6 @@ import axios from 'axios';
 const axiosInstance = axios.create({
   // 腾讯云测试环境
   baseURL: 'http://aihub-dag-test.digitalyili.com',
-  // 本地开发
-  // baseURL: 'http://192.168.199.110:18082',
   // 电信云测试环境
   // baseURL: 'http://aihub-dag-idctest.digitalyili.com',
   // sxkj

+ 1 - 0
packages/filebrowser/src/datamanage.tsx

@@ -82,6 +82,7 @@ const DataManage: React.FC<IProps> = props => {
   };
 
   const fetchTableStatus = async (table: any) => {
+    console.log(table);
     if (table.status === 1) {
       const { data } = await uploadTableStatus(table.id);
       if (data.code === 200) {

+ 22 - 18
packages/filebrowser/src/dataview.tsx

@@ -10,21 +10,25 @@ interface IProps {
 }
 
 export const DagDataView: React.FC<IProps> = ({ data, info, changePage }) => {
-  const columns: any = data.fields.map((item: any) => {
-    return {
-      title: item,
-      dataIndex: item,
-      key: item
-    };
-  });
-  const tableData: any = data.dataList.map((item: any, index: number) => {
-    const formatData = {} as Record<string, any>;
-    formatData['key'] = index;
-    columns.map((val: any, index: number) => {
-      formatData[val.title] = item[index];
-    });
-    return formatData;
-  });
+  const columns: any = data
+    ? data.fields.map((item: any) => {
+        return {
+          title: item,
+          dataIndex: item,
+          key: item
+        };
+      })
+    : [];
+  const tableData: any = data
+    ? data.dataList.map((item: any, index: number) => {
+        const formatData = {} as Record<string, any>;
+        formatData['key'] = index;
+        columns.map((val: any, index: number) => {
+          formatData[val.title] = item[index];
+        });
+        return formatData;
+      })
+    : [];
 
   const pageChange = (page: number, pageSize: number) => {
     changePage(page, pageSize);
@@ -32,8 +36,8 @@ export const DagDataView: React.FC<IProps> = ({ data, info, changePage }) => {
 
   return (
     <div className="dataview_wrapper">
-      <div className="dataview_info" style={{ display: 'none' }}>
-        <div className="table_name">{info.name}</div>
+      <div className="dataview_info">
+        <div className="table_name">{info.table_name}</div>
         <div className="dataview_row">
           <div className="dataview_item">
             <span className="dataview_label">数据类型</span>
@@ -81,7 +85,7 @@ export const DagDataView: React.FC<IProps> = ({ data, info, changePage }) => {
         dataSource={tableData}
         scroll={{ x: columns.length * 250, y: 250 }}
         pagination={{
-          total: data.total,
+          total: data?.total,
           onChange: pageChange
         }}
       />

+ 49 - 47
packages/yili-dag/src/Dag.tsx

@@ -209,6 +209,7 @@ export default class Dag extends React.Component<any, any> {
       nodeTableData: [],
       nodeTableCol: [],
       nodeTablePins: [],
+      nodeTableInfo: {},
       selectedPin: 0,
       filename: '',
       currentDblNode: '',
@@ -326,6 +327,7 @@ export default class Dag extends React.Component<any, any> {
     });
   };
 
+  // 处理节点跳过标记,当执行节点在已执行节点或input节点下时不跳过已经执行节点和input
   formatNodeData = (script_nodes: any) => {
     const menuNode = this.state.contextMenuNode;
     const allNodes = this.state.dagGraph.getNodes();
@@ -334,18 +336,22 @@ export default class Dag extends React.Component<any, any> {
     ).inputs;
     const keys = Object.keys(inputs);
     let format_nodes = [] as any;
-    keys.forEach((key: any) => {
-      const input_id = inputs[key][0];
-      const input_type = allNodes.find(
-        (item: any) => item.data.nodeId === input_id
-      ).data.type;
-      format_nodes = script_nodes.map((item: any) => {
-        if (item.id === input_id && input_type === 'datasource') {
-          item.skip = false;
-        }
-        return item;
+    if (keys.length) {
+      keys.forEach((key: any) => {
+        const input_id = inputs[key][0];
+        const input_type = allNodes.find(
+          (item: any) => item.data.nodeId === input_id
+        ).data.type;
+        format_nodes = script_nodes.map((item: any) => {
+          if (item.id === input_id && input_type === 'datasource') {
+            item.skip = false;
+          }
+          return item;
+        });
       });
-    });
+    } else {
+      format_nodes = script_nodes;
+    }
     return format_nodes;
   };
 
@@ -430,11 +436,17 @@ export default class Dag extends React.Component<any, any> {
     };
     const { data } = await getNodeResult(params);
     if (data.code === 200) {
+      const { table_name, location, owner, share } = data.data;
       const { col, tableData } = this.formatTableData(data.data);
       this.setState({
         nodeTableCol: col,
         nodeTableData: tableData,
-        resultTableName: data.data.table_name
+        resultTableName: table_name,
+        nodeTableInfo: {
+          location,
+          owner,
+          share: share ? '是' : '否'
+        }
       });
     } else {
       // message.error(data.msg);
@@ -861,6 +873,7 @@ export default class Dag extends React.Component<any, any> {
     }
   };
 
+  //递归更新链路节点
   updateNodeStatus = (nodeId: any, edges: any) => {
     edges.forEach((edge: any) => {
       const source = edge.getSourceNode().getData();
@@ -879,43 +892,18 @@ export default class Dag extends React.Component<any, any> {
     });
   };
 
+  //修改数据之后将节点状态更新成为执行
   saveChangeStatus = (nodeId: any) => {
     const allEdges = this.state.dagGraph.getEdges();
-    let current_target = '' as any;
-    let current_edge = '' as any;
-    allEdges.forEach((edge: any) => {
-      const target = edge.getTargetNode().getData();
-      // 将当前点击节点状态改为未执行
-      if (target.nodeId === nodeId && target.type === 'script') {
-        current_target = target;
-        current_edge = edge;
-      }
-    });
-    if (current_edge) {
-      current_edge?.getTargetNode().setData(
-        {
-          ...current_target,
-          status: 'undone'
-        },
-        { overwrite: true }
-      );
-    }
-    // 只有一个节点的时候
-    if (allEdges.length === 0) {
-      const current_node = this.state.dagGraph.getNodes();
-      const data = current_node[0].getData();
-      if (data.type === 'script') {
-        current_node[0].setData(
-          {
-            ...data,
-            status: 'undone'
-          },
-          {
-            overwrite: true
-          }
-        );
-      }
-    }
+    //更新选择节点
+    const current_node = this.state.currentDblNode;
+    current_node.setData(
+      {
+        ...current_node.getData(),
+        status: 'undone'
+      },
+      { overwrite: true }
+    );
     this.updateNodeStatus(nodeId, allEdges);
   };
 
@@ -977,6 +965,20 @@ export default class Dag extends React.Component<any, any> {
               </span>
             </div>
           </div>
+          <div className="test_table_info">
+            <p>
+              创建者:
+              {this.state.nodeTableInfo.owner}
+            </p>
+            <p>
+              存储路径:
+              {this.state.nodeTableInfo.location}
+            </p>
+            <p>
+              共享信息:
+              {this.state.nodeTableInfo.share}
+            </p>
+          </div>
           <Table
             columns={this.state.nodeTableCol}
             dataSource={this.state.nodeTableData}

+ 0 - 2
packages/yili-dag/src/request.ts

@@ -3,8 +3,6 @@ import axios from 'axios';
 const request = axios.create({
   // 腾讯云测试环境
   baseURL: 'http://aihub-dag-test.digitalyili.com',
-  // 本地开发
-  // baseURL: 'http://192.168.199.110:18082',
   // 电信云测试环境
   // baseURL: 'http://aihub-dag-idctest.digitalyili.com',
   // sxkj

+ 7 - 0
packages/yili-dag/style/Dag.css

@@ -64,6 +64,13 @@
   margin-left: 24px;
   cursor: pointer;
 }
+.test_table_info {
+  font-size: 12px;
+  font-family: PingFangSC-Medium, PingFang SC;
+  font-weight: 500;
+  color: #4a4a4a;
+  line-height: 20px;
+}
 .toolbars_label {
   font-family: PingFangSC-Regular, PingFang SC;
   font-weight: 400;

+ 3 - 2
packages/yili-dag/style/ScriptNodeInfo.css

@@ -14,12 +14,13 @@
 }
 
 .modal-table {
-  flex: 1;
+  width: 40%;
   overflow: auto;
 }
 
 .modal-script {
-  flex: 1;
+  width: 60%;
+  overflow: auto;
   border: 1px solid #ddd;
   display: flex;
   flex-direction: column;

文件差异内容过多而无法显示
+ 0 - 0
untitled.dag


部分文件因为文件数量过多而无法显示