Bladeren bron

Merge branch 'yili' of http://gogsb.soaringnova.com/ylproj/jupyterlab into yili

Zhang Li 1 jaar geleden
bovenliggende
commit
581bd2dd40

+ 15 - 15
packages/application-extension/src/index.tsx

@@ -303,21 +303,21 @@ const mainCommands: JupyterFrontEndPlugin<void> = {
         isVisible: () => !labShell.isEmpty('left')
       });
 
-      commands.addCommand(CommandIDs.toggleRightArea, {
-        label: () => trans.__('Show Right Sidebar'),
-        execute: () => {
-          if (labShell.rightCollapsed) {
-            labShell.expandRight();
-          } else {
-            labShell.collapseRight();
-            if (labShell.currentWidget) {
-              labShell.activateById(labShell.currentWidget.id);
-            }
-          }
-        },
-        isToggled: () => !labShell.rightCollapsed,
-        isVisible: () => !labShell.isEmpty('right')
-      });
+      // commands.addCommand(CommandIDs.toggleRightArea, {
+      //   label: () => trans.__('Show Right Sidebar'),
+      //   execute: () => {
+      //     if (labShell.rightCollapsed) {
+      //       labShell.expandRight();
+      //     } else {
+      //       labShell.collapseRight();
+      //       if (labShell.currentWidget) {
+      //         labShell.activateById(labShell.currentWidget.id);
+      //       }
+      //     }
+      //   },
+      //   isToggled: () => !labShell.rightCollapsed,
+      //   isVisible: () => !labShell.isEmpty('right')
+      // });
 
       commands.addCommand(CommandIDs.togglePresentationMode, {
         label: () => trans.__('Presentation Mode'),

+ 2 - 2
packages/application/src/shell.ts

@@ -333,7 +333,7 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
     // hsplitPanel.addWidget(rightHandler.stackedPanel);
 
     vsplitPanel.addWidget(hsplitPanel);
-    // vsplitPanel.addWidget(downPanel);
+    vsplitPanel.addWidget(downPanel);
 
     hboxPanel.addWidget(leftHandler.sideBar);
     hboxPanel.addWidget(vsplitPanel);
@@ -358,7 +358,7 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
     rootLayout.addWidget(headerPanel);
     rootLayout.addWidget(topHandler.panel);
     rootLayout.addWidget(hboxPanel);
-    // rootLayout.addWidget(bottomPanel);
+    rootLayout.addWidget(bottomPanel);
 
     // initially hiding header and bottom panel when no elements inside,
     this._headerPanel.hide();

+ 1 - 1
packages/extensionmanager-extension/schema/plugin.json

@@ -58,4 +58,4 @@
   },
   "additionalProperties": false,
   "type": "object"
-}
+}

+ 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.length * 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.length * 250, y: 250 }}
         />
       </div>
     );

+ 19 - 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,15 @@ 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.length * 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({

File diff suppressed because it is too large
+ 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":[]}}

Some files were not shown because too many files changed in this diff