From fde6d4aa81a56418ae5cdfd16a6b917534d66bed Mon Sep 17 00:00:00 2001 From: Max Kanat-Alexander Date: Mon, 1 Feb 2010 15:52:24 -0800 Subject: Bug 514970: Clean up duplicates.cgi and make it use Bug objects r=LpSolit, a=LpSolit --- .../en/default/reports/duplicates-simple.html.tmpl | 8 +- .../en/default/reports/duplicates-table.html.tmpl | 161 ++++++++++----------- template/en/default/reports/duplicates.html.tmpl | 70 ++++----- 3 files changed, 114 insertions(+), 125 deletions(-) (limited to 'template/en/default/reports') diff --git a/template/en/default/reports/duplicates-simple.html.tmpl b/template/en/default/reports/duplicates-simple.html.tmpl index 61d0c6fd2..bef002193 100644 --- a/template/en/default/reports/duplicates-simple.html.tmpl +++ b/template/en/default/reports/duplicates-simple.html.tmpl @@ -15,7 +15,9 @@ # Copyright (C) 1998 Netscape Communications Corporation. All # Rights Reserved. # - # Contributor(s): Gervase Markham + # Contributor(s): + # Gervase Markham + # Max Kanat-Alexander #%] [%# INTERFACE: @@ -24,8 +26,9 @@ [% PROCESS global/variables.none.tmpl %] + - [% IF product %] [% title = "Most Frequently Reported $terms.Bugs for $product" %] [% ELSE %] @@ -39,5 +42,4 @@ [% PROCESS "reports/duplicates-table.html.tmpl" %] - diff --git a/template/en/default/reports/duplicates-table.html.tmpl b/template/en/default/reports/duplicates-table.html.tmpl index 8950f340a..38ab2d56b 100644 --- a/template/en/default/reports/duplicates-table.html.tmpl +++ b/template/en/default/reports/duplicates-table.html.tmpl @@ -15,21 +15,16 @@ # Copyright (C) 1998 Netscape Communications Corporation. All # Rights Reserved. # - # Contributor(s): Gervase Markham + # Contributor(s): + # Gervase Markham + # Max Kanat-Alexander #%] [%# INTERFACE: - # bugs: list of hashes. May be empty. Each hash has nine members: - # id: integer. The bug number + # bugs: list of hashes. May be empty. Each hash has three members: + # bug: A Bugzilla::Bug object # count: integer. The number of dupes # delta: integer. The change in count in the last $changedsince days - # component: string. The bug's component - # bug_severity: string. The bug's severity. - # op_sys: string. The bug's reported OS. - # target_milestone: string. The bug's TM. - # short_desc: string. The bug's summary. - # bug_status: string. The bug's status. - # resolution: string. The bug's resolution, if any. # # bug_ids: list of integers. May be empty. The IDs of the bugs in $bugs. # @@ -38,99 +33,89 @@ # maxrows: integer. Max number of rows to display. # changedsince: integer. The number of days ago for the changedsince column. # openonly: boolean. True if we are only showing open bugs. - # query_products: list of strings. Restrict to these products only. + # product: array of strings. Restrict to these products only. #%] -[% PROCESS global/variables.none.tmpl %] +[% PROCESS "global/field-descs.none.tmpl" %] [%# *** Column Headers *** %] -[% IF bug_ids.size > 0 %] - - - - [% FOREACH column = [ { name => "id", description => "$terms.Bug #" }, - { name => "count", description => "Dupe
Count" }, - { name => "delta", - description => "Change in last
$changedsince day(s)" }, - { name => "component", description => "Component" }, - { name => "bug_severity", description => "Severity" }, - { name => "op_sys", description => "Op Sys" }, - { name => "target_milestone", - description => "Target
Milestone" }, - { name => "short_desc", description => "Summary" } ] - %] +[% SET columns = [ + { name => "id", description => "$terms.Bug #" }, + { name => "count", description => "Dupe
Count" }, + { name => "delta", + description => "Change in last
$changedsince day(s)" }, + { name => "component", description => field_descs.component }, + { name => "bug_severity", description => field_descs.bug_severity }, + { name => "op_sys", description => field_descs.op_sys }, + { name => "target_milestone", description => field_descs.target_milestone }, + { name => "short_desc", description => field_descs.short_desc }, +] %] -
- [% bug_ids_string = bug_ids.join(',') %] - - [% column.description %] +[% SET base_args = [] %] +[% FOREACH param = ['maxrows', 'openonly', 'format', 'sortvisible', + 'changedsince', 'product'] +%] + [% NEXT IF NOT ${param}.defined %] + [% FOREACH value = ${param} %] + [% filtered_value = value FILTER url_quote %] + [% base_args.push("$param=$filtered_value") %] + [% END %] +[% END %] +[% IF sortvisible %] + [% bug_ids_string = bug_ids.nsort.join(',') FILTER url_quote %] + [% base_args.push("bug_id=$bug_ids_string") %] +[% END %] +[% base_args_string = base_args.join('&') %] + +[% IF bugs.size %] + + + + [% FOREACH column = columns %] + [% IF column.name == sortby %] + [%# We add this to the column object so it doesn't affect future + # iterations of the loop. + #%] + [% column.reverse_sort = reverse ? 0 : 1 %] + [% END %] + [% END %] - [% IF NOT sortby %] - [% sortby = "count"; reverse = "1" %] - [% END %] - - [% IF sortby == "id" OR sortby == "count" OR sortby == "delta" %] - [%# Numeric sort %] - [% sortedbugs = bugs.nsort(sortby) %] - [% ELSE %] - [% sortedbugs = bugs.sort(sortby) %] - [% END %] - - [% IF reverse %] - [% bugs = sortedbugs.reverse %] - [% ELSE %] - [% bugs = sortedbugs %] - [% END %] - [%# *** Buglist *** %] - - [%# We need to keep track of the bug IDs we are actually displaying, because - # if the user decides to sort the visible list, we need to know what that - # list actually is. %] - [% vis_bug_ids = [] %] - - [% FOREACH bug = bugs %] - [% LAST IF loop.index() >= maxrows %] - [% vis_bug_ids.push(bug.id) %] - - - + [% FOREACH item = bugs %] + [% SET bug = item.bug %] + + - - + + + - - - - - - - - + + + [% END %] diff --git a/template/en/default/reports/duplicates.html.tmpl b/template/en/default/reports/duplicates.html.tmpl index e4ea73882..6b49a23c6 100644 --- a/template/en/default/reports/duplicates.html.tmpl +++ b/template/en/default/reports/duplicates.html.tmpl @@ -19,14 +19,12 @@ #%] [%# INTERFACE: - # products: an array of product objects this user can see. - # # sortby: string. the column on which we are sorting the buglist. # reverse: boolean. True if we are reversing the current sort. # maxrows: integer. Max number of rows to display. # changedsince: integer. The number of days ago for the changedsince column. # openonly: boolean. True if we are only showing open bugs. - # query_products: list of strings. The set of products we check for dups. + # product: array of strings. The set of products we check for dups. # # Additionally, you need to fulfill the interface to # duplicates-table.html.tmpl. @@ -34,9 +32,10 @@ [% PROCESS global/variables.none.tmpl %] -[% IF query_products.size %] +[% IF product.size %] [% title = BLOCK %] - Most Frequently Reported [% terms.Bugs %] for [% query_products.join(', ') FILTER html %] + Most Frequently Reported [% terms.Bugs %] for + [%+ product.join(', ') FILTER html %] [% END %] [% ELSE %] [% title = "Most Frequently Reported $terms.Bugs" %] @@ -44,7 +43,7 @@ [% PROCESS global/header.html.tmpl title = title - style = ".resolved { background-color: #d9d9d9; color: #000000; }" + style_urls = ['skins/standard/duplicates.css'] %]

@@ -57,27 +56,26 @@ [%# *** Parameters *** %] -[% bug_ids_string = vis_bug_ids.join(',') %] +[% bug_ids_string = bug_ids.join(',') %]

Change Parameters

- - + +
+ [% column.description FILTER none %]
-
- [% bug.id FILTER bug_link(bug.id) FILTER none %] -
+
+ [% bug.id FILTER bug_link(bug) FILTER none %] -
- [% bug.count %] -
+
[% item.count FILTER html %][% item.delta FILTER html %][% bug.component FILTER html %] + [%- display_value('bug_severity', bug.bug_severity) FILTER html %]
[% bug.delta %]
[% bug.component FILTER html %]
[% display_value("bug_severity", bug.bug_severity ) FILTER html %]
[% display_value("op_sys", bug.op_sys ) FILTER html %]
[% display_value("target_milestone", bug.target_milestone) FILTER html %]
[% bug.short_desc FILTER html %] + [%- display_value('op_sys', bug.op_sys) FILTER html %] + + [% display_value('target_milestone', + bug.target_milestone) FILTER html %] + [% bug.short_desc FILTER html %]
- + - + - + @@ -116,7 +118,7 @@ @@ -126,10 +128,9 @@ - - + Or just give this to me as a . + value="[% terms.bug %] list">. (Note: the order may not be the same.) @@ -139,15 +140,15 @@ What are "Most Frequently Reported [% terms.Bugs %]"? -
- The Most Frequent [% terms.Bugs %] page lists the known open [% terms.bugs %] which - are reported most frequently. It is - automatically generated from the [% terms.Bugzilla %] database every 24 hours, by +

+ The Most Frequent [% terms.Bugs %] page lists the known open + [%+ terms.bugs %] which are reported most frequently, counting the number of direct and indirect duplicates of [% terms.bugs %]. This information is provided in order to assist in minimizing - the amount of duplicate [% terms.bugs %] entered into [% terms.Bugzilla %], which - saves time for Quality Assurance engineers who have to triage the [% terms.bugs %]. -

+ the amount of duplicate [% terms.bugs %] entered into [% terms.Bugzilla %], + which saves time for Quality Assurance engineers who have to triage + the [% terms.bugs %]. +

How do I use this list? @@ -166,11 +167,12 @@
  • Try and locate a similar [% terms.bug %] - that has already been filed.
  • + that has already been filed.
  • If you find your [% terms.bug %] in [% terms.Bugzilla %], - feel free to comment with any new or additional data you may have.
  • -
  • If you cannot find your problem already documented in [% terms.Bugzilla %], - file a new [% terms.bug %].
  • + feel free to comment with any new or additional data you may have. +
  • If you cannot find your problem already documented in + [%+ terms.Bugzilla %], + file a new [% terms.bug %].
-- cgit v1.2.1
When sorting or restricting, - work with:When sorting or restricting, work with: + [% ' checked="checked"' IF NOT sortvisible %]>
+ [% ' checked="checked"' IF sortvisible %]> @@ -85,9 +83,9 @@
Restrict to products: @@ -95,16 +93,20 @@
Max rows: - +
Change column is change in the last: - days + + + days
+ [% ' checked="checked"' IF openonly %]>