Show More
@@ -1,89 +1,97 b'' | |||
|
1 | 1 | |
|
2 | 2 | /** |
|
3 | 3 | * Primary styles |
|
4 | 4 | * |
|
5 | 5 | * Author: IPython Development Team |
|
6 | 6 | */ |
|
7 | 7 | |
|
8 | 8 | #ipython-main-app { |
|
9 | 9 | width: 920px; |
|
10 | 10 | margin: 30px auto 0px auto; |
|
11 | 11 | } |
|
12 | 12 | |
|
13 | 13 | #tabs { |
|
14 | 14 | border-style: none; |
|
15 | 15 | } |
|
16 | 16 | |
|
17 | 17 | #tab1, #tab2 { |
|
18 | 18 | padding: 1em 0em; |
|
19 | 19 | } |
|
20 | 20 | |
|
21 | 21 | .list_toolbar { |
|
22 | 22 | padding: 5px; |
|
23 | 23 | height: 25px; |
|
24 | 24 | line-height: 25px; |
|
25 | 25 | } |
|
26 | 26 | |
|
27 | 27 | .toolbar_info { |
|
28 | 28 | float: left; |
|
29 | 29 | } |
|
30 | 30 | |
|
31 | 31 | .toolbar_buttons { |
|
32 | 32 | float: right; |
|
33 | 33 | } |
|
34 | 34 | |
|
35 | 35 | .list_header { |
|
36 | 36 | height: 25px; |
|
37 | 37 | line-height: 25px; |
|
38 | 38 | padding: 3px 5px; |
|
39 | 39 | } |
|
40 | 40 | |
|
41 | 41 | |
|
42 | 42 | |
|
43 | 43 | .list_item { |
|
44 | 44 | height: 25px; |
|
45 | 45 | line-height: 25px; |
|
46 | 46 | padding: 3px 5px; |
|
47 | 47 | } |
|
48 | 48 | |
|
49 | 49 | .notebook_item a { |
|
50 | 50 | text-decoration: none; |
|
51 | 51 | } |
|
52 | 52 | |
|
53 | 53 | .profile_col { |
|
54 | 54 | } |
|
55 | 55 | |
|
56 | 56 | .status_col { |
|
57 | 57 | float: right; |
|
58 | 58 | width: 325px; |
|
59 | 59 | } |
|
60 | 60 | |
|
61 | 61 | .engines_col { |
|
62 | 62 | float: right; |
|
63 | 63 | width: 325px; |
|
64 | 64 | } |
|
65 | 65 | |
|
66 | 66 | .action_col { |
|
67 | 67 | float: right; |
|
68 | 68 | } |
|
69 | 69 | |
|
70 | 70 | .item_buttons { |
|
71 | 71 | float: right; |
|
72 | 72 | } |
|
73 | 73 | |
|
74 | 74 | .item_buttons .upload_button { |
|
75 | 75 | color: darkred; |
|
76 | 76 | } |
|
77 | 77 | |
|
78 | 78 | .highlight_text { |
|
79 | 79 | color: blue; |
|
80 | 80 | } |
|
81 | 81 | |
|
82 | 82 | .ui-tabs .ui-tabs-nav li a { |
|
83 | 83 | padding: .3em .5em; |
|
84 | 84 | } |
|
85 | 85 | |
|
86 | 86 | #project_name > .breadcrumb { |
|
87 | 87 | padding : 0; |
|
88 | 88 | background-color: transparent; |
|
89 | 89 | } |
|
90 | ||
|
91 | input.engine_num_input { | |
|
92 | height: 20px; | |
|
93 | margin-bottom:2px; | |
|
94 | padding-top:0; | |
|
95 | padding-bottom:0; | |
|
96 | width: 90px; | |
|
97 | } |
@@ -1,180 +1,180 b'' | |||
|
1 | 1 | //---------------------------------------------------------------------------- |
|
2 | 2 | // Copyright (C) 2008-2011 The IPython Development Team |
|
3 | 3 | // |
|
4 | 4 | // Distributed under the terms of the BSD License. The full license is in |
|
5 | 5 | // the file COPYING, distributed as part of this software. |
|
6 | 6 | //---------------------------------------------------------------------------- |
|
7 | 7 | |
|
8 | 8 | //============================================================================ |
|
9 | 9 | // NotebookList |
|
10 | 10 | //============================================================================ |
|
11 | 11 | |
|
12 | 12 | var IPython = (function (IPython) { |
|
13 | 13 | |
|
14 | 14 | var ClusterList = function (selector) { |
|
15 | 15 | this.selector = selector; |
|
16 | 16 | if (this.selector !== undefined) { |
|
17 | 17 | this.element = $(selector); |
|
18 | 18 | this.style(); |
|
19 | 19 | this.bind_events(); |
|
20 | 20 | } |
|
21 | 21 | }; |
|
22 | 22 | |
|
23 | 23 | ClusterList.prototype.style = function () { |
|
24 | 24 | $('#cluster_toolbar').addClass('list_toolbar'); |
|
25 | 25 | $('#cluster_list_info').addClass('toolbar_info'); |
|
26 | 26 | $('#cluster_buttons').addClass('toolbar_buttons'); |
|
27 | 27 | $('div#cluster_header').addClass('list_header ui-widget ui-widget-header ui-helper-clearfix'); |
|
28 | 28 | $('div#cluster_header').children().eq(0).addClass('profile_col'); |
|
29 | 29 | $('div#cluster_header').children().eq(1).addClass('action_col'); |
|
30 | 30 | $('div#cluster_header').children().eq(2).addClass('engines_col'); |
|
31 | 31 | $('div#cluster_header').children().eq(3).addClass('status_col'); |
|
32 | 32 | $('#refresh_cluster_list').button({ |
|
33 | 33 | icons : {primary: 'ui-icon-arrowrefresh-1-s'}, |
|
34 | 34 | text : false |
|
35 | 35 | }); |
|
36 | 36 | }; |
|
37 | 37 | |
|
38 | 38 | |
|
39 | 39 | ClusterList.prototype.bind_events = function () { |
|
40 | 40 | var that = this; |
|
41 | 41 | $('#refresh_cluster_list').click(function () { |
|
42 | 42 | that.load_list(); |
|
43 | 43 | }); |
|
44 | 44 | }; |
|
45 | 45 | |
|
46 | 46 | |
|
47 | 47 | ClusterList.prototype.load_list = function () { |
|
48 | 48 | var settings = { |
|
49 | 49 | processData : false, |
|
50 | 50 | cache : false, |
|
51 | 51 | type : "GET", |
|
52 | 52 | dataType : "json", |
|
53 | 53 | success : $.proxy(this.load_list_success, this) |
|
54 | 54 | }; |
|
55 | 55 | var url = $('body').data('baseProjectUrl') + 'clusters'; |
|
56 | 56 | $.ajax(url, settings); |
|
57 | 57 | }; |
|
58 | 58 | |
|
59 | 59 | |
|
60 | 60 | ClusterList.prototype.clear_list = function () { |
|
61 | 61 | this.element.children('.list_item').remove(); |
|
62 | 62 | } |
|
63 | 63 | |
|
64 | 64 | ClusterList.prototype.load_list_success = function (data, status, xhr) { |
|
65 | 65 | this.clear_list(); |
|
66 | 66 | var len = data.length; |
|
67 | 67 | for (var i=0; i<len; i++) { |
|
68 | 68 | var item_div = $('<div/>'); |
|
69 | 69 | var item = new ClusterItem(item_div); |
|
70 | 70 | item.update_state(data[i]); |
|
71 | 71 | item_div.data('item', item); |
|
72 | 72 | this.element.append(item_div); |
|
73 | 73 | }; |
|
74 | 74 | }; |
|
75 | 75 | |
|
76 | 76 | |
|
77 | 77 | var ClusterItem = function (element) { |
|
78 | 78 | this.element = $(element); |
|
79 | 79 | this.data = null; |
|
80 | 80 | this.style(); |
|
81 | 81 | }; |
|
82 | 82 | |
|
83 | 83 | |
|
84 | 84 | ClusterItem.prototype.style = function () { |
|
85 | 85 | this.element.addClass('list_item ui-widget ui-widget-content ui-helper-clearfix'); |
|
86 | 86 | this.element.css('border-top-style','none'); |
|
87 | 87 | } |
|
88 | 88 | |
|
89 | 89 | ClusterItem.prototype.update_state = function (data) { |
|
90 | 90 | this.data = data; |
|
91 | 91 | if (data.status === 'running') { |
|
92 | 92 | this.state_running(); |
|
93 | 93 | } else if (data.status === 'stopped') { |
|
94 | 94 | this.state_stopped(); |
|
95 | 95 | }; |
|
96 | 96 | |
|
97 | 97 | } |
|
98 | 98 | |
|
99 | 99 | |
|
100 | 100 | ClusterItem.prototype.state_stopped = function () { |
|
101 | 101 | var that = this; |
|
102 | 102 | this.element.empty(); |
|
103 | 103 | var profile_col = $('<span/>').addClass('profile_col').text(this.data.profile); |
|
104 | 104 | var status_col = $('<span/>').addClass('status_col').html('stopped'); |
|
105 | 105 | var engines_col = $('<span/>').addClass('engines_col'); |
|
106 |
var input = $('<input/>').attr('type',' |
|
|
106 | var input = $('<input/>').attr('type','number'). | |
|
107 | 107 | attr('size',3).addClass('engine_num_input'); |
|
108 | 108 | engines_col.append(input); |
|
109 | 109 | var action_col = $('<span/>').addClass('action_col'); |
|
110 | 110 | var start_button = $('<button>Start</button>').button(); |
|
111 | 111 | action_col.append(start_button); |
|
112 | 112 | this.element.append(profile_col). |
|
113 | 113 | append(action_col). |
|
114 | 114 | append(engines_col). |
|
115 | 115 | append(status_col); |
|
116 | 116 | start_button.click(function (e) { |
|
117 | 117 | var n = that.element.find('.engine_num_input').val(); |
|
118 | 118 | if (!/^\d+$/.test(n) && n.length>0) { |
|
119 | 119 | status_col.html('invalid engine #'); |
|
120 | 120 | } else { |
|
121 | 121 | var settings = { |
|
122 | 122 | cache : false, |
|
123 | 123 | data : {n:n}, |
|
124 | 124 | type : "POST", |
|
125 | 125 | dataType : "json", |
|
126 | 126 | success : function (data, status, xhr) { |
|
127 | 127 | that.update_state(data); |
|
128 | 128 | }, |
|
129 | 129 | error : function (data, status, xhr) { |
|
130 | 130 | status_col.html("error starting cluster") |
|
131 | 131 | } |
|
132 | 132 | }; |
|
133 | 133 | status_col.html('starting'); |
|
134 | 134 | var url = $('body').data('baseProjectUrl') + 'clusters/' + that.data.profile + '/start'; |
|
135 | 135 | $.ajax(url, settings); |
|
136 | 136 | }; |
|
137 | 137 | }); |
|
138 | 138 | }; |
|
139 | 139 | |
|
140 | 140 | |
|
141 | 141 | ClusterItem.prototype.state_running = function () { |
|
142 | 142 | this.element.empty(); |
|
143 | 143 | var that = this; |
|
144 | 144 | var profile_col = $('<span/>').addClass('profile_col').text(this.data.profile); |
|
145 | 145 | var status_col = $('<span/>').addClass('status_col').html('running'); |
|
146 | 146 | var engines_col = $('<span/>').addClass('engines_col').html(this.data.n); |
|
147 | 147 | var action_col = $('<span/>').addClass('action_col'); |
|
148 | 148 | var stop_button = $('<button>Stop</button>').button(); |
|
149 | 149 | action_col.append(stop_button); |
|
150 | 150 | this.element.append(profile_col). |
|
151 | 151 | append(action_col). |
|
152 | 152 | append(engines_col). |
|
153 | 153 | append(status_col); |
|
154 | 154 | stop_button.click(function (e) { |
|
155 | 155 | var settings = { |
|
156 | 156 | cache : false, |
|
157 | 157 | type : "POST", |
|
158 | 158 | dataType : "json", |
|
159 | 159 | success : function (data, status, xhr) { |
|
160 | 160 | that.update_state(data); |
|
161 | 161 | }, |
|
162 | 162 | error : function (data, status, xhr) { |
|
163 | 163 | console.log('error',data); |
|
164 | 164 | status_col.html("error stopping cluster") |
|
165 | 165 | } |
|
166 | 166 | }; |
|
167 | 167 | status_col.html('stopping') |
|
168 | 168 | var url = $('body').data('baseProjectUrl') + 'clusters/' + that.data.profile + '/stop'; |
|
169 | 169 | $.ajax(url, settings); |
|
170 | 170 | }); |
|
171 | 171 | }; |
|
172 | 172 | |
|
173 | 173 | |
|
174 | 174 | IPython.ClusterList = ClusterList; |
|
175 | 175 | IPython.ClusterItem = ClusterItem; |
|
176 | 176 | |
|
177 | 177 | return IPython; |
|
178 | 178 | |
|
179 | 179 | }(IPython)); |
|
180 | 180 |
@@ -1,88 +1,88 b'' | |||
|
1 | 1 | {% extends "page.html" %} |
|
2 | 2 | |
|
3 | 3 | {% block title %}IPython Dashboard{% endblock %} |
|
4 | 4 | |
|
5 | 5 | {% block stylesheet %} |
|
6 | <link rel="stylesheet" href="{{static_url("css/projectdashboard.css") }}" type="text/css" /> | |
|
7 | 6 | <link rel="stylesheet" href="{{static_url("css/alternateuploadform.css") }}" type="text/css" /> |
|
8 | 7 | <link rel="stylesheet" href="{{static_url("css/style.min.css") }}" type="text/css" /> |
|
8 | <link rel="stylesheet" href="{{static_url("css/projectdashboard.css") }}" type="text/css" /> | |
|
9 | 9 | {% endblock %} |
|
10 | 10 | |
|
11 | 11 | |
|
12 | 12 | {% block params %} |
|
13 | 13 | |
|
14 | 14 | data-project={{project}} |
|
15 | 15 | data-base-project-url={{base_project_url}} |
|
16 | 16 | data-base-kernel-url={{base_kernel_url}} |
|
17 | 17 | data-read-only={{read_only}} |
|
18 | 18 | |
|
19 | 19 | {% endblock %} |
|
20 | 20 | |
|
21 | 21 | |
|
22 | 22 | {% block site %} |
|
23 | 23 | |
|
24 | 24 | <div id="ipython-main-app"> |
|
25 | 25 | |
|
26 | 26 | <div id="tabs"> |
|
27 | 27 | <ul> |
|
28 | 28 | <li><a href="#tab1">Notebooks</a></li> |
|
29 | 29 | <li><a href="#tab2">Clusters</a></li> |
|
30 | 30 | </ul> |
|
31 | 31 | |
|
32 | 32 | <div id="tab1"> |
|
33 | 33 | {% if logged_in or not read_only %} |
|
34 | 34 | <div id="notebook_toolbar"> |
|
35 | 35 | <form id='alternate_upload' class='alternate_upload' > |
|
36 | 36 | <span id="drag_info" style="position:absolute" > |
|
37 | 37 | To import a notebook, drag the file onto the listing below or <strong>click here</strong>. |
|
38 | 38 | </span> |
|
39 | 39 | <input type="file" name="datafile" class="fileinput" multiple='multiple'> |
|
40 | 40 | </form> |
|
41 | 41 | <span id="notebook_buttons"> |
|
42 | 42 | <button id="refresh_notebook_list" title="Refresh notebook list">Refresh</button> |
|
43 | 43 | <button id="new_notebook" title="Create new notebook">New Notebook</button> |
|
44 | 44 | </span> |
|
45 | 45 | </div> |
|
46 | 46 | {% endif %} |
|
47 | 47 | |
|
48 | 48 | <div id="notebook_list"> |
|
49 | 49 | <div id="project_name"> |
|
50 | 50 | <ul class="breadcrumb"> |
|
51 | 51 | {% for component in project_component %} |
|
52 | 52 | <li>{{component}} <span>/</span></li> |
|
53 | 53 | {% endfor %} |
|
54 | 54 | </ul> |
|
55 | 55 | </div> |
|
56 | 56 | </div> |
|
57 | 57 | </div> |
|
58 | 58 | <div id="tab2"> |
|
59 | 59 | |
|
60 | 60 | <div id="cluster_toolbar"> |
|
61 | 61 | <span id="cluster_list_info">IPython parallel computing clusters</span> |
|
62 | 62 | |
|
63 | 63 | <span id="cluster_buttons"> |
|
64 | 64 | <button id="refresh_cluster_list" title="Refresh cluster list">Refresh</button> |
|
65 | 65 | </span> |
|
66 | 66 | </div> |
|
67 | 67 | |
|
68 | 68 | <div id="cluster_list"> |
|
69 | 69 | <div id="cluster_header"> |
|
70 | 70 | <span>profile</span> |
|
71 | 71 | <span>action</span> |
|
72 | 72 | <span title="Enter the number of engines to start or empty for default"># of engines</span> |
|
73 | 73 | <span>status</span> |
|
74 | 74 | </div> |
|
75 | 75 | </div> |
|
76 | 76 | |
|
77 | 77 | </div> |
|
78 | 78 | </div> |
|
79 | 79 | |
|
80 | 80 | </div> |
|
81 | 81 | |
|
82 | 82 | {% endblock %} |
|
83 | 83 | |
|
84 | 84 | {% block script %} |
|
85 | 85 | <script src="{{static_url("js/notebooklist.js") }}" type="text/javascript" charset="utf-8"></script> |
|
86 | 86 | <script src="{{static_url("js/clusterlist.js") }}" type="text/javascript" charset="utf-8"></script> |
|
87 | 87 | <script src="{{static_url("js/projectdashboardmain.js") }}" type="text/javascript" charset="utf-8"></script> |
|
88 | 88 | {% endblock %} |
General Comments 0
You need to be logged in to leave comments.
Login now