##// END OF EJS Templates
Fixed session js ajax request....
Zachary Sailer -
Show More
@@ -66,7 +66,6 b' var IPython = (function (IPython) {'
66 66 this.input_prompt_number = null;
67 67 this.collapsed = false;
68 68 this.cell_type = "code";
69 this.last_msg_id = null;
70 69
71 70
72 71 var cm_overwrite_options = {
@@ -241,12 +240,9 b' var IPython = (function (IPython) {'
241 240 * @method execute
242 241 */
243 242 CodeCell.prototype.execute = function () {
244 this.output_area.clear_output();
243 this.output_area.clear_output(true, true, true);
245 244 this.set_input_prompt('*');
246 245 this.element.addClass("running");
247 if (this.last_msg_id) {
248 this.kernel.clear_callbacks_for_msg(this.last_msg_id);
249 }
250 246 var callbacks = {
251 247 'execute_reply': $.proxy(this._handle_execute_reply, this),
252 248 'output': $.proxy(this.output_area.handle_output, this.output_area),
@@ -254,7 +250,7 b' var IPython = (function (IPython) {'
254 250 'set_next_input': $.proxy(this._handle_set_next_input, this),
255 251 'input_request': $.proxy(this._handle_input_request, this)
256 252 };
257 this.last_msg_id = this.kernel.execute(this.get_text(), callbacks, {silent: false, store_history: true});
253 var msg_id = this.session.kernel.execute(this.get_text(), callbacks, {silent: false, store_history: true});
258 254 };
259 255
260 256 /**
@@ -390,8 +386,8 b' var IPython = (function (IPython) {'
390 386 };
391 387
392 388
393 CodeCell.prototype.clear_output = function (wait) {
394 this.output_area.clear_output(wait);
389 CodeCell.prototype.clear_output = function (stdout, stderr, other) {
390 this.output_area.clear_output(stdout, stderr, other);
395 391 };
396 392
397 393
@@ -13,31 +13,31 b' var IPython = (function (IPython) {'
13 13
14 14 var Session = function(notebook_name, notebook_path, Notebook){
15 15 this.kernel = null;
16 this.kernel_id = null;
17 this.session_id = null;
18 this.notebook_name = notebook_name;
19 this.notebook_path = notebook_path;
16 this.id = null;
17 this.name = notebook_name;
18 this.path = notebook_path;
20 19 this.notebook = Notebook;
21 20 this._baseProjectUrl = Notebook.baseProjectUrl()
22 21 };
23 22
24 23 Session.prototype.start = function() {
25 24 var that = this
26 var notebook = {'notebook':{'name': this.notebook_name, 'path': this.notebook_path}}
25 var notebook = {'notebook':{'name': this.name, 'path': this.path}}
27 26 var settings = {
28 27 processData : false,
29 28 cache : false,
30 29 type : "POST",
31 30 data: JSON.stringify(notebook),
32 31 dataType : "json",
32 success : $.proxy(this.start_kernel, that),
33 33 };
34 34 var url = this._baseProjectUrl + 'api/sessions';
35 35 $.ajax(url, settings);
36 36 };
37 37
38 38 Session.prototype.notebook_rename = function (name, path) {
39 this.notebook_name = name;
40 this.notebook_path = path;
39 this.name = name;
40 this.path = path;
41 41 var notebook = {'notebook':{'name':name, 'path': path}};
42 42 var settings = {
43 43 processData : false,
@@ -68,7 +68,7 b' var IPython = (function (IPython) {'
68 68 * @method start_kernel
69 69 */
70 70 Session.prototype.start_kernel = function (json) {
71 this.session_id = json.id;
71 this.id = json.id;
72 72 this.kernel_content = json.kernel;
73 73 var base_url = $('body').data('baseKernelUrl') + "api/kernels";
74 74 this.kernel = new IPython.Kernel(base_url, this.session_id);
@@ -112,14 +112,15 b' var IPython = (function (IPython) {'
112 112
113 113 NotebookList.prototype.sessions_loaded = function(data){
114 114 this.sessions = new Object();
115 console.log(data)
115 116 var len = data.length;
116 117 if (len != 0) {
117 118 for (var i=0; i<len; i++) {
118 if (data[i]['path']==null) {
119 nb_path = data[i]['name'];
119 if (data[i]['notebook']['path']==null) {
120 nb_path = data[i]['notebook']['name'];
120 121 }
121 122 else {
122 nb_path = data[i]['path'] + data[i]['name'];
123 nb_path = data[i]['notebook']['path'] + data[i]['notebook']['name'];
123 124 }
124 125 this.sessions[nb_path]= data[i]['id'];
125 126 }
@@ -352,4 +353,3 b' var IPython = (function (IPython) {'
352 353 return IPython;
353 354
354 355 }(IPython));
355
General Comments 0
You need to be logged in to leave comments. Login now