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