Help:Bugzilla Extension: Difference between revisions
m (→How to Use) |
m (→Complex queries: add a helpful hint) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
This is a very useful extension to Mediawiki that queries Bugzilla and can display information as a table or a bar/pie chart. | |||
https:// | |||
As a reference, here are the bz_api fields you may be able to use with the mediawiki-bugzilla extension: https://wiki.mozilla.org/Help:Bugzilla_Extension | |||
Please add code samples and any additional tips on usage here | Please add code samples and any additional tips on usage here! | ||
Note: be cautious using the "Preview" mode of the wiki page editor. In the preview context, ''all'' matches are returned in a simple table. The fancy chunked display is only available using the "Show Preview" button outside of the editor. | |||
==How to Use== | |||
You use this extension in this way: | You use this extension in this way: | ||
<pre> | <pre> | ||
Line 19: | Line 21: | ||
"priority":"P1" | "priority":"P1" | ||
} | } | ||
</bugzilla> | |||
</pre> | |||
Example that gathers all the bugs that block a particular bug: | |||
<pre> | |||
<bugzilla> | |||
{ | |||
"f1":"blocked", | |||
"o1":"equals", | |||
"v1":"738796", | |||
"include_fields":"id,summary,status,resolution" | |||
} | |||
</bugzilla> | </bugzilla> | ||
</pre> | </pre> | ||
Line 26: | Line 40: | ||
There is also exploratory support for charting. Here are some examples: | There is also exploratory support for charting. Here are some examples: | ||
<pre> | <pre> | ||
Line 70: | Line 83: | ||
==Complex queries== | ==Complex queries== | ||
If you have a bugzilla query with f1, o1, and v1 parameters you can make a mediawiki-bugzilla chart with those parameters. So if you have field 1, with operator 1 and value 1, they go together; so you can put f2, o2, v2 and so on into your wiki chart. You can further connect two such queries by starting out your query with f1=OP and j1=OR to have a higher level operator such as AND and OR. Example: | If you have a bugzilla query with f1, o1, and v1 parameters you can make a mediawiki-bugzilla chart with those parameters. So if you have field 1, with operator 1 and value 1, they go together; so you can put f2, o2, v2 and so on into your wiki chart. You can further connect two such queries by starting out your query with f1=OP and j1=OR to have a higher level operator such as AND and OR. | ||
To figure out a complex query, try building the query in bugzilla first, then copy the url and paste it somewhere that you can split it up, parse it, and pull out the elements you need like nosubstr or anywordssubstr. The url should have all the clues you need to construct your mediawiki query. | |||
Example: | |||
<pre> | |||
<bugzilla> | |||
{ | |||
"include_fields":"id,summary,status,qa_contact,whiteboard,cf_qa_whiteboard", | |||
"f1":"OP", | |||
"j1":"OR", | |||
"f2":"cf_fx_iteration", | |||
"o2":"equals", | |||
"v2":"34.1", | |||
"f3":"status_whiteboard", | |||
"o3":"anywordssubstr", | |||
"v3":"s=34.1" | |||
} | |||
</bugzilla></pre> | |||
<bugzilla> | <bugzilla> | ||
Line 85: | Line 117: | ||
} | } | ||
</bugzilla> | </bugzilla> | ||
==Code repo== | |||
The mediawiki-bugzilla extension code is here: | |||
https://github.com/mozilla/mediawiki-bugzilla | |||
==Troubleshooting== | ==Troubleshooting== |
Latest revision as of 23:09, 11 July 2019
This is a very useful extension to Mediawiki that queries Bugzilla and can display information as a table or a bar/pie chart.
As a reference, here are the bz_api fields you may be able to use with the mediawiki-bugzilla extension: https://wiki.mozilla.org/Help:Bugzilla_Extension
Please add code samples and any additional tips on usage here!
Note: be cautious using the "Preview" mode of the wiki page editor. In the preview context, all matches are returned in a simple table. The fancy chunked display is only available using the "Show Preview" button outside of the editor.
How to Use
You use this extension in this way:
<bugzilla> (JSON REST API query key/value pairs) </bugzilla>
An example:
<bugzilla> { "product": "Bugzilla", "priority":"P1" } </bugzilla>
Example that gathers all the bugs that block a particular bug:
<bugzilla> { "f1":"blocked", "o1":"equals", "v1":"738796", "include_fields":"id,summary,status,resolution" } </bugzilla>
For more details on how to query in various ways, see the documentation for the Bugzilla BzAPI REST API.
Note that the tag name defaults to "bugzilla" but is configurable.
There is also exploratory support for charting. Here are some examples:
<bugzilla type="count" display="bar"> { "product": "Bugzilla", "priority": "P1", "x_axis_field": "severity" } </bugzilla>
This example uses date ranges and returns bugs from multiple products:
<bugzilla type="count" display="bar"> { "product": ["Core","Calendar","Toolkit","Firefox"], "changed_after": "2000-01-01", "changed_before": "2013-02-01", "whiteboard": "[good first bug]", "status":["NEW","REOPENED"], "x_axis_field": "product" } </bugzilla>
This example uses date ranges to retrieve the bugs from multiple products with a specific resolution and where the status is the field changed during the date range selected:
<bugzilla type="count" display="bar"> { "product": ["Core","Calendar","Toolkit","Firefox", "Thunderbird"], "whiteboard": "[good first bug]", "changed_after": "2013-07-01", "changed_before": "2013-08-01", "changed_field": "status", "changed_field_to": ["RESOLVED"], "resolution": ["FIXED", "INVALID", "WONTFIX", "DUPLICATE", "WORKSFORME", "INCOMPLETE"], "x_axis_field": "product" } </bugzilla>
Complex queries
If you have a bugzilla query with f1, o1, and v1 parameters you can make a mediawiki-bugzilla chart with those parameters. So if you have field 1, with operator 1 and value 1, they go together; so you can put f2, o2, v2 and so on into your wiki chart. You can further connect two such queries by starting out your query with f1=OP and j1=OR to have a higher level operator such as AND and OR.
To figure out a complex query, try building the query in bugzilla first, then copy the url and paste it somewhere that you can split it up, parse it, and pull out the elements you need like nosubstr or anywordssubstr. The url should have all the clues you need to construct your mediawiki query.
Example:
<bugzilla> { "include_fields":"id,summary,status,qa_contact,whiteboard,cf_qa_whiteboard", "f1":"OP", "j1":"OR", "f2":"cf_fx_iteration", "o2":"equals", "v2":"34.1", "f3":"status_whiteboard", "o3":"anywordssubstr", "v3":"s=34.1" } </bugzilla>
97 Total; 0 Open (0%); 52 Resolved (53.61%); 45 Verified (46.39%);
Code repo
The mediawiki-bugzilla extension code is here: https://github.com/mozilla/mediawiki-bugzilla
Troubleshooting
- If you get a query error, try checking the last parameter in your list; make sure that line doesn't end with a comma.
- If you want a quick reference on field names, try the Bugzilla quicksearch help screen: https://bugzilla.mozilla.org/page.cgi?id=quicksearch.html