[bugzilla-gnome-org-extensions] Display traces grouped by product when viewing a trace.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bugzilla-gnome-org-extensions] Display traces grouped by product when viewing a trace.
- Date: Thu, 20 Nov 2014 22:13:36 +0000 (UTC)
commit bb72a3b032210c89c002b6c26513a200d94fbe94
Author: Max Kanat-Alexander <mkanat everythingsolved com>
Date: Thu Aug 6 04:12:55 2009 -0500
Display traces grouped by product when viewing a trace.
lib/TraceParser/Hooks.pm | 18 ++++++++++-
lib/TraceParser/Trace.pm | 2 +-
template/en/default/pages/trace.html.tmpl | 45 +++++++++++++++--------------
3 files changed, 40 insertions(+), 25 deletions(-)
---
diff --git a/lib/TraceParser/Hooks.pm b/lib/TraceParser/Hooks.pm
index 392b067..7356aad 100644
--- a/lib/TraceParser/Hooks.pm
+++ b/lib/TraceParser/Hooks.pm
@@ -24,6 +24,7 @@ use strict;
use base qw(Exporter);
use Bugzilla::Error;
use Bugzilla::Install::Util qw(indicate_progress);
+use Bugzilla::Util qw(detaint_natural);
use TraceParser::Trace;
our @EXPORT = qw(
@@ -138,8 +139,20 @@ sub _page_trace {
@$similar_traces = grep { !$identical{$_->id} } @$similar_traces;
# Remove this trace from the identical traces.
@$identical_traces = grep { $_->id != $trace->id } @$identical_traces;
- $vars->{similar_traces} = $similar_traces;
- $vars->{identical_traces} = $identical_traces;
+
+ my (%similar, %identical);
+ foreach my $trace (@$similar_traces) {
+ my $product = $trace->bug->product;
+ $similar{$product} ||= [];
+ push(@{ $similar{$product} }, $trace);
+ }
+ foreach my $trace (@$identical_traces) {
+ my $product = $trace->bug->product;
+ $identical{$product} ||= [];
+ push(@{ $identical{$product} }, $trace);
+ }
+ $vars->{similar_traces} = \%similar;
+ $vars->{identical_traces} = \%identical;
}
$vars->{trace} = $trace;
@@ -148,6 +161,7 @@ sub _page_trace {
sub _page_popular_traces {
my $vars = shift;
my $limit = Bugzilla->cgi->param('limit') || DEFAULT_POPULAR_LIMIT;
+ detaint_natural($limit);
my $dbh = Bugzilla->dbh;
my %trace_count = @{ $dbh->selectcol_arrayref(
'SELECT MAX(id), COUNT(*) AS trace_count
diff --git a/lib/TraceParser/Trace.pm b/lib/TraceParser/Trace.pm
index 51d0c1b..9efbfc7 100644
--- a/lib/TraceParser/Trace.pm
+++ b/lib/TraceParser/Trace.pm
@@ -104,7 +104,7 @@ sub _do_list_select {
my %product_ids = map { $_->{product_id} => 1 } @$bugs;
my %products = @{ $dbh->selectcol_arrayref(
'SELECT id, name FROM products WHERE id IN('
- . join(',', values %product_ids) . ')', {Columns=>[1,2]}) };
+ . join(',', keys %product_ids) . ')', {Columns=>[1,2]}) };
foreach my $bug (@$bugs) {
$bug->{product} = $products{$bug->{product_id}};
}
diff --git a/template/en/default/pages/trace.html.tmpl b/template/en/default/pages/trace.html.tmpl
index 5ec60e3..8b87813 100644
--- a/template/en/default/pages/trace.html.tmpl
+++ b/template/en/default/pages/trace.html.tmpl
@@ -24,15 +24,17 @@
%]
[% IF identical_traces.size %]
- <p>Identical Traces:</p>
+ <h2>Traces with an identical stack:</h2>
[% PROCESS trace_list list = identical_traces %]
[% END %]
[% IF similar_traces.size %]
- <p>Similar Traces:</p>
+ <h2>Traces with a <em>similar</em> stack:</h2>
[% PROCESS trace_list list = similar_traces %]
[% END %]
+<h2>Trace [% trace.id FILTER html %]</h2>
+
<table border="0" cellpadding="0" cellspacing="0"><tr><td><div class="trace">
<pre>[% trace.text FILTER html %]
</pre></div></td></tr></table>
@@ -40,24 +42,23 @@
[% PROCESS global/footer.html.tmpl %]
[% BLOCK trace_list %]
- <ul class="trace_list">
- [% FOREACH this_trace = list %]
- [% SET bug = this_trace.bug %]
- <li>
- <a href="page.cgi?id=trace.html&trace_id=
- [%- this_trace.id FILTER url_quote %]">Trace
- [% this_trace.id FILTER html %]</a> on
- [%+ "Bug $bug.id" FILTER bug_link(bug) %]:
- [% bug.bug_status FILTER html %] [%+ bug.resolution FILTER html %]
- [% IF bug.dup_id %]
- of [% "bug $bug.dup_id" FILTER bug_link(bug.dup_id) %]
- [% END %]
- (Quality: [% this_trace.quality FILTER html %])
- [% IF user.can_see_bug(bug) %]
- [%+ bug.product FILTER html %]
- [% END %]
-
- </li>
- [% END %]
- </ul>
+ [% FOREACH product = list.keys.sort %]
+ <p>In <strong>[% product FILTER html %]</strong>:</p>
+ <ul class="trace_list">
+ [% FOREACH this_trace = list.$product %]
+ [% SET bug = this_trace.bug %]
+ <li>
+ <a href="page.cgi?id=trace.html&trace_id=
+ [%- this_trace.id FILTER url_quote %]">Trace
+ [% this_trace.id FILTER html %]</a> on
+ [%+ "Bug $bug.id" FILTER bug_link(bug) %]:
+ [% bug.bug_status FILTER html %] [%+ bug.resolution FILTER html %]
+ [% IF bug.dup_id %]
+ of [% "bug $bug.dup_id" FILTER bug_link(bug.dup_id) %]
+ [% END %]
+ (Quality: <strong>[% this_trace.quality FILTER html %]</strong>)
+ </li>
+ [% END %]
+ </ul>
+ [% END %]
[% END %]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]