Show More
@@ -87,7 +87,7 b' define([' | |||||
87 | return modal.modal(options); |
|
87 | return modal.modal(options); | |
88 | }; |
|
88 | }; | |
89 |
|
89 | |||
90 | var edit_metadata = function (md, callback, name) { |
|
90 | var edit_metadata = function (md, callback, name, keyboard_manager, notebook) { | |
91 | name = name || "Cell"; |
|
91 | name = name || "Cell"; | |
92 | var error_div = $('<div/>').css('color', 'red'); |
|
92 | var error_div = $('<div/>').css('color', 'red'); | |
93 | var message = |
|
93 | var message = | |
@@ -141,7 +141,7 b' define([' | |||||
141 | }, |
|
141 | }, | |
142 | Cancel: {} |
|
142 | Cancel: {} | |
143 | } |
|
143 | } | |
144 | }); |
|
144 | }, keyboard_manager, notebook); | |
145 |
|
145 | |||
146 | modal.on('shown.bs.modal', function(){ editor.refresh(); }); |
|
146 | modal.on('shown.bs.modal', function(){ editor.refresh(); }); | |
147 | }; |
|
147 | }; |
@@ -17,5 +17,9 b" define(['base/js/namespace'], function(IPython) {" | |||||
17 | IPython.Events = Events; |
|
17 | IPython.Events = Events; | |
18 | IPython.events = events; |
|
18 | IPython.events = events; | |
19 |
|
19 | |||
|
20 | // This behavior is an akward exception to the normal design pattern of | |||
|
21 | // returning the namespace. Events are used eveywhere in IPython, | |||
|
22 | // and only one instance is ever used. For convenience, create and | |||
|
23 | // return that instance here instead of the namespace. | |||
20 | return events; |
|
24 | return events; | |
21 | }); |
|
25 | }); |
@@ -1,18 +1,12 b'' | |||||
1 | //---------------------------------------------------------------------------- |
|
1 | // Copyright (c) IPython Development Team. | |
2 | // Copyright (C) 2011 The IPython Development Team |
|
2 | // Distributed under the terms of the Modified BSD License. | |
3 | // |
|
3 | ||
4 | // Distributed under the terms of the BSD License. The full license is in |
|
4 | define([ | |
5 | // the file COPYING, distributed as part of this software. |
|
5 | 'base/js/namespace', | |
6 | //---------------------------------------------------------------------------- |
|
6 | 'components/jquery/jquery.min', | |
7 |
|
7 | 'base/js/utils', | ||
8 | //============================================================================ |
|
8 | ], function(IPython, $, Utils) { | |
9 | // NotebookList |
|
|||
10 | //============================================================================ |
|
|||
11 |
|
||||
12 | var IPython = (function (IPython) { |
|
|||
13 | "use strict"; |
|
9 | "use strict"; | |
14 |
|
||||
15 | var utils = IPython.utils; |
|
|||
16 |
|
10 | |||
17 | var ClusterList = function (selector, options) { |
|
11 | var ClusterList = function (selector, options) { | |
18 | this.selector = selector; |
|
12 | this.selector = selector; | |
@@ -23,8 +17,8 b' var IPython = (function (IPython) {' | |||||
23 | } |
|
17 | } | |
24 | options = options || {}; |
|
18 | options = options || {}; | |
25 | this.options = options; |
|
19 | this.options = options; | |
26 |
this.base_url = options.base_url || |
|
20 | this.base_url = options.base_url || Utils.get_body_data("baseUrl"); | |
27 |
this.notebook_path = options.notebook_path || |
|
21 | this.notebook_path = options.notebook_path || Utils.get_body_data("notebookPath"); | |
28 | }; |
|
22 | }; | |
29 |
|
23 | |||
30 | ClusterList.prototype.style = function () { |
|
24 | ClusterList.prototype.style = function () { | |
@@ -50,9 +44,9 b' var IPython = (function (IPython) {' | |||||
50 | type : "GET", |
|
44 | type : "GET", | |
51 | dataType : "json", |
|
45 | dataType : "json", | |
52 | success : $.proxy(this.load_list_success, this), |
|
46 | success : $.proxy(this.load_list_success, this), | |
53 |
error : |
|
47 | error : Utils.log_ajax_error, | |
54 | }; |
|
48 | }; | |
55 |
var url = |
|
49 | var url = Utils.url_join_encode(this.base_url, 'clusters'); | |
56 | $.ajax(url, settings); |
|
50 | $.ajax(url, settings); | |
57 | }; |
|
51 | }; | |
58 |
|
52 | |||
@@ -76,8 +70,8 b' var IPython = (function (IPython) {' | |||||
76 |
|
70 | |||
77 | var ClusterItem = function (element, options) { |
|
71 | var ClusterItem = function (element, options) { | |
78 | this.element = $(element); |
|
72 | this.element = $(element); | |
79 |
this.base_url = options.base_url || |
|
73 | this.base_url = options.base_url || Utils.get_body_data("baseUrl"); | |
80 |
this.notebook_path = options.notebook_path || |
|
74 | this.notebook_path = options.notebook_path || Utils.get_body_data("notebookPath"); | |
81 | this.data = null; |
|
75 | this.data = null; | |
82 | this.style(); |
|
76 | this.style(); | |
83 | }; |
|
77 | }; | |
@@ -132,11 +126,11 b' var IPython = (function (IPython) {' | |||||
132 | }, |
|
126 | }, | |
133 | error : function (xhr, status, error) { |
|
127 | error : function (xhr, status, error) { | |
134 | status_col.text("error starting cluster"); |
|
128 | status_col.text("error starting cluster"); | |
135 |
|
|
129 | Utils.log_ajax_error(xhr, status, error); | |
136 | } |
|
130 | } | |
137 | }; |
|
131 | }; | |
138 | status_col.text('starting'); |
|
132 | status_col.text('starting'); | |
139 |
var url = |
|
133 | var url = Utils.url_join_encode( | |
140 | that.base_url, |
|
134 | that.base_url, | |
141 | 'clusters', |
|
135 | 'clusters', | |
142 | that.data.profile, |
|
136 | that.data.profile, | |
@@ -188,11 +182,9 b' var IPython = (function (IPython) {' | |||||
188 | }); |
|
182 | }); | |
189 | }; |
|
183 | }; | |
190 |
|
184 | |||
191 |
|
185 | // For backwards compatability. | ||
192 | IPython.ClusterList = ClusterList; |
|
186 | IPython.ClusterList = ClusterList; | |
193 | IPython.ClusterItem = ClusterItem; |
|
187 | IPython.ClusterItem = ClusterItem; | |
194 |
|
188 | |||
195 |
return |
|
189 | return ClusterList; | |
196 |
|
190 | }); | ||
197 | }(IPython)); |
|
|||
198 |
|
@@ -1,24 +1,18 b'' | |||||
1 | //---------------------------------------------------------------------------- |
|
1 | // Copyright (c) IPython Development Team. | |
2 | // Copyright (C) 2014 The IPython Development Team |
|
2 | // Distributed under the terms of the Modified BSD License. | |
3 | // |
|
3 | ||
4 | // Distributed under the terms of the BSD License. The full license is in |
|
4 | define([ | |
5 | // the file COPYING, distributed as part of this software. |
|
5 | 'base/js/namespace', | |
6 | //---------------------------------------------------------------------------- |
|
6 | 'components/jquery/jquery.min', | |
7 |
|
7 | 'tree/js/notebooklist', | ||
8 | //============================================================================ |
|
8 | ], function(IPython, $, NotebookList) { | |
9 | // Running Kernels List |
|
|||
10 | //============================================================================ |
|
|||
11 |
|
||||
12 | var IPython = (function (IPython) { |
|
|||
13 | "use strict"; |
|
9 | "use strict"; | |
14 |
|
10 | |||
15 | var utils = IPython.utils; |
|
11 | var KernelList = function (selector, options, session_list) { | |
16 |
|
12 | NotebookList.call(this, selector, options, 'running', session_list); | ||
17 | var KernelList = function (selector, options) { |
|
|||
18 | IPython.NotebookList.call(this, selector, options, 'running'); |
|
|||
19 | }; |
|
13 | }; | |
20 |
|
14 | |||
21 |
KernelList.prototype = Object.create( |
|
15 | KernelList.prototype = Object.create(NotebookList.prototype); | |
22 |
|
16 | |||
23 | KernelList.prototype.sessions_loaded = function (d) { |
|
17 | KernelList.prototype.sessions_loaded = function (d) { | |
24 | this.sessions = d; |
|
18 | this.sessions = d; | |
@@ -31,10 +25,10 b' var IPython = (function (IPython) {' | |||||
31 | } |
|
25 | } | |
32 |
|
26 | |||
33 | $('#running_list_header').toggle($.isEmptyObject(d)); |
|
27 | $('#running_list_header').toggle($.isEmptyObject(d)); | |
34 | } |
|
28 | }; | |
35 |
|
29 | |||
|
30 | // Backwards compatability. | |||
36 | IPython.KernelList = KernelList; |
|
31 | IPython.KernelList = KernelList; | |
37 |
|
32 | |||
38 |
return |
|
33 | return KernelList; | |
39 |
|
34 | }); | ||
40 | }(IPython)); |
|
@@ -13,7 +13,6 b' define([' | |||||
13 | 'auth/js/loginwidget', |
|
13 | 'auth/js/loginwidget', | |
14 | 'components/jquery-ui/ui/minified/jquery-ui.min', |
|
14 | 'components/jquery-ui/ui/minified/jquery-ui.min', | |
15 | 'components/bootstrap/js/bootstrap.min', |
|
15 | 'components/bootstrap/js/bootstrap.min', | |
16 | 'base/js/dialog', |
|
|||
17 | ], function( |
|
16 | ], function( | |
18 | IPython, |
|
17 | IPython, | |
19 | $, |
|
18 | $, | |
@@ -28,13 +27,13 b' define([' | |||||
28 | page = new Page(); |
|
27 | page = new Page(); | |
29 |
|
28 | |||
30 | var opts = { |
|
29 | var opts = { | |
31 |
base_url |
|
30 | base_url: Utils.get_body_data("baseUrl"), | |
32 |
notebook_path |
|
31 | notebook_path: Utils.get_body_data("notebookPath"), | |
33 | }; |
|
32 | }; | |
34 | session_list = new SesssionList(opts); |
|
33 | session_list = new SesssionList(opts); | |
35 | notebook_list = new NotebookList('#notebook_list', opts, undefined, session_list); |
|
34 | notebook_list = new NotebookList('#notebook_list', opts, undefined, session_list); | |
36 | cluster_list = new ClusterList('#cluster_list', opts); |
|
35 | cluster_list = new ClusterList('#cluster_list', opts); | |
37 | kernel_list = new KernelList('#running_list', opts); |
|
36 | kernel_list = new KernelList('#running_list', opts, session_list); | |
38 | login_widget = new LoginWidget('#login_widget', opts); |
|
37 | login_widget = new LoginWidget('#login_widget', opts); | |
39 |
|
38 | |||
40 | $('#new_notebook').button().click(function (e) { |
|
39 | $('#new_notebook').button().click(function (e) { |
@@ -1,22 +1,17 b'' | |||||
1 | //---------------------------------------------------------------------------- |
|
1 | // Copyright (c) IPython Development Team. | |
2 | // Copyright (C) 2014 The IPython Development Team |
|
2 | // Distributed under the terms of the Modified BSD License. | |
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 |
|
3 | |||
8 | //============================================================================ |
|
4 | define([ | |
9 | // Running Kernels List |
|
5 | 'base/js/namespace', | |
10 | //============================================================================ |
|
6 | 'components/jquery/jquery.min', | |
11 |
|
7 | 'base/js/utils', | ||
12 | var IPython = (function (IPython) { |
|
8 | 'base/js/events', | |
|
9 | ], function(IPython, $, Utils, Events) { | |||
13 | "use strict"; |
|
10 | "use strict"; | |
14 |
|
11 | |||
15 | var utils = IPython.utils; |
|
|||
16 |
|
||||
17 | var SesssionList = function (options) { |
|
12 | var SesssionList = function (options) { | |
18 | this.sessions = {}; |
|
13 | this.sessions = {}; | |
19 |
this.base_url = options.base_url || |
|
14 | this.base_url = options.base_url || Utils.get_body_data("baseUrl"); | |
20 | }; |
|
15 | }; | |
21 |
|
16 | |||
22 | SesssionList.prototype.load_sessions = function(){ |
|
17 | SesssionList.prototype.load_sessions = function(){ | |
@@ -27,9 +22,9 b' var IPython = (function (IPython) {' | |||||
27 | type : "GET", |
|
22 | type : "GET", | |
28 | dataType : "json", |
|
23 | dataType : "json", | |
29 | success : $.proxy(that.sessions_loaded, this), |
|
24 | success : $.proxy(that.sessions_loaded, this), | |
30 |
error : |
|
25 | error : Utils.log_ajax_error, | |
31 | }; |
|
26 | }; | |
32 |
var url = |
|
27 | var url = Utils.url_join_encode(this.base_url, 'api/sessions'); | |
33 | $.ajax(url, settings); |
|
28 | $.ajax(url, settings); | |
34 | }; |
|
29 | }; | |
35 |
|
30 | |||
@@ -38,16 +33,17 b' var IPython = (function (IPython) {' | |||||
38 | var len = data.length; |
|
33 | var len = data.length; | |
39 | var nb_path; |
|
34 | var nb_path; | |
40 | for (var i=0; i<len; i++) { |
|
35 | for (var i=0; i<len; i++) { | |
41 |
nb_path = |
|
36 | nb_path = Utils.url_path_join( | |
42 | data[i].notebook.path, |
|
37 | data[i].notebook.path, | |
43 | data[i].notebook.name |
|
38 | data[i].notebook.name | |
44 | ); |
|
39 | ); | |
45 | this.sessions[nb_path] = data[i].id; |
|
40 | this.sessions[nb_path] = data[i].id; | |
46 | } |
|
41 | } | |
47 |
|
|
42 | Events.trigger('sessions_loaded.Dashboard', this.sessions); | |
48 | }; |
|
43 | }; | |
49 | IPython.SesssionList = SesssionList; |
|
|||
50 |
|
44 | |||
51 | return IPython; |
|
45 | // Backwards compatability. | |
|
46 | IPython.SesssionList = SesssionList; | |||
52 |
|
47 | |||
53 | }(IPython)); |
|
48 | return SesssionList; | |
|
49 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now