Edgewall Software

Ticket #7026 (new enhancement)

Opened 8 months ago

Last modified 5 months ago

[Patch] Query module column reordering

Reported by: ebray Owned by: cboos
Priority: normal Milestone: 0.12
Component: report system Version: devel
Severity: normal Keywords:
Cc:

Description (last modified by cboos) (diff)

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

query_column_reorder_6737.diff (8.1 KB) - added by hyugaricdeau@… 8 months 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@…> 8 months ago.
Simplified patch without modifying url query strings.
query_column_reorder2_6737.2.diff (6.2 KB) - added by ebray <hyugaricdeau@…> 8 months ago.
Simplified patch without modifying url query strings.
query_column_reorder2_6737.3.diff (5.8 KB) - added by ebray <hyugaricdeau@…> 8 months 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@…> 6 months 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.

Change History

Changed 8 months ago by hyugaricdeau@…

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

Changed 8 months ago by hyugaricdeau@…

  • owner changed from jonas to mgood
  • type changed from defect to enhancement
  • version set to devel
  • component changed from general to report system

Forgot to set all the other fields, oops.

Changed 8 months ago by cboos

  • priority changed from normal to high
  • description modified (diff)
  • milestone set to 0.12

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.

Changed 8 months ago by ebray

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.

Changed 8 months ago by ebray <hyugaricdeau@…>

Simplified patch without modifying url query strings.

Changed 8 months ago by ebray <hyugaricdeau@…>

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.

Changed 8 months ago by ebray <hyugaricdeau@…>

Simplified patch without modifying url query strings.

Changed 8 months ago by ebray <hyugaricdeau@…>

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

Changed 8 months ago by ebray <hyugaricdeau@…>

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

Changed 6 months ago by ebray <hyugaricdeau@…>

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.

Changed 5 months ago by cboos

  • owner changed from mgood to cboos
  • priority changed from high to normal
  • milestone changed from 0.13 to 0.12

Add/Change #7026 ([Patch] Query module column reordering)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from cboos. Next status will be 'new'
The owner will change from cboos to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.