|
@@ -2,6 +2,8 @@
|
|
|
// Distributed under the terms of the Modified BSD License.
|
|
|
|
|
|
import {
|
|
|
+ ConnectionLost,
|
|
|
+ IConnectionLost,
|
|
|
ILabShell,
|
|
|
ILabStatus,
|
|
|
ILayoutRestorer,
|
|
@@ -73,10 +75,11 @@ namespace CommandIDs {
|
|
|
*/
|
|
|
const main: JupyterFrontEndPlugin<void> = {
|
|
|
id: '@jupyterlab/application-extension:main',
|
|
|
- requires: [ICommandPalette, IRouter, IWindowResolver],
|
|
|
+ requires: [ICommandPalette, IConnectionLost, IRouter, IWindowResolver],
|
|
|
activate: (
|
|
|
app: JupyterFrontEnd,
|
|
|
palette: ICommandPalette,
|
|
|
+ connectionLost: IConnectionLost,
|
|
|
router: IRouter,
|
|
|
resolver: IWindowResolver
|
|
|
) => {
|
|
@@ -108,6 +111,12 @@ const main: JupyterFrontEndPlugin<void> = {
|
|
|
app.commands.notifyCommandChanged();
|
|
|
});
|
|
|
|
|
|
+ // If the connection to the server is lost, handle it with the
|
|
|
+ // connection lost token.
|
|
|
+ app.serviceManager.terminals.connectionFailure.connect(
|
|
|
+ connectionLost as any
|
|
|
+ );
|
|
|
+
|
|
|
const builder = app.serviceManager.builder;
|
|
|
const build = () => {
|
|
|
return builder
|
|
@@ -741,6 +750,18 @@ const paths: JupyterFrontEndPlugin<JupyterFrontEnd.IPaths> = {
|
|
|
provides: JupyterFrontEnd.IPaths
|
|
|
};
|
|
|
|
|
|
+/**
|
|
|
+ * The default JupyterLab paths dictionary provider.
|
|
|
+ */
|
|
|
+const connectionlost: JupyterFrontEndPlugin<IConnectionLost> = {
|
|
|
+ id: '@jupyterlab/apputils-extension:connectionlost',
|
|
|
+ activate: (app: JupyterFrontEnd): IConnectionLost => {
|
|
|
+ return ConnectionLost;
|
|
|
+ },
|
|
|
+ autoStart: true,
|
|
|
+ provides: IConnectionLost
|
|
|
+};
|
|
|
+
|
|
|
/**
|
|
|
* Export the plugins as default.
|
|
|
*/
|
|
@@ -755,7 +776,8 @@ const plugins: JupyterFrontEndPlugin<any>[] = [
|
|
|
shell,
|
|
|
status,
|
|
|
info,
|
|
|
- paths
|
|
|
+ paths,
|
|
|
+ connectionlost
|
|
|
];
|
|
|
|
|
|
export default plugins;
|