my $rows = $dbh->selectall_arrayref($sql);
my $bug_count_sth = $dbh->prepare("
- SELECT COUNT(bugs.bug_id)
+ SELECT bugs.bug_type, COUNT(bugs.bug_id)
FROM bugs INNER JOIN components AS map_component ON bugs.component_id = map_component.id
INNER JOIN bug_status AS map_bug_status ON bugs.bug_status = map_bug_status.value
INNER JOIN priority AS map_priority ON bugs.priority = map_priority.value
LEFT JOIN flags AS flags_1 ON bugs_1.bug_id = flags_1.bug_id AND (flags_1.attach_id = attachments_1.attach_id OR flags_1.attach_id IS NULL)
LEFT JOIN flagtypes AS flagtypes_1 ON flags_1.type_id = flagtypes_1.id
WHERE bugs_1.bug_id = bugs.bug_id AND CONCAT(flagtypes_1.name, flags_1.status) = 'needinfo?')))
- AND bugs.component_id = ?");
+ AND bugs.component_id = ?
+ GROUP BY bugs.bug_type");
my @results;
foreach my $row (@$rows) {
? Bugzilla::User->new({id => $triage_owner_id, cache => 1})
: "";
my $data = {
- product => $product_name,
- component => $component_name,
- owner => $triage_owner,
+ product => $product_name,
+ component => $component_name,
+ owner => $triage_owner,
+ bug_counts => {defect => 0, enhancement => 0, task => 0},
};
$data->{buglist_url}
= 'priority=--&resolution=---&f1=creation_ts&o1=greaterthaneq&v1=2016-06-01'
.= '&f3=triage_owner&o3=equals&v3=' . url_quote($triage_owner->login);
}
$bug_count_sth->execute($component_id);
- ($data->{bug_count}) = $bug_count_sth->fetchrow_array();
+
+ my $total = 0;
+ while (my ($type, $count) = $bug_count_sth->fetchrow_array()) {
+ $data->{bug_counts}->{$type} = $count;
+ $total += $count;
+ }
+ $data->{bug_counts}->{total} = $total;
+
push @results, $data;
}
$vars->{results} = \@results;
<small>Each triage owner links to a buglist of all open [% terms.bugs %], since 2016-06-01, without a pending needinfo, where the priority is '--'.</small>
</p>
[% current_product = "" %]
- <table border="0" cellspacing="0" id="report" width="100%">
- </tr>
+ <table id="report">
[% FOREACH r = results %]
[% count = loop.count() %]
[% IF current_product != r.product %]
[% current_product = r.product %]
- <tr class="product_header">
- <th colspan="3">[% r.product FILTER html %]</th>
- </tr>
+ <thead>
+ <tr>
+ <th>[% r.product FILTER html %]</th>
+ <th>Owner</th>
+ [% FOREACH c IN r.bug_counts %]
+ <th class="count">
+ [% IF c.key == "total"%]
+ Total
+ [% ELSE %]
+ <span class="bug-type-label iconic" title="[% c.key FILTER html %]"
+ aria-label="[% c.key FILTER html %]" data-type="[% c.key FILTER html %]">
+ <span class="icon" aria-hidden="true"></span>
+ </span>
+ [% END %]
+ </th>
+ [% END %]
+ </tr>
+ </thead>
+ <tbody>
[% END %]
<tr class="bz_bugitem [% count % 2 == 1 ? "bz_row_odd" : "bz_row_even" %]">
<td>
<em>None</em>
[% END %]
</td>
- <td>
- [% IF r.buglist_url %]
- <a href="[% basepath FILTER none %]buglist.cgi?product=[% r.product FILTER uri %]&component=[% r.component FILTER uri %]&[% r.buglist_url FILTER none %]">
- [% r.bug_count FILTER html +%] [%+ terms.bugs %] found.
- </a>
- [% ELSE %]
- None
- [% END %]
- </td>
+ [% FOREACH c IN r.bug_counts %]
+ <td class="count">
+ [% IF c.value %]
+ <a href="[% basepath FILTER none %]buglist.cgi?product=
+ [%~ r.product FILTER uri %]&component=[% r.component FILTER uri %]
+ [%~ IF c.key != "total" %]&bug_type=[% c.key FILTER html; END %]&
+ [%~ r.buglist_url FILTER html %]">
+ [% END %]
+ [%~ c.value FILTER html ~%]
+ [% IF c.value %]
+ </a>
+ [% END %]
+ </td>
+ [% END %]
</tr>
[% END %]
+ </tbody>
</table>
<p>
Found [% results.size %] component[% 's' IF results.size != 1 %]:
width: 20em;
}
-#report tr.bugitem:hover {
- background: #ccccff;
+#triage_owners_form th {
+ text-align: right;
+ vertical-align: top;
}
-#report th, #report td {
- padding: 1px 10px 1px 10px;
+#report {
+ position: relative;
+ width: 100%;
+ border-collapse: collapse;
}
-#report-header {
+#report thead {
+ position: sticky;
+ top: 0;
+ left: 0;
background: #dddddd;
}
-tr.product_header {
- background: #dddddd;
+#report tr.bugitem:hover {
+ background: #ccccff;
}
-#triage_owners_form th {
- text-align: right;
- vertical-align: top;
+#report th,
+#report td {
+ padding: 4px 8px;
+ text-align: left;
}
-#report th, #report td {
- text-align: left;
+#report th.count,
+#report td.count {
+ width: 1em;
+ text-align: center;
+ white-space: nowrap;
+}
+
+#report td.count {
+ color: #CCC;
+}
+
+#report td.count a {
+ display: block;
+ width: 100%;
}