Edgewall Software
Modify

Opened 19 years ago

Closed 15 years ago

Last modified 15 years ago

#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)

default-report.diff (567 bytes ) - added by Manuzhai 19 years ago.
Change navcontributor to depend on default_report setting

Download all attachments as: .zip

Change History (16)

by Manuzhai, 19 years ago

Attachment: default-report.diff added

Change navcontributor to depend on default_report setting

comment:1 by Christopher Lenz, 19 years ago

Resolution: worksforme
Status: newclosed

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 Christopher Lenz, 19 years ago

Milestone: 0.9

comment:3 by anonymous, 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 Manuzhai, 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 Christian Boos, 18 years ago

Milestone: 0.11
Resolution: worksforme
Status: closedreopened

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 Christian Boos, 18 years ago

See also #3511. I think there should be a system wide default report, set in [ticket] default_report (this ticket), which can eventually be overridden by an user preference (#3511).

comment:7 by Manuzhai <manuzhai@…>, 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 Christian Boos, 18 years ago

Resolution: fixed
Status: reopenedclosed

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 anonymous, 18 years ago

Cc: sdyson@… added

comment:10 by Manuzhai, 18 years ago

Resolution: fixed
Status: closedreopened

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 Christian Boos, 18 years ago

Component: ticket systemreport system
Keywords: custom navigation added
Milestone: 0.11
Resolution: duplicate
Status: reopenedclosed

Ok, will redo, as discussed in "Discussing two changesets" trac-dev thread.

See #2060.

comment:12 by Christian Boos, 18 years ago

(r4786 was reverted in r5249)

comment:13 by jakob.gruber@…, 15 years ago

Resolution: duplicate
Status: closedreopened

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.

in reply to:  13 comment:14 by Remy Blank, 15 years ago

Resolution: duplicate
Status: reopenedclosed

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.

comment:15 by anonymous, 15 years ago

right - sorry for reopening.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.