incubator-bloodhound-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Apache Bloodhound" <bloodhound-...@incubator.apache.org>
Subject Re: [Apache Bloodhound] #93: Converting dashboard views to new template
Date Mon, 18 Jun 2012 13:19:38 GMT
#93: Converting dashboard views to new template
--------------------------+----------------------
  Reporter:  gjm          |      Owner:  olemis
      Type:  enhancement  |     Status:  accepted
  Priority:  major        |  Milestone:
 Component:  dashboard    |    Version:
Resolution:               |   Keywords:
--------------------------+----------------------

Comment (by gjm):

 As a quick hack, I have just been trying the following to modify the links
 provided by the {{{TicketFieldValuesWidget}}} for lists of milestones so
 that they go direct to the relevant page instead of the query.

 {{{
 #!diff
 Index: bhdashboard/widgets/ticket.py
 ===================================================================
 --- bhdashboard/widgets/ticket.py       (revision 1351306)
 +++ bhdashboard/widgets/ticket.py       (working copy)
 @@ -198,12 +198,18 @@
              item_link= lambda item: query_href + \
                      '&' + urlencode([(fieldnm, item[0])])

 +        def dash_item_link(item):
 +            if fieldnm in ['milestone',] and item[0]:
 +                return req.href(fieldnm, item[0])
 +            else:
 +                return item_link(item)
 +
          return 'widget_cloud.html', \
                  {
                      'title' : title,
                      'data' : dict(
                              bounds=minmax(items, lambda x: x[1]),
 -                            item_link= item_link,
 +                            item_link= dash_item_link,
                              heading=_(fieldnm.capitalize()),
                              items=items,
                              verbose=verbose,
 }}}

 For completeness, the following adds a component list to the dashboard
 page to demonstrate it working:

 {{{
 #!diff
 Index: bhdashboard/web_ui.py
 ===================================================================
 --- bhdashboard/web_ui.py       (revision 1351315)
 +++ bhdashboard/web_ui.py       (working copy)
 @@ -139,7 +139,7 @@
                          'div' : [
                                  {
                                      '_class' : 'span8',
 -                                    'widgets' : [3, 2, 0]
 +                                    'widgets' : [3, 2, 0, 4]
                                  },
                                  {
                                      '_class' : 'span4',
 @@ -157,6 +157,14 @@
                                      'field' : 'component',
                                      'verbose' : True}}]
                          },
 +                    4: {
 +                            'args' : [
 +                                'TicketFieldValues',
 +                                None,
 +                                {'args' : {
 +                                    'field' : 'milestone',
 +                                    'verbose' : True}}]
 +                        },
                      2: {
                              'args' : [
                                  'TicketQuery',
 }}}

 It could probably do with referring to a mapping dictionary to get the
 appropriate base link of course. I am sure there are other things that
 could improve it but I was just scratching an itch.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/93#comment:21>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Mime
View raw message