|
@@ -229,10 +229,10 @@ class ClientSession implements IClientSession {
|
|
|
*/
|
|
|
constructor(options: ClientSession.IOptions) {
|
|
|
this.manager = options.manager;
|
|
|
- this._kernelManager = options.kernelManager;
|
|
|
this._path = options.path || uuid();
|
|
|
this._type = options.type || '';
|
|
|
this._name = options.name || '';
|
|
|
+ this._setBusy = options.setBusy;
|
|
|
this._kernelPreference = options.kernelPreference || {};
|
|
|
}
|
|
|
|
|
@@ -740,9 +740,23 @@ class ClientSession implements IClientSession {
|
|
|
* Handle a change to the session status.
|
|
|
*/
|
|
|
private _onStatusChanged(): void {
|
|
|
- if (this._kernelManager) {
|
|
|
- this._kernelManager.updateStatus(this.kernel.id, this.status);
|
|
|
+
|
|
|
+ // Set that this kernel is busy, if we haven't already
|
|
|
+ // If we have already, and now we aren't busy, dispose
|
|
|
+ // of the busy disposable.
|
|
|
+ if (this._setBusy) {
|
|
|
+ if (this.status === 'busy') {
|
|
|
+ if (!this._busyDisposable) {
|
|
|
+ this._busyDisposable = this._setBusy();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (this._busyDisposable) {
|
|
|
+ this._busyDisposable.dispose();
|
|
|
+ delete this._busyDisposable;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
this._statusChanged.emit(this.status);
|
|
|
}
|
|
|
|
|
@@ -777,7 +791,8 @@ class ClientSession implements IClientSession {
|
|
|
private _unhandledMessage = new Signal<this, KernelMessage.IMessage>(this);
|
|
|
private _propertyChanged = new Signal<this, 'path' | 'name' | 'type'>(this);
|
|
|
private _dialog: Dialog<any> | null = null;
|
|
|
- private _kernelManager: Kernel.IManager;
|
|
|
+ private _setBusy: () => IDisposable | undefined;
|
|
|
+ private _busyDisposable: IDisposable | undefined;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -817,9 +832,9 @@ namespace ClientSession {
|
|
|
kernelPreference?: IClientSession.IKernelPreference;
|
|
|
|
|
|
/**
|
|
|
- * A kernel manager instance.
|
|
|
+ * A function to call when the session becomes busy.
|
|
|
*/
|
|
|
- kernelManager?: Kernel.IManager;
|
|
|
+ setBusy?: () => IDisposable;
|
|
|
}
|
|
|
|
|
|
/**
|