From 8d873851b46aac0e1c332ebf51fadaaad16e29d7 Mon Sep 17 00:00:00 2001 From: Ian Rose Date: Thu, 18 Oct 2018 16:22:30 -0700 Subject: [PATCH] Move upload status item to filebrowser extension. --- .../codemirror-extension/src/syntaxstatus.tsx | 2 +- packages/codemirror-extension/tsconfig.json | 6 ++--- packages/filebrowser-extension/package.json | 6 ++++- packages/filebrowser-extension/src/index.ts | 9 +++++++- .../src/uploadstatus.tsx} | 22 +++++-------------- packages/filebrowser-extension/tsconfig.json | 3 +++ .../notebook-extension/src/modestatus.tsx | 2 +- .../notebook-extension/src/truststatus.tsx | 2 +- 8 files changed, 27 insertions(+), 25 deletions(-) rename packages/{statusbar-extension/src/defaults/fileUpload.tsx => filebrowser-extension/src/uploadstatus.tsx} (92%) diff --git a/packages/codemirror-extension/src/syntaxstatus.tsx b/packages/codemirror-extension/src/syntaxstatus.tsx index c2eb6a45c9e3..064aad59bcc2 100644 --- a/packages/codemirror-extension/src/syntaxstatus.tsx +++ b/packages/codemirror-extension/src/syntaxstatus.tsx @@ -209,7 +209,7 @@ export namespace IEditorSyntax { } export const editorSyntaxStatus: JupyterLabPlugin = { - id: '@jupyterlab/statusbar:editor-syntax-item', + id: '@jupyterlab/codemirror-extension:editor-syntax-status', autoStart: true, requires: [IStatusBar, IEditorTracker], activate: ( diff --git a/packages/codemirror-extension/tsconfig.json b/packages/codemirror-extension/tsconfig.json index 8ce67d01263f..7466ffa8cc04 100644 --- a/packages/codemirror-extension/tsconfig.json +++ b/packages/codemirror-extension/tsconfig.json @@ -9,6 +9,9 @@ { "path": "../application" }, + { + "path": "../apputils" + }, { "path": "../codeeditor" }, @@ -27,9 +30,6 @@ { "path": "../mainmenu" }, - { - "path": "../apputils" - }, { "path": "../statusbar" } diff --git a/packages/filebrowser-extension/package.json b/packages/filebrowser-extension/package.json index c8e191dcc766..4d8d4259c0e3 100644 --- a/packages/filebrowser-extension/package.json +++ b/packages/filebrowser-extension/package.json @@ -37,10 +37,14 @@ "@jupyterlab/filebrowser": "^0.19.3", "@jupyterlab/launcher": "^0.19.1", "@jupyterlab/services": "^3.2.1", + "@jupyterlab/statusbar": "^0.7.1", "@phosphor/algorithm": "^1.1.2", "@phosphor/commands": "^1.6.1", + "@phosphor/disposable": "^1.1.2", "@phosphor/messaging": "^1.2.2", - "@phosphor/widgets": "^1.6.0" + "@phosphor/signaling": "^1.2.2", + "@phosphor/widgets": "^1.6.0", + "react": "~16.4.2" }, "devDependencies": { "rimraf": "~2.6.2", diff --git a/packages/filebrowser-extension/src/index.ts b/packages/filebrowser-extension/src/index.ts index c3544e633244..15fee01879ad 100644 --- a/packages/filebrowser-extension/src/index.ts +++ b/packages/filebrowser-extension/src/index.ts @@ -25,6 +25,8 @@ import { IFileBrowserFactory } from '@jupyterlab/filebrowser'; +import { fileUploadStatus } from './uploadstatus'; + import { Launcher } from '@jupyterlab/launcher'; import { Contents } from '@jupyterlab/services'; @@ -131,7 +133,12 @@ const namespace = 'filebrowser'; /** * Export the plugins as default. */ -const plugins: JupyterLabPlugin[] = [factory, browser, shareFile]; +const plugins: JupyterLabPlugin[] = [ + factory, + browser, + shareFile, + fileUploadStatus +]; export default plugins; /** diff --git a/packages/statusbar-extension/src/defaults/fileUpload.tsx b/packages/filebrowser-extension/src/uploadstatus.tsx similarity index 92% rename from packages/statusbar-extension/src/defaults/fileUpload.tsx rename to packages/filebrowser-extension/src/uploadstatus.tsx index a7bf9f1f2b6b..89b431dafe6a 100644 --- a/packages/statusbar-extension/src/defaults/fileUpload.tsx +++ b/packages/filebrowser-extension/src/uploadstatus.tsx @@ -1,9 +1,3 @@ -/** - * Default item to display file upload progress. - */ -/** - * Part of Jupyterlab status bar defaults. - */ import React from 'react'; import { TextItem } from '@jupyterlab/statusbar'; @@ -19,7 +13,6 @@ import { import { IChangedArgs } from '@jupyterlab/coreutils'; import { ISignal } from '@phosphor/signaling'; import { IDisposable } from '@phosphor/disposable'; -import { Token } from '@phosphor/coreutils'; import { ProgressBar } from '@jupyterlab/statusbar'; import { VDomRenderer, InstanceTracker, VDomModel } from '@jupyterlab/apputils'; @@ -48,6 +41,9 @@ namespace FileUploadComponent { const UPLOAD_COMPLETE_MESSAGE_MILLIS: number = 2000; +/** + * Status bar item to display file upload progress. + */ class FileUpload extends VDomRenderer implements IFileUpload { constructor(opts: FileUpload.IOptions) { super(); @@ -181,11 +177,6 @@ export interface IFileUpload extends IDisposable { readonly modelChanged: ISignal; } -// tslint:disable-next-line:variable-name -export const IFileUpload = new Token( - '@jupyterlab/statusbar:IFileUpload' -); - export namespace IFileUpload { export interface IModel { readonly items: Array; @@ -199,10 +190,9 @@ export namespace IFileUpload { } } -export const fileUploadItem: JupyterLabPlugin = { - id: '@jupyterlab/statusbar:file-upload-item', +export const fileUploadStatus: JupyterLabPlugin = { + id: '@jupyterlab/filebrowser-extension:file-upload-item', autoStart: true, - provides: IFileUpload, requires: [IStatusBar, IFileBrowserFactory], activate: ( app: JupyterLab, @@ -220,7 +210,5 @@ export const fileUploadItem: JupyterLabPlugin = { }, stateChanged: item.model!.stateChanged }); - - return item; } }; diff --git a/packages/filebrowser-extension/tsconfig.json b/packages/filebrowser-extension/tsconfig.json index 99ac9523b03e..35681d6681ff 100644 --- a/packages/filebrowser-extension/tsconfig.json +++ b/packages/filebrowser-extension/tsconfig.json @@ -26,6 +26,9 @@ }, { "path": "../services" + }, + { + "path": "../statusbar" } ] } diff --git a/packages/notebook-extension/src/modestatus.tsx b/packages/notebook-extension/src/modestatus.tsx index 7e07686eb6fc..a624137d0a1a 100644 --- a/packages/notebook-extension/src/modestatus.tsx +++ b/packages/notebook-extension/src/modestatus.tsx @@ -156,7 +156,7 @@ export namespace ICommandEdit { } export const commandEditItem: JupyterLabPlugin = { - id: '@jupyterlab/statusbar:command-edit-item', + id: '@jupyterlab/notebook-extension:mode-status', autoStart: true, requires: [IStatusBar, INotebookTracker], activate: ( diff --git a/packages/notebook-extension/src/truststatus.tsx b/packages/notebook-extension/src/truststatus.tsx index 0b60fb88797b..c1317ad9dee9 100644 --- a/packages/notebook-extension/src/truststatus.tsx +++ b/packages/notebook-extension/src/truststatus.tsx @@ -272,7 +272,7 @@ export namespace INotebookTrust { } export const notebookTrustItem: JupyterLabPlugin = { - id: '@jupyterlab/statusbar:trusted-notebook-item', + id: '@jupyterlab/notebook-extension:trust-status', autoStart: true, requires: [IStatusBar, INotebookTracker], activate: (