Re-add shutdown button to running tab

Jonathan Frederic 11 years ago committed by Jonathan Frederic
parent 9923737e74
commit 0779c37871

@ -51,6 +51,23 @@ define([
}
$('#running_list_header').toggle($.isEmptyObject(d));
};
KernelList.prototype.add_link = function (model, item) {
notebooklist.NotebookList.prototype.add_link.apply(this, [model, item])
var running_indicator = item.find(".item_buttons")
.text('');
var that = this;
var shutdown_button = $('<button/>')
.addClass('btn btn-warning btn-xs')
.text('Shutdown')
.click(function() {
var path = $(this).parent().parent().parent().data('path');
that.shutdown_notebook(path);
})
.appendTo(running_indicator);
};
// Backwards compatability.
IPython.KernelList = KernelList;

@ -430,6 +430,15 @@ define([
NotebookList.prototype.shutdown_selected = function() {
var that = this;
this.selected.forEach(function(item) {
if (item.type == 'notebook') {
that.shutdown_notebook(item.path);
}
});
};
NotebookList.prototype.shutdown_notebook = function(path) {
var that = this;
var settings = {
processData : false,
@ -442,20 +451,16 @@ define([
error : utils.log_ajax_error,
};
this.selected.forEach(function(item) {
if (item.type == 'notebook') {
var session = that.sessions[item.path];
if (session) {
var url = utils.url_join_encode(
that.base_url,
'api/sessions',
session
);
$.ajax(url, settings);
}
}
});
};
var session = this.sessions[path];
if (session) {
var url = utils.url_join_encode(
this.base_url,
'api/sessions',
session
);
$.ajax(url, settings);
}
}
NotebookList.prototype.rename_selected = function() {
if (this.selected.length != 1) return;

Loading…
Cancel
Save