Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50659 views
1
//----------------------------------------------------------------------------
2
// Copyright (C) 2014 The IPython Development Team
3
//
4
// Distributed under the terms of the BSD License. The full license is in
5
// the file COPYING, distributed as part of this software.
6
//----------------------------------------------------------------------------
7
8
//============================================================================
9
// Running Kernels List
10
//============================================================================
11
12
var IPython = (function (IPython) {
13
"use strict";
14
15
var utils = IPython.utils;
16
17
var SesssionList = function (options) {
18
this.sessions = {};
19
this.base_url = options.base_url || utils.get_body_data("baseUrl");
20
};
21
22
SesssionList.prototype.load_sessions = function(){
23
var that = this;
24
var settings = {
25
processData : false,
26
cache : false,
27
type : "GET",
28
dataType : "json",
29
success : $.proxy(that.sessions_loaded, this),
30
error : utils.log_ajax_error,
31
};
32
var url = utils.url_join_encode(this.base_url, 'api/sessions');
33
$.ajax(url, settings);
34
};
35
36
SesssionList.prototype.sessions_loaded = function(data){
37
this.sessions = {};
38
var len = data.length;
39
var nb_path;
40
for (var i=0; i<len; i++) {
41
nb_path = utils.url_path_join(
42
data[i].notebook.path,
43
data[i].notebook.name
44
);
45
this.sessions[nb_path] = data[i].id;
46
}
47
$([IPython.events]).trigger('sessions_loaded.Dashboard', this.sessions);
48
};
49
IPython.SesssionList = SesssionList;
50
51
return IPython;
52
53
}(IPython));
54
55