#1925 closed enhancement (duplicate)
Have a preference for default report on "View Tickets" instead of report list
Reported by: | Manuzhai | Owned by: | Jonas Borgström |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | report system | Version: | devel |
Severity: | normal | Keywords: | custom navigation |
Cc: | manuzhai@…, sdyson@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
In some of my Trac installation, there's not much of a need for reports other than the Active Tickets report. If I do, there's always the Available Reports subnav-item that I can use to get to it, but in most cases I'd rather just go to report {1}. The attached patch checks for a preference 'default_report' in the 'ticket' section. If it's there, View Tickets points to the selected report, otherwise View Tickets will just point to the report list.
Attachments (1)
Change History (16)
by , 19 years ago
Attachment: | default-report.diff added |
---|
comment:1 by , 19 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
If you only need the list of active tickets, I'd recommend you disable the report component altogether in trac.ini:
[disabled_components] trac.ticket.report = yes
This will make the query module the target of the "View Tickets" link, and there the default view is the list of open tickets (or, if you're logged in, the open tickets assigned to you).
See my own site http://bitten.cmlenz.net/ for how this works.
comment:2 by , 19 years ago
Milestone: | 0.9 |
---|
comment:3 by , 18 years ago
Since the update to 0.10.2 the diff-patch above doesn't work anymore. I've Updated the "diff-patch" like this:
Line 58 and the following in /python2.4/sitepackages/trac/ticket/report.py:
# Original #yield ('mainnav', 'tickets', # html.A('View Tickets', href=req.href.report())) # New Replacement: path = self.env.config.get('ticket', 'default_report') yield ('mainnav', 'tickets', html.A('View Tickets', href=req.href.report()+'/'+path))
comment:4 by , 18 years ago
I think my patch is a little better:
Index: trac/ticket/report.py =================================================================== --- trac/ticket/report.py (revision 4085) +++ trac/ticket/report.py (working copy) @@ -42,8 +42,9 @@ def get_navigation_items(self, req): if not req.perm.has_permission('REPORT_VIEW'): return + path = self.env.config.get('ticket', 'default_report') yield ('mainnav', 'tickets', - html.A('View Tickets', href=req.href.report())) + html.A('View Tickets', href=req.href.report(path))) # IPermissionRequestor methods
I still think this is a nice patch.
comment:5 by , 18 years ago
Milestone: | → 0.11 |
---|---|
Resolution: | worksforme |
Status: | closed → reopened |
I'm reopening because of #1735.
Once we have the possibility to save a custom query as a reports(*), the proposed patch becomes even more interesting, as this would provide a clean way to get to some particular custom query, instead of the current hard-coded default.
(*) save the query string, not the SQL
comment:6 by , 18 years ago
comment:7 by , 18 years ago
I've maintained my patch for this (this is against r4475):
Index: trac/ticket/report.py =================================================================== --- trac/ticket/report.py (revision 4475) +++ trac/ticket/report.py (working copy) @@ -41,8 +41,9 @@ def get_navigation_items(self, req): if 'REPORT_VIEW' in req.perm: + path = self.env.config.get('ticket', 'default_report') yield ('mainnav', 'tickets', - html.A('View Tickets', href=req.href.report())) + html.A('View Tickets', href=req.href.report(path))) # IPermissionRequestor methods
I still think this is a useful enhancement, and it's a TINY change.
comment:8 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Implemented in r4786.
It's done a bit differently than the proposed patch, so that the /report URL corresponds to the default report. The list of all available reports becomes reachable explicitly by requesting /report/-1.
I've kept the proposed configuration setting, though.
comment:9 by , 18 years ago
Cc: | added |
---|
comment:10 by , 18 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
I don't agree that your patch is better than mine. -1 is a decidedly ugly kind of "magic" parameter. Secondly, you just broke any permalinks to the report list.
I request that you reconsider this. It would work just fine to keep /report as the report list and change the navcontributor so that View Tickets links to the default_report by default. Otherwise, could you explain why you don't agree?
comment:11 by , 18 years ago
Component: | ticket system → report system |
---|---|
Keywords: | custom navigation added |
Milestone: | 0.11 |
Resolution: | → duplicate |
Status: | reopened → closed |
Ok, will redo, as discussed in "Discussing two changesets" trac-dev thread.
See #2060.
follow-up: 14 comment:13 by , 15 years ago
Resolution: | duplicate |
---|---|
Status: | closed → reopened |
can this be reconsidered? has this been solved in some other way that i missed?
having to do 2 mouse clicks to reach the main bugs page is very annoying, and the patch is indeed tiny and works on the current version (0.11.4)
leaving
[ticket] default_report =
empty results in the default behavior.
comment:14 by , 15 years ago
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
Replying to jakob.gruber@…:
can this be reconsidered? has this been solved in some other way that i missed?
Yes it has. Add the following to your trac.ini
:
[mainnav] tickets.href = /report/1
See TracNavigation for more information.
Change navcontributor to depend on default_report setting