Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions src/create_notebook_panel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ISessionContext } from '@jupyterlab/apputils';
import { IEditorServices } from '@jupyterlab/codeeditor';
import { PathExt } from '@jupyterlab/coreutils';
import { Context, DocumentRegistry } from '@jupyterlab/docregistry';
import {
INotebookModel,
Expand Down Expand Up @@ -34,12 +35,20 @@ class CustomContext extends Context<INotebookModel> {
export async function createNotebookContext(options: {
manager: ServiceManager.IManager;
kernelPreference: ISessionContext.IKernelPreference;
filePath: string;
}): Promise<Context<INotebookModel>> {
const factory = new NotebookModelFactory({
disableDocumentWideUndoRedo: false
});
const { manager, kernelPreference } = options;
const path = UUID.uuid4() + '.ipynb';
const { manager, kernelPreference, filePath } = options;

const pathsWithoutDriver = filePath.split(':');
const dirPath = PathExt.dirname(
pathsWithoutDriver.length > 1
? pathsWithoutDriver[1]
: pathsWithoutDriver[0]
);
const path = PathExt.join(dirPath, UUID.uuid4() + '.ipynb');

await manager.ready;
await manager.kernelspecs.ready;
Expand Down
7 changes: 5 additions & 2 deletions src/document/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export const spectaOpener: JupyterFrontEndPlugin<void, ILabShell> = {
urlFactory: ISpectaUrlFactory | null
): Promise<void> => {
const urlParams = new URLSearchParams(window.location.search);
const noTree = urlParams.get('no-tree') === 'true';
if (!isSpectaApp()) {
// Not a specta app
const path = urlParams.get('specta-path');
Expand Down Expand Up @@ -150,8 +151,10 @@ export const spectaOpener: JupyterFrontEndPlugin<void, ILabShell> = {
// Specta app
const path = urlParams.get('path');
if (!path) {
const browser = createFileBrowser({ defaultBrowser, urlFactory });
app.shell.add(browser, 'main', { rank: 100 });
if (!noTree) {
const browser = createFileBrowser({ defaultBrowser, urlFactory });
app.shell.add(browser, 'main', { rank: 100 });
}
hideAppLoadingIndicator();
} else {
app.restored.then(async () => {
Expand Down
5 changes: 4 additions & 1 deletion src/specta_model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { ISignal, Signal } from '@lumino/signaling';
export class AppModel {
constructor(private options: AppModel.IOptions) {
this._notebookModelJson = options.context.model.toJSON();
this._filePath = options.context.localPath;
this._kernelPreference = {
shouldStart: true,
canStart: true,
Expand Down Expand Up @@ -87,7 +88,8 @@ export class AppModel {
async initialize(): Promise<void> {
this._context = await createNotebookContext({
manager: this._manager,
kernelPreference: this._kernelPreference
kernelPreference: this._kernelPreference,
filePath: this._filePath
});
this._context.model.fromJSON(this._notebookModelJson);

Expand Down Expand Up @@ -214,6 +216,7 @@ export class AppModel {
private _manager: ServiceManager.IManager;
private _kernelPreference: ISessionContext.IKernelPreference;
private _fileChanged = new Signal<this, CellList>(this);
private _filePath: string;
}

export namespace AppModel {
Expand Down