kernellist.js
45 lines
| 1.3 KiB
| application/javascript
|
JavascriptLexer
|
r17190 | // Copyright (c) IPython Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||||
define([ | ||||
'base/js/namespace', | ||||
|
r17200 | 'jquery', | ||
|
r17190 | 'tree/js/notebooklist', | ||
|
r17202 | ], function(IPython, $, notebooklist) { | ||
|
r15382 | "use strict"; | ||
|
r17210 | var KernelList = function (selector, options) { | ||
|
r17211 | // Constructor | ||
// | ||||
// Parameters: | ||||
// selector: string | ||||
// options: dictionary | ||||
// Dictionary of keyword arguments. | ||||
// session_list: SessionList instance | ||||
// base_url: string | ||||
// notebook_path: string | ||||
|
r17210 | notebooklist.NotebookList.call(this, selector, $.extend({ | ||
element_name: 'running'}, | ||||
options)); | ||||
|
r15382 | }; | ||
|
r17203 | KernelList.prototype = Object.create(notebooklist.NotebookList.prototype); | ||
|
r15382 | |||
|
r15454 | KernelList.prototype.sessions_loaded = function (d) { | ||
|
r15479 | this.sessions = d; | ||
|
r15454 | this.clear_list(); | ||
var item; | ||||
|
r15479 | for (var path in d) { | ||
item = this.new_notebook_item(-1); | ||||
|
r15457 | this.add_link('', path, item); | ||
|
r15518 | this.add_shutdown_button(item, this.sessions[path]); | ||
|
r15454 | } | ||
|
r15512 | $('#running_list_header').toggle($.isEmptyObject(d)); | ||
|
r17190 | }; | ||
|
r15454 | |||
|
r17190 | // Backwards compatability. | ||
|
r15382 | IPython.KernelList = KernelList; | ||
|
r17201 | return {'KernelList': KernelList}; | ||
|
r17190 | }); | ||