| 1 | = !TicketQuery Wiki Macro |
| 2 | |
| 3 | The !TicketQuery macro lets you display information on tickets within wiki pages. |
| 4 | The query language used by the `[[TicketQuery]]` macro is described in [TracQuery#QueryLanguage TracQuery] page. |
| 5 | |
| 6 | == Usage |
| 7 | |
| 8 | [[MacroList(TicketQuery)]] |
| 9 | |
| 10 | == Example |
| 11 | |
| 12 | ||= **Example** =||= **Result** =||= **Macro** =|| |
| 13 | |----------------------------------------------------------- |
| 14 | ||=Number of [query:status=new&milestone= Triage tickets]: =||\ |
| 15 | || **[[TicketQuery(status=new&milestone=,count)]]**||\ |
| 16 | || `[[TicketQuery(status=new&milestone=,count)]]` || |
| 17 | |----------------------------------------------------------- |
| 18 | ||=Number of new tickets: =||\ |
| 19 | || **[[TicketQuery(status=new,count)]]**||\ |
| 20 | || `[[TicketQuery(status=new,count)]]` || |
| 21 | |----------------------------------------------------------- |
| 22 | ||=Number of reopened tickets: =||\ |
| 23 | || **[[TicketQuery(status=reopened,count)]]**||\ |
| 24 | || `[[TicketQuery(status=reopened,count)]]` || |
| 25 | |----------------------------------------------------------- |
| 26 | ||=Number of assigned tickets: =||\ |
| 27 | || **[[TicketQuery(status=assigned,count)]]**||\ |
| 28 | || `[[TicketQuery(status=assigned,count)]]` || |
| 29 | |----------------------------------------------------------- |
| 30 | ||=Number of invalid tickets: =||\ |
| 31 | || **[[TicketQuery(status=closed,resolution=invalid,count)]]**||\ |
| 32 | || `[[TicketQuery(status=closed,resolution=invalid,count)]]` || |
| 33 | |----------------------------------------------------------- |
| 34 | ||=Number of worksforme tickets: =||\ |
| 35 | || **[[TicketQuery(status=closed,resolution=worksforme,count)]]**||\ |
| 36 | || `[[TicketQuery(status=closed,resolution=worksforme,count)]]` || |
| 37 | |----------------------------------------------------------- |
| 38 | ||=Number of duplicate tickets: =||\ |
| 39 | || **[[TicketQuery(status=closed,resolution=duplicate,count)]]**||\ |
| 40 | || `[[TicketQuery(status=closed,resolution=duplicate,count)]]` || |
| 41 | |----------------------------------------------------------- |
| 42 | ||=Number of wontfix tickets: =||\ |
| 43 | || **[[TicketQuery(status=closed,resolution=wontfix,count)]]**||\ |
| 44 | || `[[TicketQuery(status=closed,resolution=wontfix,count)]]` || |
| 45 | |----------------------------------------------------------- |
| 46 | ||=Number of fixed tickets: =||\ |
| 47 | || **[[TicketQuery(status=closed,resolution=fixed,count)]]**||\ |
| 48 | || `[[TicketQuery(status=closed,resolution=fixed,count)]]` || |
| 49 | |----------------------------------------------------------- |
| 50 | ||=Total number of tickets: =||\ |
| 51 | || **[[TicketQuery(count)]]**||\ |
| 52 | || `[[TicketQuery(count)]]` || |
| 53 | |----------------------------------------------------------- |
| 54 | ||=Number of tickets reported **or** owned by current user: =||\ |
| 55 | || **[[TicketQuery(reporter=$USER,or,owner=$USER,count)]]**||\ |
| 56 | || `[[TicketQuery(reporter=$USER,or,owner=$USER,count)]]` || |
| 57 | |----------------------------------------------------------- |
| 58 | ||=Number of tickets created this month: =||\ |
| 59 | || **[[TicketQuery(created=thismonth..,count)]]**||\ |
| 60 | || `[[TicketQuery(created=thismonth..,count)]]` || |
| 61 | |----------------------------------------------------------- |
| 62 | ||=Number of closed Firefox tickets: =||\ |
| 63 | || **[[TicketQuery(status=closed,keywords~=firefox,count)]]**||\ |
| 64 | || `[[TicketQuery(status=closed,keywords~=firefox,count)]]` || |
| 65 | |----------------------------------------------------------- |
| 66 | ||=Number of closed Opera tickets: =||\ |
| 67 | || **[[TicketQuery(status=closed,keywords~=opera,count)]]**||\ |
| 68 | || `[[TicketQuery(status=closed,keywords~=opera,count)]]` || |
| 69 | |----------------------------------------------------------- |
| 70 | ||=Number of closed tickets affecting Firefox and Opera: =||\ |
| 71 | || **[[TicketQuery(status=closed,keywords~=firefox opera,count)]]**||\ |
| 72 | || `[[TicketQuery(status=closed,keywords~=firefox opera,count)]]` || |
| 73 | |----------------------------------------------------------- |
| 74 | ||=Number of closed tickets affecting Firefox or Opera: =||\ |
| 75 | || **[[TicketQuery(status=closed,keywords~=firefox|opera,count)]]**||\ |
| 76 | || `[[TicketQuery(status=closed,keywords~=firefox|opera,count)]]` || |
| 77 | |----------------------------------------------------------- |
| 78 | ||=Number of tickets that affect Firefox or are closed and affect Opera: =||\ |
| 79 | || **[[TicketQuery(keywords~=firefox,or,status=closed,keywords~=opera,count)]]**||\ |
| 80 | || `[[TicketQuery(status=closed,keywords~=opera,or,keywords~=firefox,count)]]` || |
| 81 | |----------------------------------------------------------- |
| 82 | ||=Number of closed Firefox tickets that don't affect Opera: =||\ |
| 83 | || **[[TicketQuery(status=closed,keywords~=firefox - opera,count)]]**||\ |
| 84 | || `[[TicketQuery(status=closed,keywords~=firefox -opera,count)]]` || |
| 85 | |----------------------------------------------------------- |
| 86 | ||=Last 3 modified tickets: =||\ |
| 87 | ||**[[TicketQuery(max=3,order=modified,desc=1,compact)]]**||\ |
| 88 | || `[[TicketQuery(max=3,order=modified,desc=1,compact)]]` || |
| 89 | |----------------------------------------------------------- |
| 90 | {{{#!th rowspan=2, style="text-align: left;" |
| 91 | Details of ticket #1: |
| 92 | }}} |
| 93 | {{{#!td style="border-bottom: 0;" |
| 94 | }}} |
| 95 | {{{#!td |
| 96 | `[[TicketQuery(id=1,col=id|owner|reporter,rows=summary,table)]]` |
| 97 | }}} |
| 98 | |- |
| 99 | {{{#!td colspan=2, style="border-top: 0;" |
| 100 | [[TicketQuery(id=1,col=id|owner|reporter,rows=summary,table)]] |
| 101 | }}} |
| 102 | |----------------------------------------------------------- |
| 103 | |
| 104 | == Using the `[[TicketQuery]]` Macro |
| 105 | |
| 106 | The [trac:TicketQuery TicketQuery] macro lets you display lists of tickets matching certain criteria anywhere you can use WikiFormatting. |
| 107 | |
| 108 | Example: |
| 109 | {{{ |
| 110 | [[TicketQuery(version=0.6|0.7&resolution=duplicate)]] |
| 111 | }}} |
| 112 | |
| 113 | This is displayed as: |
| 114 | [[TicketQuery(version=0.6|0.7&resolution=duplicate)]] |
| 115 | |
| 116 | Just like the [wiki:TracQuery#UsingTracLinks query: wiki links], the parameter of this macro expects a query string formatted according to the rules of the simple [wiki:TracQuery#QueryLanguage ticket query language]. This also displays the link and description of a single ticket: |
| 117 | {{{ |
| 118 | [[TicketQuery(id=123)]] |
| 119 | }}} |
| 120 | |
| 121 | This is displayed as: |
| 122 | [[TicketQuery(id=123)]] |
| 123 | |
| 124 | A more compact representation without the ticket summaries is: |
| 125 | {{{ |
| 126 | [[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]] |
| 127 | }}} |
| 128 | |
| 129 | This is displayed as: |
| 130 | [[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]] |
| 131 | |
| 132 | If you wish to receive only the number of defects that match the query, use the `count` parameter: |
| 133 | {{{ |
| 134 | [[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]] |
| 135 | }}} |
| 136 | |
| 137 | This is displayed as: |
| 138 | [[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]] |
| 139 | |
| 140 | A graphical use of the macro is with the `format=progress` attribute: |
| 141 | {{{ |
| 142 | [[TicketQuery(milestone=0.12.8&group=type,format=progress)]] |
| 143 | }}} |
| 144 | |
| 145 | For example for one of the upcoming milestones, bars are shown by ticket type: |
| 146 | [[TicketQuery(milestone=0.12.8&group=type,format=progress)]] |
| 147 | |
| 148 | ---- |
| 149 | See also: TracQuery, TracTickets, TracReports, TracGuide |