[ui] refactor project graphs view so it can be used in various places (#2176598)
authorArthur Lutz <arthur.lutz@logilab.fr>
Thu, 08 Mar 2012 10:03:44 +0100
changeset 816 608d6e52a4d7
parent 815 fe853df7286a
child 817 9354b68df5ad
[ui] refactor project graphs view so it can be used in various places (#2176598)
views/primary.py
views/tracker.py
--- a/views/primary.py	Thu Mar 08 10:03:44 2012 +0100
+++ b/views/primary.py	Thu Mar 08 10:03:44 2012 +0100
@@ -135,6 +135,9 @@
     html_headers = no_robot_index
 
     def entity_call(self, entity):
+        project_rset = self._cw.execute('Any P WHERE P has_apycot_environment TC, TC eid %(e)s',
+                                        {'e': entity.eid})
+        self.wview('projectgraphtestresults', project_rset, 'null')
         rset = self._cw.execute(
             'Any T,TC,T,TB,TST,TET,TF, TS ORDERBY TST DESC WHERE '
             'T status TS, T using_config TC, T branch TB, '
--- a/views/tracker.py	Thu Mar 08 10:03:44 2012 +0100
+++ b/views/tracker.py	Thu Mar 08 10:03:44 2012 +0100
@@ -81,9 +81,9 @@
     __regid__ = 'nomaininfo'
     main_form_title = ''
 
-class ProjectTestResultsTab(EntityView):
-    """display project's test execution results"""
-    __regid__ = title = _('apycottestresults_tab')
+class ProjectGraphTestResults(EntityView):
+    """display project's graph from various execution results"""
+    __regid__ = 'projectgraphtestresults'
     __select__ = is_instance('Project')
 
     def entity_call(self, entity):
@@ -92,6 +92,15 @@
         form.render(w=self.w)
         self._cw.add_onload('eval($("select#graphs").val())')
         self.w(u'<div id="graph-container"></div>')
+
+
+class ProjectTestResultsTab(EntityView):
+    """display project's test execution results"""
+    __regid__ = title = _('apycottestresults_tab')
+    __select__ = is_instance('Project')
+
+    def entity_call(self, entity):
+        self.wview('projectgraphtestresults', self.cw_rset, 'null')
         rset = self._cw.execute(
             'Any T,TC,T,TB,TST,TET,TF, TS ORDERBY TST DESC WHERE '
             'T status TS, T using_config TC, T branch TB, '