Selaa lähdekoodia

feat: 预览数据loading 中间表接口拆分

leo 1 vuosi sitten
vanhempi
commit
ef1141b240

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

@@ -2,11 +2,9 @@ import axios from 'axios';
 
 const axiosInstance = axios.create({
   // 腾讯云测试环境
-  baseURL: 'http://aihub-dag-test.digitalyili.com',
+  // baseURL: 'http://aihub-dag-test.digitalyili.com',
   // 电信云测试环境
-  // baseURL: 'http://aihub-dag-idctest.digitalyili.com',
-  // sxkj
-  // baseURL: 'http://aihub-dag.sxkj.com',
+  baseURL: 'http://aihub-dag-idctest.digitalyili.com',
   timeout: 1200000,
   headers: {
     'Content-Type': 'application/json;charset=UTF-8',

+ 0 - 2
packages/jldbq-extenison/src/api/config.ts

@@ -4,8 +4,6 @@ const config = {
   // endpoint: 'http://192.168.199.110:18082'
   // 电信云测试环境
   // endpoint: 'http://aihub-dag-idctest.digitalyili.com'
-  // sxkj
-  // endpoint: 'http://aihub-dag.sxkj.com'
 };
 
 export default config;

+ 28 - 4
packages/yili-dag/src/Dag.tsx

@@ -15,6 +15,7 @@ import {
   debugStatus,
   getNodeLog,
   getNodeResult,
+  getNodeResultInfo,
   saveNodeTable
 } from './request';
 import copy from 'copy-to-clipboard';
@@ -208,6 +209,7 @@ export default class Dag extends React.Component<any, any> {
       logData: '暂无数据',
       nodeTableData: [],
       nodeTableCol: [],
+      tableLoading: false,
       nodeTablePins: [],
       nodeTableInfo: {},
       selectedPin: 0,
@@ -434,13 +436,15 @@ export default class Dag extends React.Component<any, any> {
       node_id: nodeId,
       out_pin: out_pin
     };
-    const { data } = await getNodeResult(params);
+    this.fetchTableInfo(params);
+    this.fetchResultTable(params);
+  };
+
+  fetchTableInfo = async (params: any) => {
+    const { data } = await getNodeResultInfo(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: table_name,
         nodeTableInfo: {
           location,
@@ -453,6 +457,25 @@ export default class Dag extends React.Component<any, any> {
     }
   };
 
+  fetchResultTable = async (params: any) => {
+    this.setState({
+      tableLoading: true
+    });
+    const { data } = await getNodeResult(params);
+    if (data.code === 200) {
+      const { col, tableData } = this.formatTableData(data.data);
+      this.setState({
+        nodeTableCol: col,
+        nodeTableData: tableData
+      });
+    } else {
+      // message.error(data.msg);
+    }
+    this.setState({
+      tableLoading: false
+    });
+  };
+
   handleOpenTable = async () => {
     const menuNode = this.state.contextMenuNode;
     const out_pins = menuNode
@@ -982,6 +1005,7 @@ export default class Dag extends React.Component<any, any> {
           <Table
             columns={this.state.nodeTableCol}
             dataSource={this.state.nodeTableData}
+            loading={this.state.tableLoading}
             pagination={{ pageSize: 20 }}
             scroll={{ x: this.state.nodeTableCol.length * 250, y: 450 }}
           />

+ 7 - 1
packages/yili-dag/src/ScriptNodeInfo.tsx

@@ -33,6 +33,7 @@ export default class ScriptNodeInfo extends React.Component<any, any> {
       outputNumber: 1,
       columns: [],
       tableData: [],
+      tableLoading: false,
       editorValue: '',
       nodeName: ''
     };
@@ -146,7 +147,8 @@ export default class ScriptNodeInfo extends React.Component<any, any> {
   changeCollapse = async (val: any) => {
     this.setState({
       columns: [],
-      tableData: []
+      tableData: [],
+      tableLoading: true
     });
     if (this.props.scriptInputs[val]?.source_type === 'InputSource') {
       const { data } = await getSqlDsTable(
@@ -176,6 +178,9 @@ export default class ScriptNodeInfo extends React.Component<any, any> {
         }
       }
     }
+    this.setState({
+      tableLoading: false
+    });
   };
 
   formatTableData = (data: any) => {
@@ -400,6 +405,7 @@ export default class ScriptNodeInfo extends React.Component<any, any> {
                           bordered
                           columns={this.state.columns}
                           dataSource={this.state.tableData}
+                          loading={this.state.tableLoading}
                           scroll={{
                             x: this.state.columns.length * 250,
                             y: 400

+ 11 - 6
packages/yili-dag/src/request.ts

@@ -2,11 +2,9 @@ import axios from 'axios';
 
 const request = axios.create({
   // 腾讯云测试环境
-  baseURL: 'http://aihub-dag-test.digitalyili.com',
+  // baseURL: 'http://aihub-dag-test.digitalyili.com',
   // 电信云测试环境
-  // baseURL: 'http://aihub-dag-idctest.digitalyili.com',
-  // sxkj
-  // baseURL: 'http://aihub-dag.sxkj.com',
+  baseURL: 'http://aihub-dag-idctest.digitalyili.com',
   timeout: 1200000,
   headers: {
     'Content-Type': 'application/json;charset=UTF-8',
@@ -118,10 +116,17 @@ export const getNodeLog = (params: any) =>
     method: 'get'
   });
 
-// 节点中间结果
+// 节点中间结果
 export const getNodeResult = (params: any) =>
   request({
-    url: `/jpt/dag/node_result?dag_uuid=${params.dag_uuid}&node_id=${params.node_id}&out_pin=${params.out_pin}`,
+    url: `/jpt/dag/node_result_data?dag_uuid=${params.dag_uuid}&node_id=${params.node_id}&out_pin=${params.out_pin}`,
+    method: 'get'
+  });
+
+// 节点中间结果信息
+export const getNodeResultInfo = (params: any) =>
+  request({
+    url: `/jpt/dag/node_result_info?dag_uuid=${params.dag_uuid}&node_id=${params.node_id}&out_pin=${params.out_pin}`,
     method: 'get'
   });