فهرست منبع

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

Zhang Li 1 سال پیش
والد
کامیت
363b64f8e2
3فایلهای تغییر یافته به همراه48 افزوده شده و 36 حذف شده
  1. 35 35
      packages/filebrowser-extension/src/index.ts
  2. 1 0
      packages/filebrowser/package.json
  3. 12 1
      packages/yili-dag/src/ToolBar.tsx

+ 35 - 35
packages/filebrowser-extension/src/index.ts

@@ -29,7 +29,7 @@ import { IDocumentManager } from '@jupyterlab/docmanager';
 import { DocumentRegistry } from '@jupyterlab/docregistry';
 import {
   FileBrowser,
-  // FileUploadStatus,
+  FileUploadStatus,
   FilterFileBrowserModel,
   IFileBrowserCommands,
   IFileBrowserFactory,
@@ -39,7 +39,7 @@ import { Launcher } from '@jupyterlab/launcher';
 import { Contents } from '@jupyterlab/services';
 import { ISettingRegistry } from '@jupyterlab/settingregistry';
 import { IStateDB } from '@jupyterlab/statedb';
-// import { IStatusBar } from '@jupyterlab/statusbar';
+import { IStatusBar } from '@jupyterlab/statusbar';
 import { ITranslator } from '@jupyterlab/translation';
 import {
   // addIcon,
@@ -687,39 +687,39 @@ const openWithPlugin: JupyterFrontEndPlugin<void> = {
 /**
  * A plugin providing file upload status.
  */
-// export const fileUploadStatus: JupyterFrontEndPlugin<void> = {
-//   id: '@jupyterlab/filebrowser-extension:file-upload-status',
-//   autoStart: true,
-//   requires: [IFileBrowserFactory, ITranslator],
-//   optional: [IStatusBar],
-//   activate: (
-//     app: JupyterFrontEnd,
-//     browser: IFileBrowserFactory,
-//     translator: ITranslator,
-//     statusBar: IStatusBar | null
-//   ) => {
-//     if (!statusBar) {
-//       // Automatically disable if statusbar missing
-//       return;
-//     }
-//     const item = new FileUploadStatus({
-//       tracker: browser.tracker,
-//       translator
-//     });
+export const fileUploadStatus: JupyterFrontEndPlugin<void> = {
+  id: '@jupyterlab/filebrowser-extension:file-upload-status',
+  autoStart: true,
+  requires: [IFileBrowserFactory, ITranslator],
+  optional: [IStatusBar],
+  activate: (
+    app: JupyterFrontEnd,
+    browser: IFileBrowserFactory,
+    translator: ITranslator,
+    statusBar: IStatusBar | null
+  ) => {
+    if (!statusBar) {
+      // Automatically disable if statusbar missing
+      return;
+    }
+    const item = new FileUploadStatus({
+      tracker: browser.tracker,
+      translator
+    });
 
-//     statusBar.registerStatusItem(
-//       '@jupyterlab/filebrowser-extension:file-upload-status',
-//       {
-//         item,
-//         align: 'middle',
-//         isActive: () => {
-//           return !!item.model && item.model.items.length > 0;
-//         },
-//         activeStateChanged: item.model.stateChanged
-//       }
-//     );
-//   }
-// };
+    statusBar.registerStatusItem(
+      '@jupyterlab/filebrowser-extension:file-upload-status',
+      {
+        item,
+        align: 'middle',
+        isActive: () => {
+          return !!item.model && item.model.items.length > 0;
+        },
+        activeStateChanged: item.model.stateChanged
+      }
+    );
+  }
+};
 
 /**
  * A plugin to open files from remote URLs
@@ -1352,7 +1352,7 @@ const plugins: JupyterFrontEndPlugin<any>[] = [
   factory,
   browser,
   // shareFile,
-  // fileUploadStatus,
+  fileUploadStatus,
   // downloadPlugin,
   browserWidget,
   openWithPlugin

+ 1 - 0
packages/filebrowser/package.json

@@ -63,6 +63,7 @@
     "@lumino/widgets": "^1.30.0",
     "@mui/material": "^5.8.1",
     "antd": "^4.22.8",
+    "axios": "^0.27.2",
     "moment": "^2.29.4",
     "react": "^17.0.1",
     "swr": "^1.3.0"

+ 12 - 1
packages/yili-dag/src/ToolBar.tsx

@@ -107,10 +107,21 @@ export default class ToolBar extends React.Component<any, any> {
       const dagJson: any = text.model.toJSON();
       const { data } = await getRequirementsStatus(this.props.dagId);
       if (data.code === 200) {
+        let status = '暂无依赖';
+        if (data.data !== '暂无依赖') {
+          status =
+            data.data.status === 0
+              ? '队列中'
+              : data.data.status === 1
+              ? '运行中'
+              : data.data.status === 2
+              ? '成功'
+              : '失败';
+        }
         this.setState({
           modalVisible: true,
           packageData: dagJson.requirements,
-          status: data.data
+          status
         });
       } else {
         message.success(data.msg);