##// END OF EJS Templates
Re-add shutdown button to running tab
Jonathan Frederic -
Show More
@@ -51,6 +51,23 b' define(['
51 51 }
52 52 $('#running_list_header').toggle($.isEmptyObject(d));
53 53 };
54
55 KernelList.prototype.add_link = function (model, item) {
56 notebooklist.NotebookList.prototype.add_link.apply(this, [model, item])
57
58 var running_indicator = item.find(".item_buttons")
59 .text('');
60
61 var that = this;
62 var shutdown_button = $('<button/>')
63 .addClass('btn btn-warning btn-xs')
64 .text('Shutdown')
65 .click(function() {
66 var path = $(this).parent().parent().parent().data('path');
67 that.shutdown_notebook(path);
68 })
69 .appendTo(running_indicator);
70 };
54 71
55 72 // Backwards compatability.
56 73 IPython.KernelList = KernelList;
@@ -431,6 +431,15 b' define(['
431 431
432 432 NotebookList.prototype.shutdown_selected = function() {
433 433 var that = this;
434 this.selected.forEach(function(item) {
435 if (item.type == 'notebook') {
436 that.shutdown_notebook(item.path);
437 }
438 });
439 };
440
441 NotebookList.prototype.shutdown_notebook = function(path) {
442 var that = this;
434 443 var settings = {
435 444 processData : false,
436 445 cache : false,
@@ -442,20 +451,16 b' define(['
442 451 error : utils.log_ajax_error,
443 452 };
444 453
445 this.selected.forEach(function(item) {
446 if (item.type == 'notebook') {
447 var session = that.sessions[item.path];
448 if (session) {
449 var url = utils.url_join_encode(
450 that.base_url,
451 'api/sessions',
452 session
453 );
454 $.ajax(url, settings);
455 }
456 }
457 });
458 };
454 var session = this.sessions[path];
455 if (session) {
456 var url = utils.url_join_encode(
457 this.base_url,
458 'api/sessions',
459 session
460 );
461 $.ajax(url, settings);
462 }
463 }
459 464
460 465 NotebookList.prototype.rename_selected = function() {
461 466 if (this.selected.length != 1) return;
General Comments 0
You need to be logged in to leave comments. Login now