Show More
@@ -12,13 +12,35 b'' | |||||
12 | var IPython = (function (IPython) { |
|
12 | var IPython = (function (IPython) { | |
13 | "use strict"; |
|
13 | "use strict"; | |
14 |
|
14 | |||
15 |
|
15 | var utils = IPython.utils; | ||
|
16 | ||||
16 | var KernelList = function (selector, options) { |
|
17 | var KernelList = function (selector, options) { | |
17 | IPython.NotebookList.call(this, selector, options); |
|
18 | IPython.NotebookList.call(this, selector, options, 'running'); | |
18 | }; |
|
19 | }; | |
19 |
|
20 | |||
20 | KernelList.prototype = IPython.NotebookList.prototype; |
|
21 | KernelList.prototype = Object.create(IPython.NotebookList.prototype); | |
21 |
|
22 | |||
|
23 | KernelList.prototype.sessions_loaded = function (d) { | |||
|
24 | // clear out the previous list | |||
|
25 | this.clear_list(); | |||
|
26 | var len = d.length; | |||
|
27 | var item; | |||
|
28 | for (var i=0; i < d.length; i++) { | |||
|
29 | var path = utils.url_path_join(d[i].notebook.path, d[i].notebook.name); | |||
|
30 | var name = d[i].name; | |||
|
31 | item = this.new_notebook_item(i); | |||
|
32 | this.add_link(path, path, item); | |||
|
33 | this.sessions[path] = d[i].id; | |||
|
34 | this.add_shutdown_button(item,this.sessions[path]); | |||
|
35 | } | |||
|
36 | ||||
|
37 | if (len > 0) { | |||
|
38 | $('#' + this.element_name + '_list_header').hide(); | |||
|
39 | } else { | |||
|
40 | $('#' + this.element_name + '_list_header').show(); | |||
|
41 | } | |||
|
42 | } | |||
|
43 | ||||
22 | IPython.KernelList = KernelList; |
|
44 | IPython.KernelList = KernelList; | |
23 |
|
45 | |||
24 | return IPython; |
|
46 | return IPython; |
@@ -24,7 +24,7 b' $(document).ready(function () {' | |||||
24 | }; |
|
24 | }; | |
25 | IPython.notebook_list = new IPython.NotebookList('#notebook_list', opts); |
|
25 | IPython.notebook_list = new IPython.NotebookList('#notebook_list', opts); | |
26 | IPython.cluster_list = new IPython.ClusterList('#cluster_list', opts); |
|
26 | IPython.cluster_list = new IPython.ClusterList('#cluster_list', opts); | |
27 |
IPython.kernel_list = new IPython.KernelList('# |
|
27 | IPython.kernel_list = new IPython.KernelList('#running_list', opts); | |
28 | IPython.login_widget = new IPython.LoginWidget('#login_widget', opts); |
|
28 | IPython.login_widget = new IPython.LoginWidget('#login_widget', opts); | |
29 |
|
29 | |||
30 | var interval_id=0; |
|
30 | var interval_id=0; | |
@@ -37,6 +37,7 b' $(document).ready(function () {' | |||||
37 | if($('.upload_button').length == 0) |
|
37 | if($('.upload_button').length == 0) | |
38 | { |
|
38 | { | |
39 | IPython.notebook_list.load_sessions(); |
|
39 | IPython.notebook_list.load_sessions(); | |
|
40 | IPython.kernel_list.load_sessions(); | |||
40 | IPython.cluster_list.load_list(); |
|
41 | IPython.cluster_list.load_list(); | |
41 | } |
|
42 | } | |
42 | if (!interval_id){ |
|
43 | if (!interval_id){ | |
@@ -44,6 +45,7 b' $(document).ready(function () {' | |||||
44 | if($('.upload_button').length == 0) |
|
45 | if($('.upload_button').length == 0) | |
45 | { |
|
46 | { | |
46 | IPython.notebook_list.load_sessions(); |
|
47 | IPython.notebook_list.load_sessions(); | |
|
48 | IPython.kernel_list.load_sessions(); | |||
47 | IPython.cluster_list.load_list(); |
|
49 | IPython.cluster_list.load_list(); | |
48 | } |
|
50 | } | |
49 | }, time_refresh*1000); |
|
51 | }, time_refresh*1000); |
@@ -14,7 +14,9 b' var IPython = (function (IPython) {' | |||||
14 |
|
14 | |||
15 | var utils = IPython.utils; |
|
15 | var utils = IPython.utils; | |
16 |
|
16 | |||
17 | var NotebookList = function (selector, options) { |
|
17 | var NotebookList = function (selector, options, element_name) { | |
|
18 | // allow code re-use by just changing element_name in kernellist.js | |||
|
19 | this.element_name = element_name || 'notebook'; | |||
18 | this.selector = selector; |
|
20 | this.selector = selector; | |
19 | if (this.selector !== undefined) { |
|
21 | if (this.selector !== undefined) { | |
20 | this.element = $(selector); |
|
22 | this.element = $(selector); | |
@@ -28,10 +30,10 b' var IPython = (function (IPython) {' | |||||
28 | }; |
|
30 | }; | |
29 |
|
31 | |||
30 | NotebookList.prototype.style = function () { |
|
32 | NotebookList.prototype.style = function () { | |
31 |
$('# |
|
33 | $('#' + this.element_name + '_toolbar').addClass('list_toolbar'); | |
32 | $('#drag_info').addClass('toolbar_info'); |
|
34 | $('#drag_info').addClass('toolbar_info'); | |
33 |
$('# |
|
35 | $('#' + this.element_name + '_buttons').addClass('toolbar_buttons'); | |
34 |
$('# |
|
36 | $('#' + this.element_name + '_list_header').addClass('list_header'); | |
35 | this.element.addClass("list_container"); |
|
37 | this.element.addClass("list_container"); | |
36 | }; |
|
38 | }; | |
37 |
|
39 |
@@ -70,14 +70,16 b' data-base-kernel-url="{{base_kernel_url}}"' | |||||
70 | </div> |
|
70 | </div> | |
71 | <div class="span4" class="clearfix"> |
|
71 | <div class="span4" class="clearfix"> | |
72 | <span id="running_buttons" class="pull-right"> |
|
72 | <span id="running_buttons" class="pull-right"> | |
73 |
<button id="refresh_running_list" title="Refresh |
|
73 | <button id="refresh_running_list" title="Refresh running list" class="btn btn-small"><i class="icon-refresh"></i></button> | |
74 | </span> |
|
74 | </span> | |
75 | </div> |
|
75 | </div> | |
76 | </div> |
|
76 | </div> | |
77 |
|
77 | |||
78 | <div id="running_list"> |
|
78 | <div id="running_list"> | |
79 | <div id="running_list_header" class="row-fluid list_header"> |
|
79 | <div id="running_list_header" class="row-fluid list_header" style='display:none'> | |
80 | </div> |
|
80 | <div> There are no actively running kernels </div> | |
|
81 | <!-- damn it, I seem to need this stupid placeholder, otherwise items don't get added to the list --> | |||
|
82 | </div> | |||
81 | </div> |
|
83 | </div> | |
82 | </div> |
|
84 | </div> | |
83 |
|
85 |
General Comments 0
You need to be logged in to leave comments.
Login now