#3284 closed enhancement (fixed)
grouped query output
Reported by: | ThurnerRupert | Owned by: | Peter Suter |
---|---|---|---|
Priority: | normal | Milestone: | 1.0 |
Component: | report system | Version: | 0.9.5 |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: |
ticket: Added the format "progress" to the |
||
API Changes: | |||
Internal Changes: |
Description
additionally to list view, the result of a query could also displayed grouped. one possibility would be "ticket status by <something to choose>", like in the view of a milestone.
an example what i tried to do: how do i get a view like milestone:0.10 for a user, i.e. the users/groups open tickets per component and the status?
Attachments (4)
Change History (25)
comment:1 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 19 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:3 by , 19 years ago
Resolution: | → worksforme |
---|---|
Status: | reopened → closed |
The query page has the "Group results by" field below the Filters.
comment:4 by , 18 years ago
Priority: | high → normal |
---|---|
Resolution: | worksforme |
Status: | closed → reopened |
but this is still a "list of items" and not a grouped bar chart like in the milestone view?
comment:6 by , 18 years ago
Component: | search system → report system |
---|---|
Milestone: | → 0.11 |
Owner: | changed from | to
Priority: | normal → lowest |
Severity: | normal → minor |
Status: | reopened → new |
For implementing this:
an example what i tried to do: how do i get a view like milestone:0.10 for a user, i.e. the users/groups open tickets per component and the status?
I think one possibility would be to add another output format to the TicketQuery macro (like progressbar) and base this on the patch in #2314.
by , 18 years ago
Attachment: | ticket_query_progressbar_4155.diff added |
---|
Adds a progressbar option to the TicketQuery macro
by , 18 years ago
Attachment: | ticket_query_progressbar_4155-2.diff added |
---|
Adds a progressbar option to the TicketQuery macro (incorrect upload before)
comment:8 by , 18 years ago
Oops, can't delete or overwrite my bad upload on the 1st file. But the second upload should be the right one.
The patch is against trunk, and adds a progressbar option to the TicketQuery macro that will display a progress bar similar to the one on the Roadmap and Milestone View pages.
comment:9 by , 18 years ago
Milestone: | 0.11 → 0.12 |
---|
comment:10 by , 16 years ago
#8347 was closed as duplicate.
About the patch attachment:ticket_query_progressbar_4155-2.diff, it doesn't look like it actually takes the results of the current query into account (and returning a template filename?!).
The correct approach would be to build stats
data from the query results, and generate an HTML document fragment, similar to what is done with the table format.
comment:11 by , 15 years ago
Priority: | lowest → normal |
---|---|
Severity: | minor → normal |
follow-up: 13 comment:12 by , 13 years ago
The following patch expands [[TicketQuery(...,format=progress)]]
to a roadmap-style progress bar. Grouping using [[TicketQuery(...,format=progress, group=...)]]
gives similar 'bar charts' as are shown on the milestone page.
Circular imports between trac.ticket.roadmap
and trac.ticket.query
gave me some trouble, avoided by switching the respective from import
to plain import
statements. Is there a better solution?
Most code was copied from MilestoneModule._render_view
. Should it share the code somehow? Parts from milestone_view.html
are rebuilt using tag
calls. Should the macro (re)use a template instead? (Similar to how format=table
uses the query_result.html
template?) And the roadmap.css
#stats
section was duplicated and tweaked for the new .progressquery
class. Better ideas?
by , 13 years ago
Attachment: | ticket-3284-TicketQuery-progress-format.patch added |
---|
TicketQuery(format=progress) patch against trunk @10747
follow-up: 14 comment:13 by , 13 years ago
Replying to psuter <petsuter@…>:
The following patch expands
[[TicketQuery(...,format=progress)]]
to a roadmap-style progress bar. Grouping using[[TicketQuery(...,format=progress, group=...)]]
gives similar 'bar charts' as are shown on the milestone page.
Looks very nice!
Circular imports between
trac.ticket.roadmap
andtrac.ticket.query
gave me some trouble, avoided by switching the respectivefrom import
to plainimport
statements. Is there a better solution?
You can perform the imports in the function where you need the symbols, so they will be executed at run time instead of module load time.
Most code was copied from
MilestoneModule._render_view
. Should it share the code somehow?
It would be nice if the common code could be extracted into a function, yes.
Parts from
milestone_view.html
are rebuilt usingtag
calls. Should the macro (re)use a template instead?
The repeated call to chrome.render_template()
may be an indication that a template would be better, but both approaches are valid.
And the
roadmap.css
#stats
section was duplicated and tweaked for the new.progressquery
class. Better ideas?
You could combine the selectors with identical content:
#stats legend, .progressquery legend { white-space: nowrap } #stats table, .progressquery table { border-collapse: collapse; width: 100% } ...
A minor nitpick: to get the statistics provider, you should use RoadmapModule(self.env).stats_provider
rather than self.env[roadmap.RoadmapModule].stats_provider
(the latter can return None
if the component is disabled).
follow-up: 15 comment:14 by , 13 years ago
Replying to rblank:
A minor nitpick: to get the statistics provider, you should use
RoadmapModule(self.env).stats_provider
rather thanself.env[roadmap.RoadmapModule].stats_provider
(the latter can returnNone
if the component is disabled).
Ah, thanks for the hint. I actually wondered what the difference between these was. When should the env[]
approach be used?
follow-up: 16 comment:15 by , 13 years ago
Replying to psuter <petsuter@…>:
Ah, thanks for the hint. I actually wondered what the difference between these was. When should the
env[]
approach be used?
When you want to get the component if it is enabled, but you don't want to instantiate it if it's disabled. See for example roadmap.py, where we only generate links to ticket queries if the QueryModule
is enabled.
If we used QueryModule(self.env)
, the QueryModule
would be instantiated regardless of whether it's enabled or not.
follow-up: 17 comment:16 by , 13 years ago
Replying to rblank:
When you want to get the component if it is enabled, but you don't want to instantiate it if it's disabled.
Oh ok, now that seems obvious in retrospect.
The following updated patch should fix this and the other issues. (Avoiding circular imports using function scope imports; extracting duplicated code to new helper function grouped_stats_data()
and combining identical CSS selectors.)
Thanks again for the helpful feedback!
by , 13 years ago
Attachment: | ticket-3284-TicketQuery-progress-format2.patch added |
---|
Updated patch incorporating input from comment:13
follow-up: 19 comment:17 by , 13 years ago
Milestone: | next-major-0.1X → 0.13 |
---|---|
Release Notes: | modified (diff) |
Resolution: | → fixed |
Status: | new → closed |
Replying to psuter <petsuter@…>:
The following updated patch should fix this and the other issues.
Awesome work! Patch applied in [10750], and refactored somewhat in [10751]:
- Instead of duplicating the CSS selectors, added two new classes
trac-progress
andtrac-groupprogress
and applied these classes in the milestone views as well. - Moved the grouped progress bar rendering into a separate template, and re-used it in the macro rendering instead of duplicating the logic.
comment:18 by , 13 years ago
Owner: | changed from | to
---|
comment:19 by , 13 years ago
Replying to rblank:
Awesome work! Patch applied in [10750], and refactored somewhat in [10751]:
Nice, thanks.
- Instead of duplicating the CSS selectors, added two new classes
trac-progress
andtrac-groupprogress
and applied these classes in the milestone views as well.- Moved the grouped progress bar rendering into a separate template, and re-used it in the macro rendering instead of duplicating the logic.
Looks good! I wasn't sure how acceptable it would be to refactor existing code, templates and styles for a small macro feature, but it definitely helps to keep things clean.
comment:20 by , 13 years ago
Owner: | changed from | to
---|
comment:21 by , 13 years ago
Funny, I was actually about to implement additional progress bars for subtopics of milestones in a new wiki macro. Seeking for reusable code somehow I stumbled over this ticket. So all I have to do is to add the currently missing i18n for it. The message catalogs don't hold the required msgid's right now. Thanks a bunch for the effort, Peter.
anonymous: don't close a ticket without a comment.