@jupyterlab/application 4.2.3 → 4.3.0-alpha.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.
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
- import { showErrorMessage } from '@jupyterlab/apputils';
3
+ import { Dialog, showDialog } from '@jupyterlab/apputils';
4
4
  import { nullTranslator } from '@jupyterlab/translation';
5
5
  /**
6
6
  * A default connection lost handler, which brings up an error dialog.
@@ -12,6 +12,45 @@ export const ConnectionLost = async function (manager, err, translator) {
12
12
  const networkMsg = trans.__('A connection to the Jupyter server could not be established.\n' +
13
13
  'JupyterLab will continue trying to reconnect.\n' +
14
14
  'Check your network connection or Jupyter server configuration.\n');
15
- return showErrorMessage(title, { message: networkMsg });
15
+ if (!Private.displayConnectionLost) {
16
+ return;
17
+ }
18
+ if (Private.serverConnectionLost) {
19
+ // Wait for the pre-existing promise to complete
20
+ await Private.serverConnectionLost;
21
+ return;
22
+ }
23
+ const dialog = showDialog({
24
+ title: title,
25
+ body: networkMsg,
26
+ checkbox: {
27
+ label: trans.__('Do not show this message again in this session.'),
28
+ caption: trans.__('If checked, you will not see a dialog informing you about an issue with server connection in this session.')
29
+ },
30
+ buttons: [Dialog.okButton({ label: trans.__('Dismiss') })]
31
+ })
32
+ .then(result => {
33
+ if (result.isChecked) {
34
+ Private.displayConnectionLost = false;
35
+ }
36
+ return;
37
+ })
38
+ .catch(error => {
39
+ console.error('An error occurred while showing the dialog: ', error);
40
+ })
41
+ .finally(() => {
42
+ Private.serverConnectionLost = undefined;
43
+ });
44
+ Private.serverConnectionLost = dialog;
16
45
  };
46
+ /**
47
+ * The namespace for module private data.
48
+ */
49
+ var Private;
50
+ (function (Private) {
51
+ /**
52
+ * Boolean determining if connection lost dialog is displayed.
53
+ */
54
+ Private.displayConnectionLost = true;
55
+ })(Private || (Private = {}));
17
56
  //# sourceMappingURL=connectionlost.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"connectionlost.js","sourceRoot":"","sources":["../src/connectionlost.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAe,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGtE;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAoB,KAAK,WAClD,OAAgC,EAChC,GAAkC,EAClC,UAAwB;IAExB,UAAU,GAAG,UAAU,IAAI,cAAc,CAAC;IAC1C,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC5C,MAAM,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,KAAK,CAAC,EAAE,CACzB,gEAAgE;QAC9D,iDAAiD;QACjD,kEAAkE,CACrE,CAAC;IAEF,OAAO,gBAAgB,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;AAC1D,CAAC,CAAC"}
1
+ {"version":3,"file":"connectionlost.js","sourceRoot":"","sources":["../src/connectionlost.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAe,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGtE;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAoB,KAAK,WAClD,OAAgC,EAChC,GAAkC,EAClC,UAAwB;IAExB,UAAU,GAAG,UAAU,IAAI,cAAc,CAAC;IAC1C,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC5C,MAAM,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,KAAK,CAAC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.3",
3
+ "version": "4.3.0-alpha.1",
4
4
  "description": "JupyterLab - Application",
5
5
  "homepage": "https://github.com/jupyterlab/jupyterlab",
6
6
  "bugs": {
@@ -42,15 +42,15 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@fortawesome/fontawesome-free": "^5.12.0",
45
- "@jupyterlab/apputils": "^4.3.3",
46
- "@jupyterlab/coreutils": "^6.2.3",
47
- "@jupyterlab/docregistry": "^4.2.3",
48
- "@jupyterlab/rendermime": "^4.2.3",
49
- "@jupyterlab/rendermime-interfaces": "^3.10.3",
50
- "@jupyterlab/services": "^7.2.3",
51
- "@jupyterlab/statedb": "^4.2.3",
52
- "@jupyterlab/translation": "^4.2.3",
53
- "@jupyterlab/ui-components": "^4.2.3",
45
+ "@jupyterlab/apputils": "^4.4.0-alpha.1",
46
+ "@jupyterlab/coreutils": "^6.3.0-alpha.1",
47
+ "@jupyterlab/docregistry": "^4.3.0-alpha.1",
48
+ "@jupyterlab/rendermime": "^4.3.0-alpha.1",
49
+ "@jupyterlab/rendermime-interfaces": "^3.11.0-alpha.1",
50
+ "@jupyterlab/services": "^7.3.0-alpha.1",
51
+ "@jupyterlab/statedb": "^4.3.0-alpha.1",
52
+ "@jupyterlab/translation": "^4.3.0-alpha.1",
53
+ "@jupyterlab/ui-components": "^4.3.0-alpha.1",
54
54
  "@lumino/algorithm": "^2.0.1",
55
55
  "@lumino/application": "^2.3.1",
56
56
  "@lumino/commands": "^2.3.0",
@@ -63,7 +63,7 @@
63
63
  "@lumino/widgets": "^2.3.2"
64
64
  },
65
65
  "devDependencies": {
66
- "@jupyterlab/testing": "^4.2.3",
66
+ "@jupyterlab/testing": "^4.3.0-alpha.1",
67
67
  "@types/jest": "^29.2.0",
68
68
  "jest": "^29.2.0",
69
69
  "rimraf": "~5.0.5",
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
 
4
- import { showErrorMessage } from '@jupyterlab/apputils';
4
+ import { Dialog, showDialog } from '@jupyterlab/apputils';
5
5
  import { ServerConnection, ServiceManager } from '@jupyterlab/services';
6
6
  import { ITranslator, nullTranslator } from '@jupyterlab/translation';
7
7
  import { IConnectionLost } from './tokens';
@@ -23,5 +23,55 @@ export const ConnectionLost: IConnectionLost = async function (
23
23
  'Check your network connection or Jupyter server configuration.\n'
24
24
  );
25
25
 
26
- return showErrorMessage(title, { message: networkMsg });
26
+ if (!Private.displayConnectionLost) {
27
+ return;
28
+ }
29
+
30
+ if (Private.serverConnectionLost) {
31
+ // Wait for the pre-existing promise to complete
32
+ await Private.serverConnectionLost;
33
+ return;
34
+ }
35
+
36
+ const dialog = showDialog({
37
+ title: title,
38
+ body: networkMsg,
39
+ checkbox: {
40
+ label: trans.__('Do not show this message again in this session.'),
41
+ caption: trans.__(
42
+ 'If checked, you will not see a dialog informing you about an issue with server connection in this session.'
43
+ )
44
+ },
45
+ buttons: [Dialog.okButton({ label: trans.__('Dismiss') })]
46
+ })
47
+ .then(result => {
48
+ if (result.isChecked) {
49
+ Private.displayConnectionLost = false;
50
+ }
51
+ return;
52
+ })
53
+ .catch(error => {
54
+ console.error('An error occurred while showing the dialog: ', error);
55
+ })
56
+ .finally(() => {
57
+ Private.serverConnectionLost = undefined;
58
+ });
59
+
60
+ Private.serverConnectionLost = dialog;
27
61
  };
62
+
63
+ /**
64
+ * The namespace for module private data.
65
+ */
66
+ namespace Private {
67
+ /**
68
+ * Boolean determining if connection lost dialog is displayed.
69
+ */
70
+ export let displayConnectionLost = true;
71
+ /**
72
+ * The resulting connection lost dialog promise.
73
+ */
74
+ export let serverConnectionLost:
75
+ | Promise<void | Dialog.IResult<string>>
76
+ | undefined;
77
+ }