You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by ma...@apache.org on 2013/04/30 12:58:59 UTC
svn commit: r1477551 - in /bloodhound/trunk: bloodhound_dashboard/
bloodhound_dashboard/bhdashboard/widgets/
bloodhound_dashboard/bhdashboard/widgets/templates/
bloodhound_theme/bhtheme/htdocs/ bloodhound_theme/bhtheme/templates/
Author: matevz
Date: Tue Apr 30 10:58:59 2013
New Revision: 1477551
URL: http://svn.apache.org/r1477551
Log:
Ticket relations widget - initial implementation
Added:
bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/relations.py
bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_relations.html
Modified:
bloodhound/trunk/bloodhound_dashboard/setup.py
bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css
bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html
Added: bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/relations.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/relations.py?rev=1477551&view=auto
==============================================================================
--- bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/relations.py (added)
+++ bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/relations.py Tue Apr 30 10:58:59 2013
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+r"""Project dashboard for Apache(TM) Bloodhound
+
+Widgets displaying ticket relations.
+"""
+
+from trac.resource import get_resource_url
+from trac.util.translation import _
+from trac.ticket.model import Ticket
+
+from bhdashboard.util import WidgetBase, check_widget_name, pretty_wrapper
+
+from bhrelations.api import RelationsSystem
+
+
+__metaclass__ = type
+
+class TicketRelationsWidget(WidgetBase):
+ """Display ticket relations.
+ """
+ def get_widget_params(self, name):
+ """Return a dictionary containing arguments specification for
+ the widget with specified name.
+ """
+ return {
+ 'tid' : {
+ 'desc' : """Source ticket id""",
+ 'type' : int
+ },
+
+ 'max' : {
+ 'desc' : """Limit the number of relations displayed""",
+ 'type' : int
+ },
+ }
+
+ get_widget_params = pretty_wrapper(get_widget_params, check_widget_name)
+
+ def render_widget(self, name, context, options):
+ """Gather list of relations and render data in compact view
+ """
+ data = {}
+ req = context.req
+ title = None
+ params = ('tid', 'max')
+ tid, max_ = self.bind_params(name, options, *params)
+
+ ticket = Ticket(self.env, tid)
+ relations = RelationsSystem(self.env).get_relations(ticket)
+ grouped_relations = {}
+ if relations:
+ title = _('Related tickets')
+ for r in relations:
+ r['desthref'] = get_resource_url(self.env, r['destination'],
+ context.href)
+ grouped_relations.setdefault(r['type'], []).append(r)
+
+ data['relations'] = grouped_relations
+
+ return 'widget_relations.html', \
+ { 'title': title, 'data': data, }, context
+
+ render_widget = pretty_wrapper(render_widget, check_widget_name)
+
Added: bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_relations.html
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_relations.html?rev=1477551&view=auto
==============================================================================
--- bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_relations.html (added)
+++ bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_relations.html Tue Apr 30 10:58:59 2013
@@ -0,0 +1,32 @@
+<!--!
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<div
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:py="http://genshi.edgewall.org/"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <py:for each="relgroup,items in relations.iteritems()">
+ <h4>$relgroup</h4>
+ <div py:for="item in items">
+ <a href="${item['desthref']}">#${item['destination'].id}</a> - $item.comment
+ </div>
+ </py:for>
+</div>
+
Modified: bloodhound/trunk/bloodhound_dashboard/setup.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_dashboard/setup.py?rev=1477551&r1=1477550&r2=1477551&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_dashboard/setup.py (original)
+++ bloodhound/trunk/bloodhound_dashboard/setup.py Tue Apr 30 10:58:59 2013
@@ -125,6 +125,7 @@ ENTRY_POINTS = r"""
bhdashboard.widgets.product = bhdashboard.widgets.product
bhdashboard.widgets.query = bhdashboard.widgets.query
bhdashboard.widgets.report = bhdashboard.widgets.report
+ bhdashboard.widgets.ticketrelations = bhdashboard.widgets.relations
bhdashboard.widgets.ticket = bhdashboard.widgets.ticket
bhdashboard.widgets.timeline = bhdashboard.widgets.timeline
bhdashboard.wiki = bhdashboard.wiki
Modified: bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css?rev=1477551&r1=1477550&r2=1477551&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css (original)
+++ bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css Tue Apr 30 10:58:59 2013
@@ -288,6 +288,11 @@ pre {
width: 100%;
}
+.relations {
+ margin-top: 30px;
+ margin-bottom: 30px;
+}
+
/* @end */
/* @group Quick Create Ticket popup */
Modified: bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html?rev=1477551&r1=1477550&r2=1477551&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html (original)
+++ bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html Tue Apr 30 10:58:59 2013
@@ -408,6 +408,14 @@
</div>
<div id="dummy-vc-summary" style="display: none"/>
+ <div py:if="ticket.exists" class="relations">
+ <bh:widget urn="TicketRelations">
+ <bh:args>
+ <bh:arg name="tid">$ticket.id</bh:arg>
+ <bh:arg name="max">20</bh:arg>
+ </bh:args>
+ </bh:widget>
+ </div>
</div>
</div>
</form>
Re: svn commit: r1477551 - in /bloodhound/trunk: bloodhound_dashboard/
bloodhound_dashboard/bhdashboard/widgets/ bloodhound_dashboard/bhdashboard/widgets/templates/
bloodhound_theme/bhtheme/htdocs/ bloodhound_theme/bhtheme/templates/
Posted by Olemis Lang <ol...@gmail.com>.
On 5/2/13, Matevž Bradač <ma...@digiverse.si> wrote:
> On 1. May, 2013, at 3:00, Olemis Lang wrote:
>> On 4/30/13, matevz@apache.org <ma...@apache.org> wrote:
>>> Author: matevz
>>> Date: Tue Apr 30 10:58:59 2013
>>> New Revision: 1477551
>>>
>>> URL: http://svn.apache.org/r1477551
>>> Log:
>>> Ticket relations widget - initial implementation
>>>
>>
>> I'm really excited to see this
>> :)
>
> Glad to hear it. =)
> It's currently in very basic form, but should improve soon.
>
:)
Good work . I look forward to see more
>>
>> Is there a chance to move these ticket relations widgets on to BH
>> Relations plugin ?
[...]
>
> I'm all for decoupling, but I ran into some issues when the widget
> was placed into bhrelations plugin. I'll recheck what it was and
> try to resolve it.
ok ...
> Same goes for the ProductWidget which should
> be moved to multiproduct plugin.
>
+
> BTW, is the dashboard prerequisite for all other BH plugins?
Once upon a (long) time we had two options wrt common assets :
1. a whole new (plugin | lib) for common assets
2. include common assets and reusable code in BH Dashboard plugin
... and we chose (2) . Since that moment , yes , BH Dashboard is a
required dependency .
> Can it be turned off, but still have e.g. multiproduct support
> enabled?
I'm tempted to say «no» . In a few words : Twitter Bootstrap files
(i.e. an instance of common assets ;) are contributed by BH Dashboard
plugin . However afaicr , at least the first versions of default
multi-product templates did not depend upon bootstrap styling . BH
Theme plugin was in charge of installing Bootstrap-specific MP look
and feel .
> AFAICS, the widgets won't render without dashboard,
> but I'm not 100% sure.
>
Widgets are a derivative of dashboard concept . Indeed the later may
be defined as the combination of layout(s) + widget(s) . So there are
no dashboards without widgets (and layouts) , from an architectural
perspective .
--
Regards,
Olemis.
Re: svn commit: r1477551 - in /bloodhound/trunk: bloodhound_dashboard/ bloodhound_dashboard/bhdashboard/widgets/ bloodhound_dashboard/bhdashboard/widgets/templates/ bloodhound_theme/bhtheme/htdocs/ bloodhound_theme/bhtheme/templates/
Posted by Matevž Bradač <ma...@digiverse.si>.
On 1. May, 2013, at 3:00, Olemis Lang wrote:
> On 4/30/13, matevz@apache.org <ma...@apache.org> wrote:
>> Author: matevz
>> Date: Tue Apr 30 10:58:59 2013
>> New Revision: 1477551
>>
>> URL: http://svn.apache.org/r1477551
>> Log:
>> Ticket relations widget - initial implementation
>>
>
> I'm really excited to see this
> :)
Glad to hear it. =)
It's currently in very basic form, but should improve soon.
>
> Is there a chance to move these ticket relations widgets on to BH
> Relations plugin ? This approach might lead a circular package
> dependency scenario
>
> BH Relations
> +- BH Theme
> +- BH Dashboard
> +- BH Relations ...
>
> whereas IMHO this should look like
>
> BH Relations
> +- BH Theme
> +- BH Dashboard
> +- BH Dashboard
>
> Besides , keeping such widgets in BH Dashboard plugin when BH
> Relations is not available IMHO is against package cohesion .
>
> http://en.wikipedia.org/wiki/Cohesion_(computer_science)
> http://en.wikipedia.org/wiki/Coupling_(computer_programming)
> http://teleki.net/download/talks/2012.02.07.coupling.cohesion.pdf
I'm all for decoupling, but I ran into some issues when the widget
was placed into bhrelations plugin. I'll recheck what it was and
try to resolve it. Same goes for the ProductWidget which should
be moved to multiproduct plugin.
BTW, is the dashboard prerequisite for all other BH plugins?
Can it be turned off, but still have e.g. multiproduct support
enabled? AFAICS, the widgets won't render without dashboard,
but I'm not 100% sure.
>
> --
> Regards,
>
> Olemis.
Thanks,
--
matevz
Re: svn commit: r1477551 - in /bloodhound/trunk: bloodhound_dashboard/
bloodhound_dashboard/bhdashboard/widgets/ bloodhound_dashboard/bhdashboard/widgets/templates/
bloodhound_theme/bhtheme/htdocs/ bloodhound_theme/bhtheme/templates/
Posted by Olemis Lang <ol...@gmail.com>.
On 4/30/13, Olemis Lang <ol...@gmail.com> wrote:
> On 4/30/13, matevz@apache.org <ma...@apache.org> wrote:
>> Author: matevz
>> Date: Tue Apr 30 10:58:59 2013
>> New Revision: 1477551
>>
>> URL: http://svn.apache.org/r1477551
>> Log:
>> Ticket relations widget - initial implementation
>>
>
> I'm really excited to see this
> :)
>
> Is there a chance to move these ticket relations widgets on to BH
> Relations plugin ? This approach might lead a circular package
> dependency scenario
>
> BH Relations
> +- BH Theme
> +- BH Dashboard
> +- BH Relations ...
>
> whereas IMHO this should look like
>
> BH Relations
> +- BH Theme
> +- BH Dashboard
> +- BH Dashboard
>
> Besides , keeping such widgets in BH Dashboard plugin when BH
> Relations is not available IMHO is against package cohesion .
>
> http://en.wikipedia.org/wiki/Cohesion_(computer_science)
> http://en.wikipedia.org/wiki/Coupling_(computer_programming)
> http://teleki.net/download/talks/2012.02.07.coupling.cohesion.pdf
Modularity means processes with minimum coupling and maximum cohesion.
( http://en.wikipedia.org/wiki/ISO/IEC_12207 )
http://en.wikipedia.org/wiki/Package_Principles
... and afaict also an extension of Single responsibility principle to
package dependencies will apply .
http://en.wikipedia.org/wiki/Single_responsibility_principle
--
Regards,
Olemis.
Re: svn commit: r1477551 - in /bloodhound/trunk: bloodhound_dashboard/
bloodhound_dashboard/bhdashboard/widgets/ bloodhound_dashboard/bhdashboard/widgets/templates/
bloodhound_theme/bhtheme/htdocs/ bloodhound_theme/bhtheme/templates/
Posted by Olemis Lang <ol...@gmail.com>.
On 4/30/13, matevz@apache.org <ma...@apache.org> wrote:
> Author: matevz
> Date: Tue Apr 30 10:58:59 2013
> New Revision: 1477551
>
> URL: http://svn.apache.org/r1477551
> Log:
> Ticket relations widget - initial implementation
>
I'm really excited to see this
:)
Is there a chance to move these ticket relations widgets on to BH
Relations plugin ? This approach might lead a circular package
dependency scenario
BH Relations
+- BH Theme
+- BH Dashboard
+- BH Relations ...
whereas IMHO this should look like
BH Relations
+- BH Theme
+- BH Dashboard
+- BH Dashboard
Besides , keeping such widgets in BH Dashboard plugin when BH
Relations is not available IMHO is against package cohesion .
http://en.wikipedia.org/wiki/Cohesion_(computer_science)
http://en.wikipedia.org/wiki/Coupling_(computer_programming)
http://teleki.net/download/talks/2012.02.07.coupling.cohesion.pdf
--
Regards,
Olemis.