@jupytergis/jupytergis-lab 0.1.1 → 0.1.3
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/index.js +3 -5
- package/lib/notebookrenderer.js +17 -38
- package/package.json +4 -4
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommandIDs, ControlPanelModel, LeftPanelWidget, RightPanelWidget, addCommands, createDefaultLayerRegistry } from '@jupytergis/base';
|
|
1
|
+
import { CommandIDs, ControlPanelModel, LeftPanelWidget, RightPanelWidget, addCommands, createDefaultLayerRegistry, logoMiniIcon } from '@jupytergis/base';
|
|
2
2
|
import { IJGISFormSchemaRegistryToken, IJGISLayerBrowserRegistryToken, IJupyterGISDocTracker } from '@jupytergis/schema';
|
|
3
3
|
import { ILayoutRestorer } from '@jupyterlab/application';
|
|
4
4
|
import { ICompletionProviderManager } from '@jupyterlab/completer';
|
|
@@ -218,8 +218,7 @@ const controlPanel = {
|
|
|
218
218
|
});
|
|
219
219
|
leftControlPanel.id = 'jupytergis::leftControlPanel';
|
|
220
220
|
leftControlPanel.title.caption = 'JupyterGIS Control Panel';
|
|
221
|
-
|
|
222
|
-
// leftControlPanel.title.icon = jcLightIcon;
|
|
221
|
+
leftControlPanel.title.icon = logoMiniIcon;
|
|
223
222
|
const rightControlPanel = new RightPanelWidget({
|
|
224
223
|
model: controlModel,
|
|
225
224
|
tracker,
|
|
@@ -227,8 +226,7 @@ const controlPanel = {
|
|
|
227
226
|
});
|
|
228
227
|
rightControlPanel.id = 'jupytergis::rightControlPanel';
|
|
229
228
|
rightControlPanel.title.caption = 'JupyterGIS Control Panel';
|
|
230
|
-
|
|
231
|
-
// rightControlPanel.title.icon = jcLightIcon;
|
|
229
|
+
rightControlPanel.title.icon = logoMiniIcon;
|
|
232
230
|
if (restorer) {
|
|
233
231
|
restorer.add(leftControlPanel, NAME_SPACE);
|
|
234
232
|
restorer.add(rightControlPanel, NAME_SPACE);
|
package/lib/notebookrenderer.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ICollaborativeDrive } from '@jupyter/docprovider';
|
|
2
2
|
import { JupyterGISPanel } from '@jupytergis/base';
|
|
3
3
|
import { JupyterGISModel } from '@jupytergis/schema';
|
|
4
|
-
import { URLExt } from '@jupyterlab/coreutils';
|
|
5
|
-
import { ServerConnection } from '@jupyterlab/services';
|
|
6
|
-
import { ITranslator, nullTranslator } from '@jupyterlab/translation';
|
|
7
4
|
import { MessageLoop } from '@lumino/messaging';
|
|
8
5
|
import { Panel, Widget } from '@lumino/widgets';
|
|
9
6
|
import { IJupyterYWidgetManager, JupyterYModel } from 'yjs-widgets';
|
|
10
|
-
const Y_DOCUMENT_PROVIDER_URL = 'api/collaboration/room';
|
|
11
7
|
export const CLASS_NAME = 'jupytergis-notebook-widget';
|
|
12
8
|
export class YJupyterGISModel extends JupyterYModel {
|
|
13
9
|
}
|
|
@@ -27,46 +23,29 @@ export class YJupyterGISLuminoWidget extends Panel {
|
|
|
27
23
|
export const notebookRenderePlugin = {
|
|
28
24
|
id: 'jupytergis:yjswidget-plugin',
|
|
29
25
|
autoStart: true,
|
|
30
|
-
optional: [IJupyterYWidgetManager,
|
|
31
|
-
activate: (app, yWidgetManager,
|
|
26
|
+
optional: [IJupyterYWidgetManager, ICollaborativeDrive],
|
|
27
|
+
activate: (app, yWidgetManager, drive) => {
|
|
32
28
|
if (!yWidgetManager) {
|
|
33
29
|
console.error('Missing IJupyterYWidgetManager token!');
|
|
34
30
|
return;
|
|
35
31
|
}
|
|
36
|
-
|
|
32
|
+
if (!drive) {
|
|
33
|
+
console.error('Cannot setup JupyterGIS Python API without a collaborative drive');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
37
36
|
class YJupyterGISModelFactory extends YJupyterGISModel {
|
|
38
37
|
ydocFactory(commMetadata) {
|
|
39
38
|
const { path, format, contentType } = commMetadata;
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
model: this.jupyterGISModel.sharedModel,
|
|
51
|
-
user,
|
|
52
|
-
translator: labTranslator.load('jupyterlab')
|
|
53
|
-
});
|
|
54
|
-
this.jupyterGISModel.disposed.connect(() => {
|
|
55
|
-
ywsProvider.dispose();
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
const awareness = this.jupyterGISModel.sharedModel.awareness;
|
|
60
|
-
const _onUserChanged = (user) => {
|
|
61
|
-
awareness.setLocalStateField('user', user.identity);
|
|
62
|
-
};
|
|
63
|
-
user.ready
|
|
64
|
-
.then(() => {
|
|
65
|
-
_onUserChanged(user);
|
|
66
|
-
})
|
|
67
|
-
.catch(e => console.error(e));
|
|
68
|
-
user.userChanged.connect(_onUserChanged, this);
|
|
69
|
-
}
|
|
39
|
+
const fileFormat = format;
|
|
40
|
+
const sharedModel = drive.sharedModelFactory.createNew({
|
|
41
|
+
path,
|
|
42
|
+
format: fileFormat,
|
|
43
|
+
contentType,
|
|
44
|
+
collaborative: true
|
|
45
|
+
});
|
|
46
|
+
this.jupyterGISModel = new JupyterGISModel({
|
|
47
|
+
sharedModel: sharedModel
|
|
48
|
+
});
|
|
70
49
|
return this.jupyterGISModel.sharedModel.ydoc;
|
|
71
50
|
}
|
|
72
51
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupytergis/jupytergis-lab",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "JupyterGIS Lab extension.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@jupyter/docprovider": "^2.0.0",
|
|
56
|
-
"@jupytergis/base": "^0.1.
|
|
57
|
-
"@jupytergis/jupytergis-core": "^0.1.
|
|
58
|
-
"@jupytergis/schema": "^0.1.
|
|
56
|
+
"@jupytergis/base": "^0.1.3",
|
|
57
|
+
"@jupytergis/jupytergis-core": "^0.1.3",
|
|
58
|
+
"@jupytergis/schema": "^0.1.3",
|
|
59
59
|
"@jupyterlab/application": "^4.0.0",
|
|
60
60
|
"@jupyterlab/apputils": "^4.0.0",
|
|
61
61
|
"@jupyterlab/coreutils": "^6.0.0",
|