kernellist.js
34 lines
| 990 B
| application/javascript
|
JavascriptLexer
Jonathan Frederic
|
r17190 | // Copyright (c) IPython Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||||
define([ | ||||
'base/js/namespace', | ||||
Jonathan Frederic
|
r17200 | 'jquery', | ||
Jonathan Frederic
|
r17190 | 'tree/js/notebooklist', | ||
Jonathan Frederic
|
r17202 | ], function(IPython, $, notebooklist) { | ||
Paul Ivanov
|
r15382 | "use strict"; | ||
Jonathan Frederic
|
r17190 | var KernelList = function (selector, options, session_list) { | ||
Jonathan Frederic
|
r17202 | notebooklist.NotebookList.call(this, selector, options, 'running', session_list); | ||
Paul Ivanov
|
r15382 | }; | ||
Jonathan Frederic
|
r17190 | KernelList.prototype = Object.create(NotebookList.prototype); | ||
Paul Ivanov
|
r15382 | |||
Paul Ivanov
|
r15454 | KernelList.prototype.sessions_loaded = function (d) { | ||
Paul Ivanov
|
r15479 | this.sessions = d; | ||
Paul Ivanov
|
r15454 | this.clear_list(); | ||
var item; | ||||
Paul Ivanov
|
r15479 | for (var path in d) { | ||
item = this.new_notebook_item(-1); | ||||
Paul Ivanov
|
r15457 | this.add_link('', path, item); | ||
Paul Ivanov
|
r15518 | this.add_shutdown_button(item, this.sessions[path]); | ||
Paul Ivanov
|
r15454 | } | ||
Paul Ivanov
|
r15512 | $('#running_list_header').toggle($.isEmptyObject(d)); | ||
Jonathan Frederic
|
r17190 | }; | ||
Paul Ivanov
|
r15454 | |||
Jonathan Frederic
|
r17190 | // Backwards compatability. | ||
Paul Ivanov
|
r15382 | IPython.KernelList = KernelList; | ||
Jonathan Frederic
|
r17201 | return {'KernelList': KernelList}; | ||
Jonathan Frederic
|
r17190 | }); | ||