]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1541111 - Separate bugs on Triage Owners page by type
authorKohei Yoshino <kohei.yoshino@gmail.com>
Wed, 3 Apr 2019 18:28:58 +0000 (14:28 -0400)
committerGitHub <noreply@github.com>
Wed, 3 Apr 2019 18:28:58 +0000 (14:28 -0400)
extensions/BMO/lib/Reports/Triage.pm
extensions/BMO/template/en/default/pages/triage_owners.html.tmpl
extensions/BMO/web/styles/triage_reports.css

index 2d40aa25da9df9ded7311a0f6652ebf1505a336b..d19f459e8a3bc4e67050d945d313bf7253ceccb4 100644 (file)
@@ -302,7 +302,7 @@ sub owners {
   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
@@ -316,7 +316,8 @@ sub owners {
                            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) {
@@ -326,9 +327,10 @@ sub owners {
       ? 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'
@@ -338,7 +340,14 @@ sub owners {
         .= '&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;
index e6944f7bcd095fe7811651a43a3564a1325de185..f8a3504b52995d90b52f8436aacd3efc2b047368 100644 (file)
     <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 %]&amp;component=[% r.component FILTER uri %]
+              [%~ IF c.key != "total" %]&amp;bug_type=[% c.key FILTER html; END %]&amp;
+              [%~ 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 %]:
index 8eb2c6e8714ce802bfd52bbdeff67f3a213058e5..099dd9429ac95b94be5047e50c449d4a754979ba 100644 (file)
     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%;
 }