Skip to content

Commit 11f486f

Browse files
committed
various fixes
1 parent 79f0224 commit 11f486f

File tree

5 files changed

+119
-136
lines changed

5 files changed

+119
-136
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ nosetests.xml
3737
# Backups
3838
*.bak
3939
*.md~
40+
*~

controllers/plugin_cs_monitor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def workers():
4949
for row in w:
5050
if row.last_heartbeat < limit:
5151
row.status_ = nice_worker_status('Probably Dead')
52-
row.status_ = nice_worker_status(row.status_)
52+
row.status_ = nice_worker_status(row.status)
5353

5454
BASEURL = URL("plugin_cs_monitor", "wactions", user_signature=True)
5555

modules/plugin_cs_monitor/admin_scheduler_helpers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
def nice_worker_status(status):
2424
if status in WORKER_STATUS:
25-
return WORKER_STATUS[status][1]
25+
return WORKER_STATUS[status]
2626
else:
2727
return SPAN(status, _class="label")
2828

views/plugin_cs_monitor/analyze_task.html

+106-124
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,21 @@ <h3>Analyze task</h3>
66
<div class="span4">
77
<span>First Run: {{=prettydate(first_run.start_time)}}</span>
88
<span>Last Run: {{=prettydate(last_run.start_time)}}</span>
9-
<ul>
10-
<li>{{=A('Just this task : %s' % (task.uuid), _href=URL(args=request.args(0), user_signature=True))}}</li>
11-
<li>{{=A('All tasks by function name : %s' % (task.function_name), _href=URL(args=(request.args(0), 'byfunction'), user_signature=True))}}</li>
12-
<li>{{=A('All tasks by task name name : %s' % (task.task_name), _href=URL(args=(request.args(0), 'bytaskname'), user_signature=True))}}</li>
13-
{{args = request.args}}
14-
{{if len(args) == 1:}}
15-
<li>{{=A('Just today', _href=URL(args=(request.args(0), 'this', 'bydate', 0), user_signature=True))}}</li>
16-
{{elif len(args) == 2:}}
17-
<li>{{=A('Just today', _href=URL(args=(request.args(0), request.args(1), 'bydate', 0), user_signature=True))}}</li>
18-
{{elif len(args) == 4:}}
19-
<li>{{=A('Previous Day', _href=URL(args=(request.args(0), request.args(1), 'byday', int(request.args(3)) + 1), user_signature=True))}}</li>
20-
<li>{{=A('Next Day', _href=URL(args=(request.args(0), request.args(1), 'byday', int(request.args(3)) - 1), user_signature=True))}}</li>
21-
{{pass}}
22-
</ul>
23-
24-
25-
9+
<div class="btn-group btn-group-vertical">
10+
11+
{{=A('Just this task : %s' % (task.uuid), _class="btn", _href=URL(args=request.args(0), user_signature=True))}}
12+
{{=A('All tasks by function name : %s' % (task.function_name), _class="btn", _href=URL(args=(request.args(0), 'byfunction'), user_signature=True))}}
13+
{{=A('All tasks by task name name : %s' % (task.task_name), _class="btn", _href=URL(args=(request.args(0), 'bytaskname'), user_signature=True))}}
14+
{{args = request.args}}
15+
{{if len(args) == 1:}}
16+
{{=A('Just today', _class="btn", _href=URL(args=(request.args(0), 'this', 'bydate', 0), user_signature=True))}}
17+
{{elif len(args) == 2:}}
18+
{{=A('Just today', _class="btn", _href=URL(args=(request.args(0), request.args(1), 'bydate', 0), user_signature=True))}}
19+
{{elif len(args) == 4:}}
20+
{{=A('Previous Day', _class="btn", _href=URL(args=(request.args(0), request.args(1), 'byday', int(request.args(3)) + 1), user_signature=True))}}
21+
{{=A('Next Day', _class="btn", _href=URL(args=(request.args(0), request.args(1), 'byday', int(request.args(3)) - 1), user_signature=True))}}
22+
{{pass}}
23+
</div>
2624
</div>
2725
<div class="span4 offset4">
2826
<h4>Status</h4>
@@ -50,175 +48,159 @@ <h4>Dates</h4>
5048
$(function () {
5149

5250
var jgb_status_series = {{=XML(jgb_status_series)}};
53-
var data = [];
54-
var series = [];
55-
var colors = [];
51+
var data = []; series = []; colors = [];
5652
$.each(jgb_status_series, function(i, e) {
57-
data.push(e['data']);
58-
series.push({'label' : e['label']});
53+
data.push(e['data']); series.push({'label' : e['label']});
5954
colors.push(e['color']);
60-
});
61-
if (data.length == 0) data = [null];
62-
63-
$.jqplot('bystatus', [data],
64-
{
65-
seriesDefaults: {
66-
seriesColors : colors,
67-
renderer: jQuery.jqplot.PieRenderer,
68-
rendererOptions: {
69-
// Turn off filling of slices.
70-
fill: false,
71-
showDataLabels: true,
72-
// By default, data labels show the percentage of the donut/pie.
73-
// You can show the data 'value' or data 'label' instead.
74-
dataLabels: 'value',
75-
dataLabelThreshold : 10,
76-
// Add a margin to seperate the slices.
77-
sliceMargin: 2,
78-
// stroke the slices with a little thicker line.
79-
lineWidth: 2
80-
}
81-
},
82-
legend: { show:true, location: 'e' },
83-
series : series
55+
}); if (data.length == 0) data = [null];
56+
57+
$.jqplot('bystatus', [data], {
58+
seriesDefaults: {
59+
seriesColors: colors,
60+
renderer: jQuery.jqplot.PieRenderer,
61+
rendererOptions: {
62+
fill: false,
63+
showDataLabels: true,
64+
dataLabels: 'value',
65+
dataLabelThreshold: 10,
66+
sliceMargin: 2,
67+
lineWidth: 2
8468
}
85-
);
69+
},
70+
legend: {
71+
show: true,
72+
location: 'e'
73+
},
74+
series: series
75+
});
8676

8777
var jgb_duration_series = {{=XML(jgb_duration_series)}};
88-
var data = [];
89-
var series = [];
78+
var data = [], series = [];
9079
$.each(jgb_duration_series, function(i, e) {
91-
data.push(e['data']);
92-
series.push({'label' : e['label'], 'color' : e['color']});
80+
data.push(e['data']); series.push({'label' : e['label'], 'color' :
81+
e['color']});
9382
});
9483
if (data.length == 0) data = [[null]];
9584
$.jqplot('byduration', data, {
96-
// The "seriesDefaults" option is an options object that will
97-
// be applied to all series in the chart.
9885
cursor:{
9986
show: true,
10087
zoom: true
101-
},
102-
seriesDefaults:{
88+
},
89+
seriesDefaults: {
10390
renderer:$.jqplot.BarRenderer,
104-
pointLabels: { show: true, location: 'n', edgeTolerance: -15 },
105-
rendererOptions: {fillToZero: true, barWidth : 5}
91+
pointLabels: {
92+
show: true,
93+
location: 'n',
94+
edgeTolerance: -15
95+
},
96+
rendererOptions: {
97+
fillToZero: true,
98+
barWidth : 5
99+
}
106100
},
107-
// Custom labels for the series are specified with the "label"
108-
// option on the series option. Here a series option object
109-
// is specified for each series.
110101
series:series,
111-
// Show the legend and put it outside the grid, but inside the
112-
// plot container, shrinking the grid to accomodate the legend.
113-
// A value of "outside" would not shrink the grid and allow
114-
// the legend to overflow the container.
115-
legend:{
116-
renderer: $.jqplot.EnhancedLegendRenderer,
117-
show:true
102+
legend: {
103+
renderer: $.jqplot.EnhancedLegendRenderer, show:true
118104
},
119105
highlighter: {
120106
show: true,
121107
},
122108
axes: {
123-
// Use a category axis on the x axis and use our custom ticks.
124109
xaxis: {
125110
renderer: $.jqplot.CategoryAxisRenderer,
126-
rendererOptions:{sortMergedLabels:true},
127-
label:'Seconds Elapsed'
111+
rendererOptions:{sortMergedLabels:true}, label:'Seconds Elapsed'
128112
},
129113
yaxis : {
130114
label : '# of tasks'
131115
}
132116
}
133-
134117
});
135118

136119
var jgb_when_series = {{=XML(jgb_when_series)}};
137-
var data = [];
138-
var series = [];
120+
var data = [], series = [];
139121
$.each(jgb_when_series, function(i, e) {
140-
data.push(e['data']);
141-
series.push({'label' : e['label'], 'color' : e['color']});
122+
data.push(e['data']);
123+
series.push({'label' : e['label'], 'color' : e['color']});
142124
});
143125
if (data.length == 0) data = [[null]];
144126
$.jqplot('bydate', data, {
145-
legend:{
146-
renderer: $.jqplot.EnhancedLegendRenderer,
147-
show:true
127+
legend: {
128+
renderer: $.jqplot.EnhancedLegendRenderer,
129+
show: true
148130
},
149-
cursor:{
131+
cursor: {
150132
show: true,
151133
zoom: true
134+
},
135+
seriesDefaults: {
136+
pointLabels: {
137+
show: true,
138+
location: 'n',
139+
edgeTolerance: -15
152140
},
153-
seriesDefaults : {
154-
pointLabels: { show: true, location: 'n', edgeTolerance: -15 },
155-
},
156-
axes:{
157-
xaxis:{
158-
renderer:$.jqplot.DateAxisRenderer,
159-
tickOptions:{formatString:'%Y-%m-%d'},
160-
max : new Date(new Date().getTime() + 24 * 60 * 60 * 1000),
161-
label : 'When'
141+
},
142+
axes: {
143+
xaxis: {
144+
renderer: $.jqplot.DateAxisRenderer,
145+
tickOptions: {
146+
formatString: '%Y-%m-%d'
147+
},
148+
max: new Date(new Date().getTime() + 24 * 60 * 60 * 1000),
149+
label: 'When'
162150
},
163-
yaxis : {
164-
label : '# of tasks'
151+
yaxis: {
152+
label: '# of tasks'
165153
}
166154
},
167-
168155
highlighter: {
169-
show: true,
156+
show: true,
170157
},
171158
series: series
172-
}
173-
);
159+
});
174160
{{if len(request.args) == 4:}}
175161

176162
var jgb_whend_series = {{=XML(jgb_whend_series)}};
177-
var data = [];
178-
var series = [];
163+
var data = [], series = [];
179164
$.each(jgb_whend_series, function(i, e) {
180-
data.push(e['data']);
181-
series.push({'label' : e['label'], 'color' : e['color']});
165+
data.push(e['data']);
166+
series.push({'label' : e['label'], 'color' : e['color']});
182167
});
183168
if (data.length == 0) data = [[null]];
184169
$.jqplot('bydated', data, {
185-
legend:{
186-
renderer: $.jqplot.EnhancedLegendRenderer,
187-
show:true
170+
legend: {
171+
renderer: $.jqplot.EnhancedLegendRenderer,
172+
show: true
188173
},
189-
cursor:{
174+
cursor: {
190175
show: true,
191176
zoom: true
177+
},
178+
seriesDefaults: {
179+
pointLabels: {
180+
show: true,
181+
location: 'n',
182+
edgeTolerance: -15
192183
},
193-
seriesDefaults : {
194-
pointLabels: { show: true, location: 'n', edgeTolerance: -15 },
195-
},
196-
axes:{
197-
xaxis:{
198-
renderer:$.jqplot.DateAxisRenderer,
199-
tickOptions:{formatString:'%H:%M'},
200-
tickInterval:'3600000',
184+
},
185+
axes: {
186+
xaxis: {
187+
renderer: $.jqplot.DateAxisRenderer,
188+
tickOptions: {
189+
formatString: '%H:%M'
190+
},
191+
tickInterval: '3600000',
201192
tickRenderer: $.jqplot.CanvasAxisTickRenderer,
202-
//tickOptions: {
203-
// angle: -30
204-
//},
205-
//max : new Date(new Date().getTime() + 24 * 60 * 60 * 1000),
206-
label : 'When',
207-
//min : "2013-02-22 00:00",
208-
//max : "2013-02-23 00:00"
209-
//max : max
193+
label: 'When',
210194
},
211-
yaxis : {
212-
label : '# of tasks'
195+
yaxis: {
196+
label: '# of tasks'
213197
}
214198
},
215-
216199
highlighter: {
217-
show: true,
200+
show: true,
218201
},
219202
series: series
220-
}
221-
);
203+
});
222204

223205
{{pass}}
224206

views/plugin_cs_monitor/run_details.html

+10-10
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@
5555
{{pass}}
5656

5757
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
58-
<div class="modal-header">
59-
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
60-
<h3 id="myModalLabel">Modal header</h3>
61-
</div>
62-
<div class="modal-body">
63-
<p>One fine body…</p>
64-
</div>
65-
<div class="modal-footer">
66-
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
67-
</div>
58+
<div class="modal-header">
59+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
60+
<h3 id="myModalLabel">Traceback</h3>
61+
</div>
62+
<div class="modal-body">
63+
<p></p>
64+
</div>
65+
<div class="modal-footer">
66+
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
67+
</div>
6868
</div>
6969

7070
<script>

0 commit comments

Comments
 (0)