fixed shutdown button refresh on dashboard

This commit is contained in:
Zachary Sailer 2013-07-09 14:45:40 -07:00 committed by MinRK
parent d41544865a
commit e4a7b724a6
2 changed files with 9 additions and 10 deletions

View File

@ -77,7 +77,7 @@ class SessionHandler(IPythonHandler):
kernel = km.kernel_model(kernel_id, self.ws_url)
sm.delete_mapping_for_session(session_id)
model = sm.session_model(session_id, notebook_name, path, kernel)
return model
self.finish(jsonapi.dumps(model))
@web.authenticated
def delete(self, session_id):
@ -87,6 +87,8 @@ class SessionHandler(IPythonHandler):
kernel_id = sm.get_kernel_from_session(session_id)
km.shutdown_kernel(kernel_id)
sm.delete_mapping_for_session(session_id)
self.set_status(204)
self.finish()
#-----------------------------------------------------------------------------

View File

@ -103,12 +103,14 @@ var IPython = (function (IPython) {
};
NotebookList.prototype.load_sessions = function(){
console.log("DID IT MAKE IT?");
var that = this;
var settings = {
processData : false,
cache : false,
type : "GET",
dataType : "json",
success : $.proxy(this.sessions_loaded, this)
success : $.proxy(that.sessions_loaded, this)
};
var url = this.baseProjectUrl() + 'api/sessions';
$.ajax(url,settings);
@ -116,7 +118,7 @@ var IPython = (function (IPython) {
NotebookList.prototype.sessions_loaded = function(data){
this.sessions=new Object();
this.sessions = new Object();
var len = data.length;
if (len != 0) {
for (var i=0; i<len; i++) {
@ -238,7 +240,7 @@ var IPython = (function (IPython) {
cache : false,
type : "DELETE",
dataType : "json",
success : function (data, status, xhr) {
success : function () {
that.load_sessions();
}
};
@ -278,12 +280,7 @@ var IPython = (function (IPython) {
parent_item.remove();
}
};
if (notebooklist.notebookPath() == "") {
var url = notebooklist.baseProjectUrl() + 'api/notebooks/' + nbname +'.ipynb';
}
else {
var url = notebooklist.baseProjectUrl() + 'api/notebooks/' + notebooklist.notebookPath() + nbname + '.ipynb';
}
var url = notebooklist.baseProjectUrl() + 'api/notebooks/' + notebooklist.notebookPath() + nbname + '.ipynb';
$.ajax(url, settings);
}
},