Sfoglia il codice sorgente

Missed moving the file upload status item to the filebrowser package.

Ian Rose 6 anni fa
parent
commit
5e228a62f6

+ 33 - 2
packages/filebrowser-extension/src/index.ts

@@ -22,15 +22,16 @@ import { IDocumentManager } from '@jupyterlab/docmanager';
 import {
   FileBrowserModel,
   FileBrowser,
+  FileUpload,
   IFileBrowserFactory
 } from '@jupyterlab/filebrowser';
 
-import { fileUploadStatus } from './uploadstatus';
-
 import { Launcher } from '@jupyterlab/launcher';
 
 import { Contents } from '@jupyterlab/services';
 
+import { IStatusBar } from '@jupyterlab/statusbar';
+
 import { IIterator, map, reduce, toArray } from '@phosphor/algorithm';
 
 import { CommandRegistry } from '@phosphor/commands';
@@ -125,6 +126,36 @@ const shareFile: JupyterLabPlugin<void> = {
   autoStart: true
 };
 
+/**
+ * A plugin providing file upload status.
+ */
+export const fileUploadStatus: JupyterLabPlugin<void> = {
+  id: '@jupyterlab/filebrowser-extension:file-upload-status',
+  autoStart: true,
+  requires: [IStatusBar, IFileBrowserFactory],
+  activate: (
+    app: JupyterLab,
+    statusBar: IStatusBar,
+    browser: IFileBrowserFactory
+  ) => {
+    const item = new FileUpload({
+      tracker: browser.tracker
+    });
+
+    statusBar.registerStatusItem(
+      '@jupyterlab/filebrowser-extension:file-upload-status',
+      {
+        item,
+        align: 'middle',
+        isActive: () => {
+          return !!item.model && item.model.items.length > 0;
+        },
+        activeStateChanged: item.model.stateChanged
+      }
+    );
+  }
+};
+
 /**
  * The file browser namespace token.
  */

+ 14 - 47
packages/filebrowser-extension/src/uploadstatus.tsx → packages/filebrowser/src/uploadstatus.tsx

@@ -1,21 +1,18 @@
-import React from 'react';
-import { TextItem } from '@jupyterlab/statusbar';
-
-import { JupyterLabPlugin, JupyterLab } from '@jupyterlab/application';
+// Copyright (c) Jupyter Development Team.
+// Distributed under the terms of the Modified BSD License.
+//
 
-import {
-  IUploadModel,
-  FileBrowserModel,
-  IFileBrowserFactory,
-  FileBrowser
-} from '@jupyterlab/filebrowser';
+import { VDomRenderer, InstanceTracker, VDomModel } from '@jupyterlab/apputils';
 
 import { IChangedArgs } from '@jupyterlab/coreutils';
 
-import { ProgressBar } from '@jupyterlab/statusbar';
-import { VDomRenderer, InstanceTracker, VDomModel } from '@jupyterlab/apputils';
+import { GroupItem, ProgressBar, TextItem } from '@jupyterlab/statusbar';
+
 import { ArrayExt } from '@phosphor/algorithm';
-import { IStatusBar, GroupItem } from '@jupyterlab/statusbar';
+
+import { IUploadModel, FileBrowserModel, FileBrowser } from '.';
+
+import React from 'react';
 
 /**
  * Half-spacing between items in the overall status item.
@@ -63,16 +60,16 @@ const UPLOAD_COMPLETE_MESSAGE_MILLIS: number = 2000;
 /**
  * Status bar item to display file upload progress.
  */
-class FileUpload extends VDomRenderer<FileUpload.Model> {
+export class FileUploadStatus extends VDomRenderer<FileUploadStatus.Model> {
   /**
    * Construct a new FileUpload status item.
    */
-  constructor(opts: FileUpload.IOptions) {
+  constructor(opts: FileUploadStatus.IOptions) {
     super();
     this._tracker = opts.tracker;
     this._tracker.currentChanged.connect(this._onBrowserChange);
 
-    this.model = new FileUpload.Model(
+    this.model = new FileUploadStatus.Model(
       this._tracker.currentWidget && this._tracker.currentWidget.model
     );
   }
@@ -117,7 +114,7 @@ class FileUpload extends VDomRenderer<FileUpload.Model> {
 /**
  * A namespace for FileUpload class statics.
  */
-namespace FileUpload {
+export namespace FileUploadStatus {
   /**
    * The VDomModel for the FileUpload renderer.
    */
@@ -238,33 +235,3 @@ interface IFileUploadItem {
    */
   complete: boolean;
 }
-
-/**
- * A plugin providing file upload status.
- */
-export const fileUploadStatus: JupyterLabPlugin<void> = {
-  id: '@jupyterlab/filebrowser-extension:file-upload-status',
-  autoStart: true,
-  requires: [IStatusBar, IFileBrowserFactory],
-  activate: (
-    app: JupyterLab,
-    statusBar: IStatusBar,
-    browser: IFileBrowserFactory
-  ) => {
-    const item = new FileUpload({
-      tracker: browser.tracker
-    });
-
-    statusBar.registerStatusItem(
-      '@jupyterlab/filebrowser-extension:file-upload-status',
-      {
-        item,
-        align: 'middle',
-        isActive: () => {
-          return !!item.model && item.model.items.length > 0;
-        },
-        activeStateChanged: item.model.stateChanged
-      }
-    );
-  }
-};