fix kill_and_exit button in notebook

Zachary Sailer 13 years ago committed by MinRK
parent 62ec52e276
commit d41544865a

@ -20,7 +20,7 @@ var IPython = (function (IPython) {
"use strict";
/**
* A MenuBar Class to generate the menubar of IPython noteboko
* A MenuBar Class to generate the menubar of IPython notebook
* @Class MenuBar
*
* @constructor
@ -110,8 +110,8 @@ var IPython = (function (IPython) {
this.element.find('#restore_checkpoint').click(function () {
});
this.element.find('#kill_and_exit').click(function () {
IPython.notebook.kernel.kill();
setTimeout(function(){window.close();}, 200);
IPython.notebook.session.delete_session();
setTimeout(function(){window.close();}, 500);
});
// Edit
this.element.find('#cut_cell').click(function () {

@ -17,6 +17,7 @@ var IPython = (function (IPython) {
this.session_id = null;
this.notebook_path = notebook_path;
this.notebook = Notebook;
this._baseProjectUrl = Notebook.baseProjectUrl()
};
Session.prototype.start = function(){
@ -64,7 +65,22 @@ var IPython = (function (IPython) {
Session.prototype.interrupt_kernel = function() {
this.kernel.interrupt();
}
};
Session.prototype.delete_session = function() {
var settings = {
processData : false,
cache : false,
type : "DELETE",
dataType : "json",
};
var url = this._baseProjectUrl + 'api/sessions/' + this.session_id;
$.ajax(url, settings);
};
Session.prototype.kill_kernel = function() {
this.kernel.kill();
};
IPython.Session = Session;

@ -111,7 +111,6 @@ var IPython = (function (IPython) {
success : $.proxy(this.sessions_loaded, this)
};
var url = this.baseProjectUrl() + 'api/sessions';
console.log("THIS IS A TEST");
$.ajax(url,settings);
};

Loading…
Cancel
Save