incubator-bloodhound-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g..@apache.org
Subject svn commit: r1354926 - in /incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard: layouts/templates/widget_macros.html templates/bh_model_view.html util.py widgets/templates/widget_progress.html widgets/ticket.py
Date Thu, 28 Jun 2012 11:15:17 GMT
Author: gjm
Date: Thu Jun 28 11:15:16 2012
New Revision: 1354926

URL: http://svn.apache.org/viewvc?rev=1354926&view=rev
Log:
dashboard: enhances formerly buggy TicketGroupStats, adding rendering of stats from ticket
queries - towards #93 (from olemis)

Modified:
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/widget_macros.html
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/templates/bh_model_view.html
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/util.py
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_progress.html
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/ticket.py

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/widget_macros.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/widget_macros.html?rev=1354926&r1=1354925&r2=1354926&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/widget_macros.html
(original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/layouts/templates/widget_macros.html
Thu Jun 28 11:15:16 2012
@@ -8,26 +8,28 @@
   <!--! Helper functions (py:def) -->
 
   <div py:def="widget_container(w)" role="application">
-    <h3 style="display: inline;">${w.title}</h3>
-    <py:if test="w.ctxtnav">
-      <py:for each="itm in w.ctxtnav">
-        &nbsp;&nbsp;$itm
-      </py:for>
+    <py:if test="w.title">
+      <h3 style="display: inline;">${w.title}</h3>
+      <py:if test="w.ctxtnav">
+        <py:for each="itm in w.ctxtnav">
+          &nbsp;&nbsp;$itm
+        </py:for>
+      </py:if>
+      &nbsp;&nbsp;
+      <div class="btn-group" py:if="w.altlinks" style="display: inline-block;">
+        <a class="btn btn-mini dropdown-toggle" href="#" data-toggle="dropdown">
+          <i class="icon-download-alt"></i>Download<b class="caret"></b>
+        </a>
+        <ul class="dropdown-menu">
+          <li py:for="idx, link in enumerate(w.altlinks)"
+              class="${first_last(idx, w.altlinks)}">
+            <a rel="nofollow" href="${link.href}" class="link.class"
+                py:content="link.title"></a>
+          </li>
+        </ul>
+      </div>
+      <br/>
     </py:if>
-    &nbsp;&nbsp;
-    <div class="btn-group" py:if="w.altlinks" style="display: inline-block;">
-      <a class="btn btn-mini dropdown-toggle" href="#" data-toggle="dropdown">
-        <i class="icon-download-alt"></i>Download<b class="caret"></b>
-      </a>
-      <ul class="dropdown-menu">
-        <li py:for="idx, link in enumerate(w.altlinks)"
-            class="${first_last(idx, w.altlinks)}">
-          <a rel="nofollow" href="${link.href}" class="link.class"
-              py:content="link.title"></a>
-        </li>
-      </ul>
-    </div>
-    <br/>
     ${w.content}
   </div>
 

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/templates/bh_model_view.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/templates/bh_model_view.html?rev=1354926&r1=1354925&r2=1354926&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/templates/bh_model_view.html
(original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/templates/bh_model_view.html
Thu Jun 28 11:15:16 2012
@@ -23,8 +23,13 @@
                     interval_hrefs = progress_data.interval_hrefs;
                     " />
           </py:when>
-          <py:when test="progress_query">
-            <!--! TODO: Insert ticket stats widget -->
+          <py:when test="ticket_query">
+            <bh:widget urn="TicketGroupStats">
+              <bh:args>
+                <bh:arg name="query">$ticket_query</bh:arg>
+                <bh:arg name="view">compact</bh:arg>
+              </bh:args>
+            </bh:widget>
           </py:when>
         </py:choose>
         <div class="stickyEndMark"></div>

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/util.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/util.py?rev=1354926&r1=1354925&r2=1354926&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/util.py (original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/util.py Thu Jun 28 11:15:16
2012
@@ -30,7 +30,7 @@ from pkg_resources import get_distributi
 from urlparse import urlparse
 from wsgiref.util import setup_testing_defaults
 
-from trac.core import Component, implements
+from trac.core import Component, implements, ExtensionPoint
 from trac.web.api import Request
 from trac.web.chrome import add_link, Chrome
 from trac.web.main import RequestDispatcher
@@ -54,7 +54,7 @@ def dummy_request(env, uname=None):
     req.redirect = lambda *args, **kwds: None
     # Setup user information
     if uname is not None :
-      environ['REMOTE_USER'] = req.authname = uname
+        environ['REMOTE_USER'] = req.authname = uname
     
     rd = RequestDispatcher(env)
     chrome = Chrome(env)

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_progress.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_progress.html?rev=1354926&r1=1354925&r2=1354926&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_progress.html
(original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_progress.html
Thu Jun 28 11:15:16 2012
@@ -28,14 +28,18 @@
   </py:def>
 
   <py:def function="progress_classes(stats)">
-    <py:choose>      
-      <py:when test="stats.done_percent &gt;= 100">progress-success</py:when>
-      <py:when test="stats.done_percent &gt;= 66">progress-info</py:when>
-      <py:when test="stats.done_percent &gt;= 33">progress-warning</py:when>
-      <py:when test="stats.done_percent &lt; 33">progress-danger</py:when>
+    <py:choose>
+      <py:when test="bar_styles">${' '.join('progress-'+c for c in bar_styles if c)}</py:when>
+      <py:otherwise>
+        <py:choose>
+          <py:when test="stats.done_percent &gt;= 100">progress-success</py:when>
+          <py:when test="stats.done_percent &gt;= 66">progress-info</py:when>
+          <py:when test="stats.done_percent &gt;= 33">progress-warning</py:when>
+          <py:when test="stats.done_percent &lt; 33">progress-danger</py:when>
+        </py:choose>
+      </py:otherwise>
     </py:choose>
   </py:def>
-      
 
   <py:choose test="view">
     <py:when test="'standard'">

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/ticket.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/ticket.py?rev=1354926&r1=1354925&r2=1354926&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/ticket.py (original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/ticket.py Thu Jun
28 11:15:16 2012
@@ -267,6 +267,10 @@ class TicketGroupStatsWidget(WidgetBase)
                 'desc' : {
                         'desc' : """Descriptive (wiki) text""",
                     },
+                'view' : {
+                        'desc' : """Display mode to render progress info""",
+                        'type' : EnumField('compact', 'standard')
+                    },
             }
     get_widget_params = pretty_wrapper(get_widget_params, check_widget_name)
 
@@ -274,26 +278,27 @@ class TicketGroupStatsWidget(WidgetBase)
         """Prepare ticket stats
         """
         req = context.req
-        params = ('query', 'stats_provider', 'skin', 'title', 'legend', 'desc')
-        qstr, pnm, skin, title, legend, desc = \
+        params = ('query', 'stats_provider', 'skin', 'title', 'legend', 'desc',
+                'view')
+        qstr, pnm, skin, title, legend, desc, view = \
                 self.bind_params(name, options, *params)
         statsp = resolve_ep_class(ITicketGroupStatsProvider, self, pnm,
                                     default=RoadmapModule(self.env).stats_provider)
-        skin = (skin or '').split('-', 2)
-        progress_css = 'progress ' + ' '.join('progress-'+c for c in skin if c)
+        if skin is not None :
+            skin = (skin or '').split('-', 2)
 
         tickets = exec_query(self.env, req, qstr)
         tickets = apply_ticket_permissions(self.env, req, tickets)
-        stat = get_ticket_stats(self.stats_provider, tickets)
+        stat = get_ticket_stats(statsp, tickets)
 
-        add_stylesheet('dashboard/css/bootstrap.css')
+        add_stylesheet(req, 'dashboard/css/bootstrap.css')
+        add_stylesheet(req, 'dashboard/css/roadmap.css')
         return 'widget_progress.html', \
                 {
                     'title' : title,
                     'data' : dict(
-                            desc=desc,
-                            legend=legend,
-                            stats=stat,
+                            desc=desc, legend=legend, bar_styles=skin,
+                            stats=stat, view=view,
                         ), 
                 }, \
                 context



Mime
View raw message