Skip to content

Commit 7949566

Browse files
authored
Merge pull request #29 from krassowski/fix-upload-when-in-subdirectory
Fix report upload when in a sub-directory
2 parents 072e193 + d49db29 commit 7949566

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/index.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import {
55
} from '@jupyterlab/application';
66
import { MainAreaWidget, WidgetTracker } from '@jupyterlab/apputils';
77
import { PageConfig } from '@jupyterlab/coreutils';
8-
import { IFileBrowserFactory } from '@jupyterlab/filebrowser';
8+
import { IDocumentManager } from '@jupyterlab/docmanager';
9+
import { FileBrowserModel } from '@jupyterlab/filebrowser';
910
import { ILauncher } from '@jupyterlab/launcher';
1011
import { nullTranslator } from '@jupyterlab/translation';
1112
import { offlineBoltIcon } from '@jupyterlab/ui-components';
@@ -47,14 +48,17 @@ namespace CommandIDs {
4748
const plugin: JupyterFrontEndPlugin<void> = {
4849
id: '@jupyterlab/ui-profiler:plugin',
4950
autoStart: true,
50-
requires: [IFileBrowserFactory],
51+
requires: [IDocumentManager],
5152
optional: [ILauncher, ILayoutRestorer],
5253
activate: (
5354
app: JupyterFrontEnd,
54-
factory: IFileBrowserFactory,
55+
docManager: IDocumentManager,
5556
launcher: ILauncher | null,
5657
restorer: ILayoutRestorer | null
5758
) => {
59+
const fileBrowserModel = new FileBrowserModel({
60+
manager: docManager
61+
});
5862
const options = {
5963
benchmarks: [
6064
executionTimeBenchmark,
@@ -76,11 +80,8 @@ const plugin: JupyterFrontEndPlugin<void> = {
7680
],
7781
translator: nullTranslator,
7882
upload: (file: File) => {
79-
// this.manager = new ServiceManager();
80-
// this.manager.contents.uploadFile - only exists in galata...
81-
// TODO: this is actually an upstream issue, services should offer upload method
82-
// rather than each place re-implmenting it
83-
return factory.defaultBrowser.model.upload(file);
83+
// https://github.com/jupyterlab/jupyterlab/issues/11416
84+
return fileBrowserModel.upload(file);
8485
},
8586
getJupyterState: () => {
8687
const state: IJupyterState = {

0 commit comments

Comments
 (0)