--- a/views/plots.py Thu Mar 08 10:03:44 2012 +0100
+++ b/views/plots.py Thu Mar 08 10:03:44 2012 +0100
@@ -56,3 +56,9 @@
options['seriesColors'] = [ERROR_CODES.get(x[2], other) for x in self.cw_rset.rows]
#FIXME hack to approximate width since it doesn't work in js
options['series'][0]['rendererOptions']['barWidth'] = 350/len(self.cw_rset.rows)
+
+ def div_holder(self, divid, width, height):
+ super(JQPlotTestExecutionView, self).div_holder(divid, width, height)
+ self.w(u'''<table class="plotlegend"><tr>%s</tr></table>
+ ''' % ''.join(['<td>%s</td><td style="background:%s"> </td>' % (x,y) for x,y in ERROR_CODES.items()]))
+
--- a/views/tracker.py Thu Mar 08 10:03:44 2012 +0100
+++ b/views/tracker.py Thu Mar 08 10:03:44 2012 +0100
@@ -16,8 +16,6 @@
from cubicweb.web.views.formrenderers import EntityFormRenderer
from cubicweb.web import formwidgets as fwdgs, httpcache
-from cubes.apycot.views.plots import ERROR_CODES
-
_pvs = uicfg.primaryview_section
_pvs.tag_subject_of(('Project', 'has_apycot_environment', '*'), 'attributes')
@@ -33,26 +31,41 @@
'P has_apycot_environment TENV, P eid %(p)s HAVING COUNT(TE) > %(limit)s',
{'p':entity.eid,
'limit':MIN_NB_RUNS_IN_GRAPH})
- graph_defs = []
- for testconfig in testconfig_rset:
- for branch in branches_rset:
+ labels_and_values = []
+ for branch in branches_rset:
+ var_dict = {'p': entity.eid,
+ 'branch':branch[0]}
+ for testconfig in testconfig_rset:
label = '%s : %s - %s' % (_(u'Test run time'), testconfig[1], branch[0])
rql = 'Any TE, ET - ST, S ORDERBY ST LIMIT 50 WHERE ' \
'TE is TestExecution, TE using_environment TENV, ' \
'P has_apycot_environment TENV, TE starttime ST, ' \
'TE endtime ET, TE eid E, TE status S, P eid %(p)s, ' \
- 'TE using_config TC, TC eid %(tc)s, TE branch %(branch)s'
- var_dict = {'p': entity.eid,
- 'tc': testconfig[0],
- 'branch':branch[0]}
- rset = form._cw.execute(rql, var_dict)
+ 'TE using_config TC, TC eid %(tc)s, TE branch "%(branch)s"'
+ var_dict['tc'] = testconfig[0]
+ rset = form._cw.execute(rql % var_dict)
if rset and len(rset) > MIN_NB_RUNS_IN_GRAPH:
- graph_defs.append({'label':label,
- 'rql':rql,
- 'variables': var_dict,
- 'vid':'jqplot.testexecution',
- 'rset':rset})
- return [x['label'] for x in graph_defs]
+ js_call = form._cw.ajax_replace_url('graph-container',
+ rql= rql % var_dict,
+ vid='jqplot.testexecution')
+ labels_and_values.append((label, js_call.replace('javascript: ', '')))
+
+ for cri_label, label in (('pylint.evaluation', 'Pylint score'),
+ ('cover-line-rate', 'Cover line rate')):
+ label = '%s : %s' % (_(label), branch[0])
+ rql = 'Any V ORDERBY D LIMIT 50 WHERE X is CheckResultInfo, X label "%(cri_label)s", ' \
+ 'X value V, X for_check CR, CR during_execution TE, TE using_environment TENV, '\
+ 'P has_apycot_environment TENV, P eid %(p)s, TE starttime D, TE branch "%(branch)s" '
+ var_dict['cri_label'] = cri_label
+ print rql % var_dict
+ rset = form._cw.execute(rql % var_dict)
+ if rset and len(rset) > MIN_NB_RUNS_IN_GRAPH:
+ js_call = form._cw.ajax_replace_url('graph-container',
+ rql= rql % var_dict,
+ vid='jqplot.nonperiodic')
+ labels_and_values.append((label, js_call.replace('javascript: ', '')))
+ labels_and_values.reverse()
+ return labels_and_values
class GraphRefreshForm(forms.FieldsForm):
"""Form to select what graph is being displayed"""
@@ -78,8 +91,6 @@
form = self._cw.vreg['forms'].select('select-graph', self._cw, rset=self.cw_rset)
form.render(w=self.w)
self._cw.add_onload('eval($("select#graphs").val())')
- self.w(u'''<table class="plotlegend"><tr>%s</tr></table>
- ''' % ''.join(['<td>%s</td><td style="background:%s"> </td>' % (x,y) for x,y in ERROR_CODES.items()]))
self.w(u'<div id="graph-container"></div>')
rset = self._cw.execute(
'Any T,TC,T,TB,TST,TET,TF, TS ORDERBY TST DESC WHERE '