Update JS for kernels and sessions APIs

This commit is contained in:
Thomas Kluyver 2014-06-20 10:33:16 -07:00
parent 806432072a
commit 6efbe46b73
4 changed files with 13 additions and 3 deletions

View File

@ -1495,7 +1495,12 @@ define([
base_url: this.base_url,
notebook_path: this.notebook_path,
notebook_name: this.notebook_name,
// For now, create all sessions with the 'python' kernel, which is the
// default. Later, the user will be able to select kernels. This is
// overridden if KernelManager.kernel_cmd is specified for the server.
kernel_name: 'python'
notebook: this});
this.session.start($.proxy(this._session_started, this));
};

View File

@ -15,13 +15,14 @@ define([
* A Kernel Class to communicate with the Python kernel
* @Class Kernel
*/
var Kernel = function (kernel_service_url, notebook) {
var Kernel = function (kernel_service_url, notebook, name) {
this.events = notebook.events;
this.kernel_id = null;
this.shell_channel = null;
this.iopub_channel = null;
this.stdin_channel = null;
this.kernel_service_url = kernel_service_url;
this.name = name;
this.running = false;
this.username = "username";
this.session_id = utils.uuid();

View File

@ -15,6 +15,7 @@ define([
this.notebook = options.notebook;
this.name = options.notebook_name;
this.path = options.notebook_path;
this.kernel_name = options.kernel_name;
this.base_url = options.base_url;
};
@ -24,6 +25,9 @@ define([
notebook : {
name : this.name,
path : this.path
},
kernel : {
name : this.kernel_name
}
};
var settings = {
@ -87,7 +91,7 @@ define([
Session.prototype._handle_start_success = function (data, status, xhr) {
this.id = data.id;
var kernel_service_url = utils.url_path_join(this.base_url, "api/kernels");
this.kernel = new kernel.Kernel(kernel_service_url, this.notebook);
this.kernel = new kernel.Kernel(kernel_service_url, this.notebook, this.kernel_name);
this.kernel._kernel_started(data.kernel);
};

View File

@ -80,7 +80,7 @@ casper.notebook_test(function () {
});
return return_this_thing;
}, {nbname:nbname});
this.test.assertEquals(notebook_url == null, false, "Escaped URL in notebook list");
this.test.assertNotEquals(notebook_url, null, "Escaped URL in notebook list");
// open the notebook
this.open(notebook_url);
});