##// END OF EJS Templates
Re-add shutdown button to running tab
Jonathan Frederic -
Show More
@@ -51,6 +51,23 b' define(['
51 }
51 }
52 $('#running_list_header').toggle($.isEmptyObject(d));
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 // Backwards compatability.
72 // Backwards compatability.
56 IPython.KernelList = KernelList;
73 IPython.KernelList = KernelList;
@@ -431,6 +431,15 b' define(['
431
431
432 NotebookList.prototype.shutdown_selected = function() {
432 NotebookList.prototype.shutdown_selected = function() {
433 var that = this;
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 var settings = {
443 var settings = {
435 processData : false,
444 processData : false,
436 cache : false,
445 cache : false,
@@ -442,20 +451,16 b' define(['
442 error : utils.log_ajax_error,
451 error : utils.log_ajax_error,
443 };
452 };
444
453
445 this.selected.forEach(function(item) {
454 var session = this.sessions[path];
446 if (item.type == 'notebook') {
455 if (session) {
447 var session = that.sessions[item.path];
456 var url = utils.url_join_encode(
448 if (session) {
457 this.base_url,
449 var url = utils.url_join_encode(
458 'api/sessions',
450 that.base_url,
459 session
451 'api/sessions',
460 );
452 session
461 $.ajax(url, settings);
453 );
462 }
454 $.ajax(url, settings);
463 }
455 }
456 }
457 });
458 };
459
464
460 NotebookList.prototype.rename_selected = function() {
465 NotebookList.prototype.rename_selected = function() {
461 if (this.selected.length != 1) return;
466 if (this.selected.length != 1) return;
General Comments 0
You need to be logged in to leave comments. Login now