Skip to content

Commit 969fa5d

Browse files
authored
Add a user package to represent the current connected user (jupyterlab#11443)
* Adds a new package for the user information * Read user info from IUser when opening a new document * Adds a user menu * Remove anonymous names from docprovider and runs integrity and eslint:typed * Small fix menu * Rename tokens ID to match the token name * Adds new tokens to the documentation * Review * Remove components * Adds tests * Create the user menu only if collaborative flag is true * Revert changes on UI tests * Adds tests to the user menu * Review * Integrity * Small issue * Store user in local storage, remove StateDB and run integrity * Remove 'id', 'name', and adds 'givenName', 'familyName', and 'initials' * Update packages as part of the rebase * Removes role, and solves an issue with names on the editor * Change tests user package * Makes colors private, removes public methods from IUserMenu * Package integrity updates * Tag ICurrentUser token and interface as experimental
1 parent 25b93e6 commit 969fa5d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1325
-165
lines changed

buildutils/src/ensure-repo.ts

+3
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ const SKIP_CSS: Dict<string[]> = {
173173
'@jupyterlab/console-extension',
174174
'@jupyterlab/csvviewer',
175175
'@jupyterlab/documentsearch',
176+
'@jupyterlab/docprovider',
176177
'@jupyterlab/csvviewer-extension',
177178
'@jupyterlab/debugger',
178179
'@jupyterlab/debugger-extension',
@@ -220,6 +221,8 @@ const SKIP_CSS: Dict<string[]> = {
220221
'@jupyterlab/tooltip-extension',
221222
'@jupyterlab/translation-extension',
222223
'@jupyterlab/ui-components-extension',
224+
'@jupyterlab/user',
225+
'@jupyterlab/user-extension',
223226
'@jupyterlab/vdom',
224227
'@jupyterlab/vdom-extension',
225228
'@jupyterlab/vega5-extension'

dev_mode/package.json

+7
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@
104104
"@jupyterlab/translation-extension": "~4.0.0-alpha.1",
105105
"@jupyterlab/ui-components": "~4.0.0-alpha.16",
106106
"@jupyterlab/ui-components-extension": "~4.0.0-alpha.1",
107+
"@jupyterlab/user": "~4.0.0-alpha.1",
108+
"@jupyterlab/user-extension": "~4.0.0-alpha.1",
107109
"@jupyterlab/vdom": "~4.0.0-alpha.1",
108110
"@jupyterlab/vdom-extension": "~4.0.0-alpha.1",
109111
"@jupyterlab/vega5-extension": "~4.0.0-alpha.1",
@@ -166,6 +168,7 @@
166168
"@jupyterlab/tooltip-extension": "~4.0.0-alpha.1",
167169
"@jupyterlab/translation-extension": "~4.0.0-alpha.1",
168170
"@jupyterlab/ui-components-extension": "~4.0.0-alpha.1",
171+
"@jupyterlab/user-extension": "~4.0.0-alpha.1",
169172
"@jupyterlab/vdom-extension": "~4.0.0-alpha.1",
170173
"@jupyterlab/vega5-extension": "~4.0.0-alpha.1"
171174
},
@@ -243,6 +246,7 @@
243246
"@jupyterlab/tooltip-extension": "",
244247
"@jupyterlab/translation-extension": "",
245248
"@jupyterlab/ui-components-extension": "",
249+
"@jupyterlab/user-extension": "",
246250
"@jupyterlab/vdom-extension": ""
247251
},
248252
"mimeExtensions": {
@@ -289,6 +293,7 @@
289293
"@jupyterlab/tooltip",
290294
"@jupyterlab/translation",
291295
"@jupyterlab/ui-components",
296+
"@jupyterlab/user",
292297
"@lumino/algorithm",
293298
"@lumino/application",
294299
"@lumino/commands",
@@ -394,6 +399,8 @@
394399
"@jupyterlab/translation-extension": "../packages/translation-extension",
395400
"@jupyterlab/ui-components": "../packages/ui-components",
396401
"@jupyterlab/ui-components-extension": "../packages/ui-components-extension",
402+
"@jupyterlab/user": "../packages/user",
403+
"@jupyterlab/user-extension": "../packages/user-extension",
397404
"@jupyterlab/vdom": "../packages/vdom",
398405
"@jupyterlab/vdom-extension": "../packages/vdom-extension",
399406
"@jupyterlab/vega5-extension": "../packages/vega5-extension",

dev_mode/style.js

+1
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@ import '@jupyterlab/toc-extension/style/index.js';
3838
import '@jupyterlab/tooltip-extension/style/index.js';
3939
import '@jupyterlab/translation-extension/style/index.js';
4040
import '@jupyterlab/ui-components-extension/style/index.js';
41+
import '@jupyterlab/user-extension/style/index.js';
4142
import '@jupyterlab/vdom-extension/style/index.js';
4243
import '@jupyterlab/vega5-extension/style/index.js';

docs/source/extension/extension_points.rst

+4
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ might want to use the services in your extensions.
125125
created by the application.
126126
- ``@jupyterlab/tooltip:ITooltipManager``: A service for the tooltip manager for the application.
127127
Use this to allow your extension to invoke a tooltip.
128+
- ``@jupyterlab/user:ICurrentUser``: A service for the current user information.
129+
Use this if you want to access to the identity of the current connected user.
130+
- ``@jupyterlab/user:IUserMenu``: A service for the user menu on the application.
131+
Use this if you want to add new items to the user menu.
128132
- ``@jupyterlab/vdom:IVDOMTracker``: A widget tracker for virtual DOM (VDOM) documents.
129133
Use this to iterate over and interact with VDOM document instances created by the application.
130134

jupyterlab/staging/package.json

+5
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@
104104
"@jupyterlab/translation-extension": "~4.0.0-alpha.1",
105105
"@jupyterlab/ui-components": "~4.0.0-alpha.16",
106106
"@jupyterlab/ui-components-extension": "~4.0.0-alpha.1",
107+
"@jupyterlab/user": "~4.0.0-alpha.1",
108+
"@jupyterlab/user-extension": "~4.0.0-alpha.1",
107109
"@jupyterlab/vdom": "~4.0.0-alpha.1",
108110
"@jupyterlab/vdom-extension": "~4.0.0-alpha.1",
109111
"@jupyterlab/vega5-extension": "~4.0.0-alpha.1",
@@ -166,6 +168,7 @@
166168
"@jupyterlab/tooltip-extension": "~4.0.0-alpha.1",
167169
"@jupyterlab/translation-extension": "~4.0.0-alpha.1",
168170
"@jupyterlab/ui-components-extension": "~4.0.0-alpha.1",
171+
"@jupyterlab/user-extension": "~4.0.0-alpha.1",
169172
"@jupyterlab/vdom-extension": "~4.0.0-alpha.1",
170173
"@jupyterlab/vega5-extension": "~4.0.0-alpha.1"
171174
},
@@ -243,6 +246,7 @@
243246
"@jupyterlab/tooltip-extension": "",
244247
"@jupyterlab/translation-extension": "",
245248
"@jupyterlab/ui-components-extension": "",
249+
"@jupyterlab/user-extension": "",
246250
"@jupyterlab/vdom-extension": ""
247251
},
248252
"mimeExtensions": {
@@ -289,6 +293,7 @@
289293
"@jupyterlab/tooltip",
290294
"@jupyterlab/translation",
291295
"@jupyterlab/ui-components",
296+
"@jupyterlab/user",
292297
"@lumino/algorithm",
293298
"@lumino/application",
294299
"@lumino/commands",

packages/docmanager-extension/style/index.css

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
@import url('~@jupyterlab/ui-components/style/index.css');
99
@import url('~@jupyterlab/apputils/style/index.css');
1010
@import url('~@jupyterlab/statusbar/style/index.css');
11+
@import url('~@jupyterlab/docprovider/style/index.css');
1112
@import url('~@jupyterlab/docregistry/style/index.css');
1213
@import url('~@jupyterlab/application/style/index.css');
1314
@import url('~@jupyterlab/docmanager/style/index.css');

packages/docmanager-extension/style/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import '@lumino/widgets/style/index.js';
88
import '@jupyterlab/ui-components/style/index.js';
99
import '@jupyterlab/apputils/style/index.js';
1010
import '@jupyterlab/statusbar/style/index.js';
11+
import '@jupyterlab/docprovider/style/index.js';
1112
import '@jupyterlab/docregistry/style/index.js';
1213
import '@jupyterlab/application/style/index.js';
1314
import '@jupyterlab/docmanager/style/index.js';

packages/docmanager/style/index.css

+1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
@import url('~@lumino/widgets/style/index.css');
88
@import url('~@jupyterlab/ui-components/style/index.css');
99
@import url('~@jupyterlab/apputils/style/index.css');
10+
@import url('~@jupyterlab/docprovider/style/index.css');
1011
@import url('~@jupyterlab/docregistry/style/index.css');

packages/docmanager/style/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
import '@lumino/widgets/style/index.js';
88
import '@jupyterlab/ui-components/style/index.js';
99
import '@jupyterlab/apputils/style/index.js';
10+
import '@jupyterlab/docprovider/style/index.js';
1011
import '@jupyterlab/docregistry/style/index.js';

packages/docprovider-extension/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@jupyterlab/coreutils": "^6.0.0-alpha.1",
3939
"@jupyterlab/docprovider": "^4.0.0-alpha.1",
4040
"@jupyterlab/services": "^7.0.0-alpha.1",
41-
"@jupyterlab/statedb": "^4.0.0-alpha.1"
41+
"@jupyterlab/user": "^4.0.0-alpha.1"
4242
},
4343
"devDependencies": {
4444
"rimraf": "~3.0.0",

packages/docprovider-extension/src/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ import {
1616
ProviderMock,
1717
WebSocketProviderWithLocks
1818
} from '@jupyterlab/docprovider';
19+
import { ICurrentUser } from '@jupyterlab/user';
1920
import { ServerConnection } from '@jupyterlab/services';
20-
import { IStateDB } from '@jupyterlab/statedb';
2121

2222
/**
2323
* The default document provider plugin
2424
*/
2525
const docProviderPlugin: JupyterFrontEndPlugin<IDocumentProviderFactory> = {
2626
id: '@jupyterlab/docprovider-extension:plugin',
27-
optional: [IStateDB],
27+
requires: [ICurrentUser],
2828
provides: IDocumentProviderFactory,
2929
activate: (
3030
app: JupyterFrontEnd,
31-
state: IStateDB | null
31+
user: ICurrentUser
3232
): IDocumentProviderFactory => {
3333
const server = ServerConnection.makeSettings();
3434
const url = URLExt.join(server.wsUrl, 'api/yjs');
@@ -41,7 +41,7 @@ const docProviderPlugin: JupyterFrontEndPlugin<IDocumentProviderFactory> = {
4141
? new WebSocketProviderWithLocks({
4242
...options,
4343
url,
44-
state
44+
user
4545
})
4646
: new ProviderMock();
4747
};

packages/docprovider-extension/style/index.css

+2
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
|----------------------------------------------------------------------------*/
55

66
/* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
7+
@import url('~@jupyterlab/user/style/index.css');
8+
@import url('~@jupyterlab/docprovider/style/index.css');
79
@import url('~@jupyterlab/application/style/index.css');

packages/docprovider-extension/style/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
|----------------------------------------------------------------------------*/
55

66
/* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
7+
import '@jupyterlab/user/style/index.js';
8+
import '@jupyterlab/docprovider/style/index.js';
79
import '@jupyterlab/application/style/index.js';

packages/docprovider-extension/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"path": "../services"
2020
},
2121
{
22-
"path": "../statedb"
22+
"path": "../user"
2323
}
2424
]
2525
}

packages/docprovider/package.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717
],
1818
"main": "lib/index.js",
1919
"types": "lib/index.d.ts",
20+
"style": "style/index.css",
2021
"directories": {
2122
"lib": "lib/"
2223
},
2324
"files": [
2425
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
2526
"schema/*.json",
26-
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
27+
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
28+
"style/index.js"
2729
],
2830
"scripts": {
2931
"build": "tsc -b",
@@ -38,7 +40,7 @@
3840
},
3941
"dependencies": {
4042
"@jupyterlab/shared-models": "^4.0.0-alpha.1",
41-
"@jupyterlab/statedb": "^4.0.0-alpha.1",
43+
"@jupyterlab/user": "^4.0.0-alpha.1",
4244
"@lumino/coreutils": "^1.11.1",
4345
"lib0": "^0.2.42",
4446
"y-websocket": "^1.3.15",
@@ -54,5 +56,6 @@
5456
},
5557
"publishConfig": {
5658
"access": "public"
57-
}
59+
},
60+
"styleModule": "style/index.js"
5861
}

packages/docprovider/src/awareness.ts

-104
This file was deleted.

packages/docprovider/src/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
* @module docprovider
88
*/
99

10-
export * from './awareness';
1110
export * from './mock';
1211
export * from './tokens';
1312
export * from './yprovider';

0 commit comments

Comments
 (0)