@jupyter/collaboration 4.2.0 → 4.2.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/userinfopanel.d.ts +4 -1
- package/lib/userinfopanel.js +8 -3
- package/package.json +1 -1
package/lib/userinfopanel.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dialog, ReactWidget } from '@jupyterlab/apputils';
|
|
2
|
-
import { User } from '@jupyterlab/services';
|
|
2
|
+
import { ServerConnection, User } from '@jupyterlab/services';
|
|
3
3
|
import { IRenderMime } from '@jupyterlab/rendermime-interfaces';
|
|
4
4
|
import { Panel } from '@lumino/widgets';
|
|
5
5
|
/**
|
|
@@ -7,10 +7,12 @@ import { Panel } from '@lumino/widgets';
|
|
|
7
7
|
*/
|
|
8
8
|
type UserInfoProps = {
|
|
9
9
|
userManager: User.IManager;
|
|
10
|
+
serverSettings?: ServerConnection.ISettings;
|
|
10
11
|
trans: IRenderMime.TranslationBundle;
|
|
11
12
|
};
|
|
12
13
|
export declare class UserInfoPanel extends Panel {
|
|
13
14
|
private _profile;
|
|
15
|
+
private _serverSettings?;
|
|
14
16
|
private _body;
|
|
15
17
|
constructor(options: UserInfoProps);
|
|
16
18
|
}
|
|
@@ -19,6 +21,7 @@ export declare class UserInfoPanel extends Panel {
|
|
|
19
21
|
*/
|
|
20
22
|
export declare class UserInfoBody extends ReactWidget implements Dialog.IBodyWidget<User.IManager> {
|
|
21
23
|
private _userManager;
|
|
24
|
+
private _serverSettings;
|
|
22
25
|
private _trans;
|
|
23
26
|
/**
|
|
24
27
|
* Constructs a new settings widget.
|
package/lib/userinfopanel.js
CHANGED
|
@@ -11,10 +11,12 @@ export class UserInfoPanel extends Panel {
|
|
|
11
11
|
super({});
|
|
12
12
|
this.addClass('jp-UserInfoPanel');
|
|
13
13
|
this._profile = options.userManager;
|
|
14
|
+
this._serverSettings = options.serverSettings;
|
|
14
15
|
this._body = null;
|
|
15
16
|
if (this._profile.isReady) {
|
|
16
17
|
this._body = new UserInfoBody({
|
|
17
18
|
userManager: this._profile,
|
|
19
|
+
serverSettings: this._serverSettings,
|
|
18
20
|
trans: options.trans
|
|
19
21
|
});
|
|
20
22
|
this.addWidget(this._body);
|
|
@@ -25,6 +27,7 @@ export class UserInfoPanel extends Panel {
|
|
|
25
27
|
.then(() => {
|
|
26
28
|
this._body = new UserInfoBody({
|
|
27
29
|
userManager: this._profile,
|
|
30
|
+
serverSettings: this._serverSettings,
|
|
28
31
|
trans: options.trans
|
|
29
32
|
});
|
|
30
33
|
this.addWidget(this._body);
|
|
@@ -42,6 +45,7 @@ export class UserInfoBody extends ReactWidget {
|
|
|
42
45
|
* Constructs a new settings widget.
|
|
43
46
|
*/
|
|
44
47
|
constructor(props) {
|
|
48
|
+
var _a;
|
|
45
49
|
super();
|
|
46
50
|
this.onClick = () => {
|
|
47
51
|
if (!this._userManager.identity) {
|
|
@@ -56,15 +60,14 @@ export class UserInfoBody extends ReactWidget {
|
|
|
56
60
|
if (result.button.accept) {
|
|
57
61
|
// Call the Jupyter Server API to update the user field
|
|
58
62
|
try {
|
|
59
|
-
const
|
|
60
|
-
const url = URLExt.join(settings.baseUrl, '/api/me');
|
|
63
|
+
const url = URLExt.join(this._serverSettings.baseUrl, '/api/me');
|
|
61
64
|
const body = {
|
|
62
65
|
method: 'PATCH',
|
|
63
66
|
body: JSON.stringify(result.value)
|
|
64
67
|
};
|
|
65
68
|
let response;
|
|
66
69
|
try {
|
|
67
|
-
response = await ServerConnection.makeRequest(url, body,
|
|
70
|
+
response = await ServerConnection.makeRequest(url, body, this._serverSettings);
|
|
68
71
|
}
|
|
69
72
|
catch (error) {
|
|
70
73
|
throw new ServerConnection.NetworkError(error);
|
|
@@ -83,6 +86,8 @@ export class UserInfoBody extends ReactWidget {
|
|
|
83
86
|
});
|
|
84
87
|
};
|
|
85
88
|
this._userManager = props.userManager;
|
|
89
|
+
this._serverSettings =
|
|
90
|
+
(_a = props.serverSettings) !== null && _a !== void 0 ? _a : ServerConnection.makeSettings();
|
|
86
91
|
this._trans = props.trans;
|
|
87
92
|
}
|
|
88
93
|
get user() {
|