Ver código fonte

feat: 数据预览

Leo 1 ano atrás
pai
commit
212ec40e1f

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

@@ -24,4 +24,40 @@ axiosInstance.interceptors.request.use((config: any) => {
   return config;
 });
 
+//响应拦截器
+axiosInstance.interceptors.response.use(
+  response => {
+    if (response.status === 200) {
+      return Promise.resolve(response);
+    } else {
+      return Promise.reject(response);
+    }
+  },
+  error => {
+    if (error.response.status) {
+      switch (error.response.status) {
+        case 401:
+          error.response.data = {
+            code: 401,
+            msg: 'token过期'
+          };
+          break;
+        case 403:
+          error.response.data = {
+            code: 403,
+            msg: 'token不存在'
+          };
+          break;
+        default:
+          error.response.data = {
+            code: 404,
+            msg: '接口错误'
+          };
+          break;
+      }
+      return Promise.resolve(error.response);
+    }
+  }
+);
+
 export default axiosInstance;

+ 1 - 1
packages/filebrowser/src/dataview.tsx

@@ -79,7 +79,7 @@ export const DagDataView: React.FC<IProps> = ({ data, info, changePage }) => {
       <Table
         columns={columns}
         dataSource={tableData}
-        scroll={{ x: columns.length * 120, y: 250 }}
+        scroll={{ x: columns.length * 250, y: 250 }}
         pagination={{
           total: data.total,
           onChange: pageChange

+ 3 - 1
packages/yili-dag/src/Dag.tsx

@@ -261,6 +261,7 @@ export default class Dag extends React.Component<any, any> {
           out_pin,
           nodeId: source.nodeId,
           source_type: source.label,
+          source_state: source.status,
           source_tableName: source.dataTableName,
           target_type: target.label
         };
@@ -293,6 +294,7 @@ export default class Dag extends React.Component<any, any> {
     this.saveData();
     const { data } = await executeDag(params);
     if (data.code === 200) {
+      message.success('任务提交成功');
       setTimeout(() => {
         this.refreshNodeStatus();
       }, 10000);
@@ -979,7 +981,7 @@ export default class Dag extends React.Component<any, any> {
             columns={this.state.nodeTableCol}
             dataSource={this.state.nodeTableData}
             pagination={{ pageSize: 20 }}
-            scroll={{ x: this.state.nodeTableCol * 120, y: 450 }}
+            scroll={{ x: this.state.nodeTableCol * 250, y: 450 }}
           />
         </Modal>
         <Modal

+ 0 - 1
packages/yili-dag/src/DatasourceNodeInfo.tsx

@@ -104,7 +104,6 @@ export default class DatasourceNodeInfo extends React.Component<any, any> {
   submit() {
     const { inputDatasource, nodeName, tablePath, dataTable } = (this.formRef
       .current as any).getFieldsValue();
-    console.log(inputDatasource);
     if (nodeName) {
       if (inputDatasource.length) {
         if (inputDatasource.find((item: any) => item.dataSelect)) {

+ 1 - 1
packages/yili-dag/src/MediateDataInfo.tsx

@@ -96,7 +96,7 @@ export default class ToolBar extends React.Component<any, any> {
           columns={this.state.columns}
           dataSource={this.state.tableData}
           pagination={{ pageSize: 50 }}
-          scroll={{ x: this.state.columns * 120, y: 250 }}
+          scroll={{ x: this.state.columns * 250, y: 250 }}
         />
       </div>
     );

+ 16 - 22
packages/yili-dag/src/ScriptNodeInfo.tsx

@@ -144,10 +144,7 @@ export default class ScriptNodeInfo extends React.Component<any, any> {
   };
 
   changeCollapse = async (val: any) => {
-    if (
-      this.props.scriptInputs[val]?.target_type === 'sql' &&
-      this.props.scriptInputs[val]?.source_type === 'InputSource'
-    ) {
+    if (this.props.scriptInputs[val]?.source_type === 'InputSource') {
       const { data } = await getSqlDsTable(
         this.props.scriptInputs[val].source_tableName
       );
@@ -159,18 +156,20 @@ export default class ScriptNodeInfo extends React.Component<any, any> {
         });
       }
     } else {
-      const params = {
-        dag_uuid: this.props.dagId,
-        node_id: this.props.scriptInputs[val].nodeId,
-        out_pin: this.props.scriptInputs[val].out_pin
-      };
-      const { data } = await getNodeResult(params);
-      if (data.code === 200) {
-        const { col, tableData } = this.formatTableData(data.data);
-        this.setState({
-          columns: col,
-          tableData
-        });
+      if (this.props.scriptInputs[val]?.source_state === 'success') {
+        const params = {
+          dag_uuid: this.props.dagId,
+          node_id: this.props.scriptInputs[val].nodeId,
+          out_pin: this.props.scriptInputs[val].out_pin
+        };
+        const { data } = await getNodeResult(params);
+        if (data.code === 200) {
+          const { col, tableData } = this.formatTableData(data.data);
+          this.setState({
+            columns: col,
+            tableData
+          });
+        }
       }
     }
   };
@@ -397,17 +396,12 @@ export default class ScriptNodeInfo extends React.Component<any, any> {
                           bordered
                           columns={this.state.columns}
                           dataSource={this.state.tableData}
-                          scroll={{ x: this.state.columns * 120, y: 400 }}
+                          scroll={{ x: this.state.columns * 250, y: 400 }}
                           pagination={{ showSizeChanger: false }}
                         />
                       </div>
                     </Panel>
                   ))}
-                  {/* <Panel header="input1" key="1" style={{position: 'relative', paddingTop: 0}}>
-
-                  </Panel>
-                  <Panel header="input2" key="2"></Panel>
-                  <Panel header="input3" key="3"></Panel> */}
                 </Collapse>
               )}
             </div>

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

@@ -24,6 +24,42 @@ request.interceptors.request.use((config: any) => {
   return config;
 });
 
+//响应拦截器
+request.interceptors.response.use(
+  response => {
+    if (response.status === 200) {
+      return Promise.resolve(response);
+    } else {
+      return Promise.reject(response);
+    }
+  },
+  error => {
+    if (error.response.status) {
+      switch (error.response.status) {
+        case 401:
+          error.response.data = {
+            code: 401,
+            msg: 'token过期'
+          };
+          break;
+        case 403:
+          error.response.data = {
+            code: 403,
+            msg: 'token不存在'
+          };
+          break;
+        default:
+          error.response.data = {
+            code: 404,
+            msg: '接口错误'
+          };
+          break;
+      }
+      return Promise.resolve(error.response);
+    }
+  }
+);
+
 // 获取调试数据表
 export const getDebugTable = (params: any) =>
   request({

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
untitled.dag


+ 0 - 1
untitled1.dag

@@ -1 +0,0 @@
-{"dag_id":"b4IOpUcybv9s7z3T2T7pX","requirements":"132131212313","user_name":"XXX","user_id":1,"nodes_task_name":"dfs","nodes_task_id":123,"itermidate_data":["hdfs://host:port/uri"],"nodes":[],"edges":[],"graph":{"cells":[]}}

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff