Edgewall Software
Modify

Opened 12 years ago

Last modified 2 years ago

#7026 new enhancement

[Patch] Query module column reordering

Reported by: ebray Owned by:
Priority: normal Milestone: next-major-releases
Component: report system Version: devel
Severity: normal Keywords: patch
Cc: Branch:
Release Notes:
API Changes:

Description (last modified by Christian Boos)

This is a patch I came up with at PyCon specifically because some of my users need it, but I think something like it could go into Trac core.

First of all it solves the problem of the poor scalability of the UI for selecting columns to display, which is pretty unusable in situations where there are something on the order of 50 custom fields (which I've seen, and it's ugly).

I also needed the ability to let users reorder the columns, which this solves. I'm not sure how the Trac devs will feel about this. It replaces the 'col=' query arguments with arguments in the form 'col#=', where # is the order that that column should be displayed in. This works fine for URL query strings. But I haven't updated the TracQuery syntax to support column reordering. Other than that it seems to work fine, and includes support for non-JavaScript users.

Attachments (5)

query_column_reorder_6737.diff (8.1 KB ) - added by hyugaricdeau@… 12 years ago.
Some of the diffs may be from my editor removing stray whitespace, which may be annoying.
query_column_reorder2_6737.diff (14.4 KB ) - added by ebray <hyugaricdeau@…> 12 years ago.
Simplified patch without modifying url query strings.
query_column_reorder2_6737.2.diff (6.2 KB ) - added by ebray <hyugaricdeau@…> 12 years ago.
Simplified patch without modifying url query strings.
query_column_reorder2_6737.3.diff (5.8 KB ) - added by ebray <hyugaricdeau@…> 12 years ago.
Ignore that version of the patch too.. It had a weird stray line left in it. This is the one you want.
query_column_reorder3-r7181.diff (9.4 KB ) - added by ebray <hyugaricdeau@…> 11 years ago.
An updated version of this patch with a somewhat improved implementation. The UI for adding and removing columns is now more similar to the UI for adding/removing filters.

Download all attachments as: .zip

Change History (21)

by hyugaricdeau@…, 12 years ago

Some of the diffs may be from my editor removing stray whitespace, which may be annoying.

comment:1 by hyugaricdeau@…, 12 years ago

Component: generalreport system
Owner: changed from Jonas Borgström to Matthew Good
Type: defectenhancement
Version: devel

Forgot to set all the other fields, oops.

comment:2 by Christian Boos, 12 years ago

Description: modified (diff)
Milestone: 0.12
Priority: normalhigh

I tried the patch and it works great. I think the UI is perfect for the non JavaScript case, but with JavaScript enabled, I'm sure we could even make this more intuitive in the future by providing the possibility to simply dragg the column name up and down.

I'm not sure about passing the ordering info (coln). Currently, we simply rely on the order of the col arguments in req.args['col'] to be the same as they appear in the query string. Is there a situation were this wouldn't work? If not, I think the code could be simplified a lot. At the very least, the col parameters without a number should still be supported for backward compatibility and for example, added at the end after the numbered columns.

comment:3 by ebray, 12 years ago

I didn't know that arguments of the same name were guaranteed to appear in the list in the same order that they appear in the query string. But if so, then that definitely simplifies matters greatly. I'll have to try it out and see what I can come up with.

I thought I did maintain backwards compatibility by listing col arguments after the coln arguments. But maybe I just thought it but never did it. Oh well, if the above is true then it's a moot point.

Dragging of columns would definitely be nice, but that would probably make sense to do once jQuery UI is included with Trac, which there seems to be some talk about doing.

by ebray <hyugaricdeau@…>, 12 years ago

Simplified patch without modifying url query strings.

comment:4 by ebray <hyugaricdeau@…>, 12 years ago

Here's a much simpler version of the patch that does not depend on the coln query string arguments, as long as the col= arguments are listed in order it works fine.

by ebray <hyugaricdeau@…>, 12 years ago

Simplified patch without modifying url query strings.

comment:5 by ebray <hyugaricdeau@…>, 12 years ago

Ignore the previous attachment. I did the diff on the wrong directory.

by ebray <hyugaricdeau@…>, 12 years ago

Ignore that version of the patch too.. It had a weird stray line left in it. This is the one you want.

by ebray <hyugaricdeau@…>, 11 years ago

An updated version of this patch with a somewhat improved implementation. The UI for adding and removing columns is now more similar to the UI for adding/removing filters.

comment:6 by Christian Boos, 11 years ago

Milestone: 0.130.12
Owner: changed from Matthew Good to Christian Boos
Priority: highnormal

comment:7 by Remy Blank, 10 years ago

This would have to be re-adapted on top of the new query UI and the query.js rewrite using jQuery. I suggest moving back to 0.13.

I would also argue in favor of direct drag-and-drop of columns when JavaScript is enabled.

comment:8 by Christian Boos, 10 years ago

Agreed (especially the d'n'd part ;-) ).

But let's move it to 0.13 once all the current 0.13 are retargeted to the next-major milestone.

comment:9 by ebray, 10 years ago

I readapted it to go with the other changes in my own Trac, but I'd have to redo the patch for it to fit into trunk. Regardless, I agree that it could use some rework in general. Drag and drop sounds nice :)

comment:10 by Remy Blank, 10 years ago

Milestone: 0.12next-major-0.1X

To be done in 0.13 (which doesn't exist yet).

comment:11 by Steffen Hoffmann, 9 years ago

Milestone: next-major-0.1X0.13

just finishing the intended ticket triaging

In fact, considering especially the depreciation note at TracReports to get rid of that module, respecting a custom defined column order is an absolute must-have for TracQuery.

comment:12 by Christian Boos, 9 years ago

Milestone: 0.13next-major-0.1X

Well, unless you're willing to provide yourself a patch (and hammer it until it gets included!), please don't schedule things for 0.13 (see the policy note on the milestone).

We're thinking on closing 0.13 sooner rather than later, and this will rather mean moving things away from 0.13 and finishing (the many) contributions that are already in a good shape.

Last edited 9 years ago by Christian Boos (previous) (diff)

comment:13 by Ryan J Ollos, 4 years ago

Owner: Christian Boos removed

comment:14 by figaro, 4 years ago

Keywords: patch added

comment:15 by Jun Omae, 2 years ago

I implemented th:TracFlexibleQueryUiPlugin as a plugin for this feature.

in reply to:  15 comment:16 by Ryan J Ollos, 2 years ago

Replying to Jun Omae:

I implemented th:TracFlexibleQueryUiPlugin as a plugin for this feature.

Looks really nice! Do you think the plugin is suitable for integration to Trac? I did a code drop in log:rjollos.git:t7026_query_column_reordering, and it seems to be functional. There would need to be a significant amount of refactoring in areas where the plugin was working around the Trac API. Any advice or recommendations on moving forward with this? I might try to spend some time on it, but before I pursue it I'd want to know if you think this is the right approach to adding the feature in Trac, or if you'd take a different approach.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned. Next status will be 'new'.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


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