@jupyterlab/apputils-extension 4.6.0-beta.1 → 4.6.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/workspacesplugin.js +9 -3
- package/lib/workspacesplugin.js.map +1 -1
- package/package.json +15 -15
- package/src/workspacesplugin.ts +11 -3
package/lib/workspacesplugin.js
CHANGED
|
@@ -4,7 +4,7 @@ import { IRouter, JupyterFrontEnd } from '@jupyterlab/application';
|
|
|
4
4
|
import { URLExt } from '@jupyterlab/coreutils';
|
|
5
5
|
import { ABCWidgetFactory, DocumentWidget } from '@jupyterlab/docregistry';
|
|
6
6
|
import { IStateDB } from '@jupyterlab/statedb';
|
|
7
|
-
import { IWorkspaceCommands } from '@jupyterlab/workspaces';
|
|
7
|
+
import { IWorkspaceCommands, IWorkspacesModel } from '@jupyterlab/workspaces';
|
|
8
8
|
import { ITranslator, nullTranslator } from '@jupyterlab/translation';
|
|
9
9
|
import { Widget } from '@lumino/widgets';
|
|
10
10
|
const WORKSPACE_NAME = 'jupyterlab-workspace';
|
|
@@ -19,11 +19,12 @@ export const workspacesPlugin = {
|
|
|
19
19
|
description: 'Add workspace file type.',
|
|
20
20
|
autoStart: true,
|
|
21
21
|
requires: [IStateDB, ITranslator, JupyterFrontEnd.IPaths],
|
|
22
|
-
optional: [IRouter, IWorkspaceCommands],
|
|
23
|
-
activate: (app, state, translator, paths, router, workspaceCommands) => {
|
|
22
|
+
optional: [IRouter, IWorkspaceCommands, IWorkspacesModel],
|
|
23
|
+
activate: (app, state, translator, paths, router, workspaceCommands, workspacesModel) => {
|
|
24
24
|
// The workspace factory creates dummy widgets to load a new workspace.
|
|
25
25
|
const factory = new Private.WorkspaceFactory({
|
|
26
26
|
workspaces: app.serviceManager.workspaces,
|
|
27
|
+
workspacesModel,
|
|
27
28
|
state,
|
|
28
29
|
translator,
|
|
29
30
|
open: async (id) => {
|
|
@@ -70,6 +71,7 @@ var Private;
|
|
|
70
71
|
* @param options - The instantiation options for a `WorkspaceFactory`.
|
|
71
72
|
*/
|
|
72
73
|
constructor(options) {
|
|
74
|
+
var _a;
|
|
73
75
|
const trans = (options.translator || nullTranslator).load('jupyterlab');
|
|
74
76
|
super({
|
|
75
77
|
name: 'Workspace loader',
|
|
@@ -80,6 +82,7 @@ var Private;
|
|
|
80
82
|
});
|
|
81
83
|
this._state = options.state;
|
|
82
84
|
this._workspaces = options.workspaces;
|
|
85
|
+
this._workspacesModel = (_a = options.workspacesModel) !== null && _a !== void 0 ? _a : null;
|
|
83
86
|
this._open = options.open;
|
|
84
87
|
}
|
|
85
88
|
/**
|
|
@@ -89,12 +92,15 @@ var Private;
|
|
|
89
92
|
createNewWidget(context) {
|
|
90
93
|
// Save a file's contents as a workspace and navigate to that workspace.
|
|
91
94
|
void context.ready.then(async () => {
|
|
95
|
+
var _a;
|
|
92
96
|
const file = context.model;
|
|
93
97
|
const workspace = file.toJSON();
|
|
94
98
|
const path = context.path;
|
|
95
99
|
const id = workspace.metadata.id;
|
|
96
100
|
// Save the file contents as a workspace.
|
|
97
101
|
await this._workspaces.save(id, workspace);
|
|
102
|
+
// Refresh the model so workspace-ui:open finds the new workspace ID.
|
|
103
|
+
await ((_a = this._workspacesModel) === null || _a === void 0 ? void 0 : _a.refresh());
|
|
98
104
|
// Save last save location for the save command.
|
|
99
105
|
await this._state.save(LAST_SAVE_ID, path);
|
|
100
106
|
// Navigate to new workspace.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspacesplugin.js","sourceRoot":"","sources":["../src/workspacesplugin.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAG3D,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAK/C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EAAE,QA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,CAAC,CAAC;gBAE3C,qEAAqE;gBACrE,MAAM,CAAA,MAAA,IAAI,CAAC,gBAAgB,0CAAE,OAAO,EAAE,CAAA,CAAC;gBAEvC,gDAAgD;gBAChD,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;gBAE3C,6BAA6B;gBAC7B,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC;YACH,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC;QAC9B,CAAC;KAMF;IAvDY,wBAAgB,mBAuD5B,CAAA;IAkBD;;;;OAIG;IACH,SAAS,WAAW,CAAC,OAAiC;QACpD,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,EAAE,OAAO,EAAE,IAAI,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QACtE,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACzB,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC,EAvFS,OAAO,KAAP,OAAO,QAuFhB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyterlab/apputils-extension",
|
|
3
|
-
"version": "4.6.0-
|
|
3
|
+
"version": "4.6.0-rc.1",
|
|
4
4
|
"description": "JupyterLab - Application Utilities Extension",
|
|
5
5
|
"homepage": "https://github.com/jupyterlab/jupyterlab",
|
|
6
6
|
"bugs": {
|
|
@@ -42,19 +42,19 @@
|
|
|
42
42
|
"watch": "tsc -b --watch"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@jupyterlab/application": "^4.6.0-
|
|
46
|
-
"@jupyterlab/apputils": "^4.7.0-
|
|
47
|
-
"@jupyterlab/coreutils": "^6.6.0-
|
|
48
|
-
"@jupyterlab/docregistry": "^4.6.0-
|
|
49
|
-
"@jupyterlab/mainmenu": "^4.6.0-
|
|
50
|
-
"@jupyterlab/rendermime-interfaces": "^3.14.0-
|
|
51
|
-
"@jupyterlab/services": "^7.6.0-
|
|
52
|
-
"@jupyterlab/settingregistry": "^4.6.0-
|
|
53
|
-
"@jupyterlab/statedb": "^4.6.0-
|
|
54
|
-
"@jupyterlab/statusbar": "^4.6.0-
|
|
55
|
-
"@jupyterlab/translation": "^4.6.0-
|
|
56
|
-
"@jupyterlab/ui-components": "^4.6.0-
|
|
57
|
-
"@jupyterlab/workspaces": "^4.6.0-
|
|
45
|
+
"@jupyterlab/application": "^4.6.0-rc.1",
|
|
46
|
+
"@jupyterlab/apputils": "^4.7.0-rc.1",
|
|
47
|
+
"@jupyterlab/coreutils": "^6.6.0-rc.1",
|
|
48
|
+
"@jupyterlab/docregistry": "^4.6.0-rc.1",
|
|
49
|
+
"@jupyterlab/mainmenu": "^4.6.0-rc.1",
|
|
50
|
+
"@jupyterlab/rendermime-interfaces": "^3.14.0-rc.1",
|
|
51
|
+
"@jupyterlab/services": "^7.6.0-rc.1",
|
|
52
|
+
"@jupyterlab/settingregistry": "^4.6.0-rc.1",
|
|
53
|
+
"@jupyterlab/statedb": "^4.6.0-rc.1",
|
|
54
|
+
"@jupyterlab/statusbar": "^4.6.0-rc.1",
|
|
55
|
+
"@jupyterlab/translation": "^4.6.0-rc.1",
|
|
56
|
+
"@jupyterlab/ui-components": "^4.6.0-rc.1",
|
|
57
|
+
"@jupyterlab/workspaces": "^4.6.0-rc.1",
|
|
58
58
|
"@lumino/algorithm": "^2.0.4",
|
|
59
59
|
"@lumino/commands": "^2.3.3",
|
|
60
60
|
"@lumino/coreutils": "^2.2.2",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"react-toastify": "^9.0.8"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@jupyterlab/testing": "^4.6.0-
|
|
70
|
+
"@jupyterlab/testing": "^4.6.0-rc.1",
|
|
71
71
|
"@types/jest": "^29.2.0",
|
|
72
72
|
"jest": "^29.2.0",
|
|
73
73
|
"rimraf": "~5.0.5",
|
package/src/workspacesplugin.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type {
|
|
|
11
11
|
import { ABCWidgetFactory, DocumentWidget } from '@jupyterlab/docregistry';
|
|
12
12
|
import type { Workspace, WorkspaceManager } from '@jupyterlab/services';
|
|
13
13
|
import { IStateDB } from '@jupyterlab/statedb';
|
|
14
|
-
import { IWorkspaceCommands } from '@jupyterlab/workspaces';
|
|
14
|
+
import { IWorkspaceCommands, IWorkspacesModel } from '@jupyterlab/workspaces';
|
|
15
15
|
import { ITranslator, nullTranslator } from '@jupyterlab/translation';
|
|
16
16
|
import { Widget } from '@lumino/widgets';
|
|
17
17
|
|
|
@@ -28,18 +28,20 @@ export const workspacesPlugin: JupyterFrontEndPlugin<void> = {
|
|
|
28
28
|
description: 'Add workspace file type.',
|
|
29
29
|
autoStart: true,
|
|
30
30
|
requires: [IStateDB, ITranslator, JupyterFrontEnd.IPaths],
|
|
31
|
-
optional: [IRouter, IWorkspaceCommands],
|
|
31
|
+
optional: [IRouter, IWorkspaceCommands, IWorkspacesModel],
|
|
32
32
|
activate: (
|
|
33
33
|
app: JupyterFrontEnd,
|
|
34
34
|
state: IStateDB,
|
|
35
35
|
translator: ITranslator,
|
|
36
36
|
paths: JupyterFrontEnd.IPaths,
|
|
37
37
|
router: IRouter | null,
|
|
38
|
-
workspaceCommands: IWorkspaceCommands | null
|
|
38
|
+
workspaceCommands: IWorkspaceCommands | null,
|
|
39
|
+
workspacesModel: IWorkspacesModel | null
|
|
39
40
|
): void => {
|
|
40
41
|
// The workspace factory creates dummy widgets to load a new workspace.
|
|
41
42
|
const factory = new Private.WorkspaceFactory({
|
|
42
43
|
workspaces: app.serviceManager.workspaces,
|
|
44
|
+
workspacesModel,
|
|
43
45
|
state,
|
|
44
46
|
translator,
|
|
45
47
|
open: async (id: string) => {
|
|
@@ -95,6 +97,7 @@ namespace Private {
|
|
|
95
97
|
});
|
|
96
98
|
this._state = options.state;
|
|
97
99
|
this._workspaces = options.workspaces;
|
|
100
|
+
this._workspacesModel = options.workspacesModel ?? null;
|
|
98
101
|
this._open = options.open;
|
|
99
102
|
}
|
|
100
103
|
|
|
@@ -116,6 +119,9 @@ namespace Private {
|
|
|
116
119
|
// Save the file contents as a workspace.
|
|
117
120
|
await this._workspaces.save(id, workspace);
|
|
118
121
|
|
|
122
|
+
// Refresh the model so workspace-ui:open finds the new workspace ID.
|
|
123
|
+
await this._workspacesModel?.refresh();
|
|
124
|
+
|
|
119
125
|
// Save last save location for the save command.
|
|
120
126
|
await this._state.save(LAST_SAVE_ID, path);
|
|
121
127
|
|
|
@@ -128,6 +134,7 @@ namespace Private {
|
|
|
128
134
|
private _open: (id: string) => Promise<void>;
|
|
129
135
|
private _state: IStateDB;
|
|
130
136
|
private _workspaces: WorkspaceManager;
|
|
137
|
+
private _workspacesModel: IWorkspacesModel | null;
|
|
131
138
|
}
|
|
132
139
|
|
|
133
140
|
/**
|
|
@@ -141,6 +148,7 @@ namespace Private {
|
|
|
141
148
|
state: IStateDB;
|
|
142
149
|
translator: ITranslator;
|
|
143
150
|
workspaces: WorkspaceManager;
|
|
151
|
+
workspacesModel?: IWorkspacesModel | null;
|
|
144
152
|
open: (id: string) => Promise<void>;
|
|
145
153
|
}
|
|
146
154
|
}
|