Modify

Opened 13 years ago

Closed 13 years ago

#8961 closed enhancement (fixed)

[PATCH] improve option / default handling, introduce two more options

Reported by: Patrick Schaaf Owned by: Chris Nelson
Priority: normal Component: TracJsGanttPlugin
Severity: normal Keywords:
Cc: Ryan J Ollos Trac Release: 0.11

Description

This is an enhancement patch I just cooked up. It provides for the following:

  • the builtin defaults for all macro arguments (except query arguments), can now be changed in trac.ini, like this:
    [trac-jsgantt]
    option.openLevel = 0
    
  • all these options, when representing integer values, are type converted, whether coming from trac.ini or macro instantiations. A suitable python conversion error is shown, instead of just not displaying the JS at all (e.g. res=xxx now shows an error.)
  • a new option (trac.ini or macro argument) openClosedTickets, defaulting to 1, can be set to 0 to make parent tickets with status closed, initially show as collapsed, regardless of openLevel setting.
  • a new option (trac.ini or macro argument) userMap, defaulting to 1, can be set to 0 to avoid the conversion of login (ticket owner) names to full / real names in the Resource display column.
    Setting userMap=0 makes Resource show the login names.
    In particular, not doing this conversion, avoids the internal call to self.env.get_known_users(), which could be pretty expensive when you have a huge list of users.

Attachments (1)

tracjsganttplugin-option-defaults.patch (6.7 KB) - added by Patrick Schaaf 13 years ago.
option defaults in trac.ini, new options openClosedTickets, userMap, and omitMilestones

Download all attachments as: .zip

Change History (18)

comment:1 in reply to:  description ; Changed 13 years ago by Chris Nelson

Status: newassigned

Replying to bof:

This is an enhancement patch I just cooked up. It provides for the following:

  • the builtin defaults for all macro arguments (except query arguments), can now be changed in trac.ini, like this:
    [trac-jsgantt]
    option.openLevel = 0
    

Thanks! I've been wanting to do that for a while.

  • all these options, when representing integer values, are type converted, whether coming from trac.ini or macro instantiations. A suitable python conversion error is shown, instead of just not displaying the JS at all (e.g. res=xxx now shows an error.)

Sounds like a nice cleanup.

  • a new option (trac.ini or macro argument) openClosedTickets, defaulting to 1, can be set to 0 to make parent tickets with status closed, initially show as collapsed, regardless of openLevel setting.

I was planning on adding something like open=open (don't close the tree for open tickets) and have some other thoughts about more flexible open= and close= options. I may not may not adopt or adapt this change.

  • a new option (trac.ini or macro argument) userMap, defaulting to 1, can be set to 0 to avoid the conversion of login (ticket owner) names to full / real names in the Resource display column.
    Setting userMap=0 makes Resource show the login names.
    In particular, not doing this conversion, avoids the internal call to self.env.get_known_users(), which could be pretty expensive when you have a huge list of users.

I can see where that would be useful. Thanks.

comment:2 Changed 13 years ago by Patrick Schaaf

Small respin of the patch, adding yet another option:

omitMilestones can be set to 1 to suppress the automatic addition of milestones found on the displayed tickets. Milestones explicitly requested using a milestone= macro argument, will still be presented.

Default for the option is, of course, 0.

I'm replacing the original patch file, because this is both a small addition, and depends on the previous one being applied.

comment:3 in reply to:  1 Changed 13 years ago by Patrick Schaaf

Replying to ChrisNelson:

Replying to bof:

  • a new option (trac.ini or macro argument) openClosedTickets, defaulting to 1, can be set to 0 to make parent tickets with status closed, initially show as collapsed, regardless of openLevel setting.

I was planning on adding something like open=open (don't close the tree for open tickets) and have some other thoughts about more flexible open= and close= options. I may not may not adopt or adapt this change.

Fine with me. I think the (optional) feature to make already closed tickets collapse, is important - I'll probably be happy with a superset solution that lets me be more fancy or selective :)

  • a new option (trac.ini or macro argument) userMap, defaulting to 1, can be set to 0 to avoid the conversion of login (ticket owner) names to full / real names in the Resource display column.

I can see where that would be useful. Thanks.

I did not really make that change for the performance improvement. Our login names are a lot shorter than some of the full names, so more horizontal space remains for the ticket summary and status display, when I use the login names.

Changed 13 years ago by Patrick Schaaf

option defaults in trac.ini, new options openClosedTickets, userMap, and omitMilestones

comment:4 Changed 13 years ago by Patrick Schaaf

Chris, there was a small bug in the patch; I replaced it with another respin. If you already applied the version from two hours ago, here is the additional change:

@@ -213,7 +219,7 @@
             if not key in self.options:
                 query_args[key] = options[key]

-        if 'root' in options:
+        if options['root']:
             parents = options['root'].split('|')
             query_args['id'] = '|'.join(_children(parents))

Without this change, not using root= results in a python error, because after my previous change to _process_options, now all keys from self.options are present in options, too.

comment:5 Changed 13 years ago by Chris Nelson

(In [10409]) Allow option defaults to be set in trac.ini. Refs #8961.

With this change, option.<opt> in trac.ini overrides the built-in default for <opt>.

Part of a patch from bof. Thanks!

comment:6 Changed 13 years ago by Chris Nelson

(In [10410]) Make user name mapping optional. Refs #8961.

Setting userMap=0 disables mapping of user IDs to full names. (Defaults on.)

Thanks to bof for the patch.

comment:7 Changed 13 years ago by Chris Nelson

(In [10411]) Add omitMilestones option. Refs #8961.

When set to 1, only milestones listed in milestone= will be shown. When set to 0, milestones for all tickets will be shown.

Thanks to bof for the patch.

comment:8 Changed 13 years ago by Chris Nelson

(In [10559]) Add openClosedTickets option. Refs #8961.

comment:9 Changed 13 years ago by Chris Nelson

Resolution: fixed
Status: assignedclosed

I haven't gotten to the fancy open= and closed= options I planned and this is a big step forward, covering most of what those would.

comment:10 Changed 13 years ago by Ryan J Ollos

Cc: Ryan J Ollos added; anonymous removed

comment:11 in reply to:  8 ; Changed 13 years ago by Ryan J Ollos

Replying to ChrisNelson:

(In [10559]) Add openClosedTickets option. Refs #8961.

Minor suggestion: I think that the purpose of this option would be way more clear if it was named collapseClosedTickets (and defaulting to 0, of course).

comment:12 in reply to:  11 ; Changed 13 years ago by Chris Nelson

Resolution: fixed
Status: closedreopened

Replying to rjollos:

Replying to ChrisNelson:

(In [10559]) Add openClosedTickets option. Refs #8961.

Minor suggestion: I think that the purpose of this option would be way more clear if it was named collapseClosedTickets (and defaulting to 0, of course).

One of my colleagues suggested expandClosedTickets and keep the same sense. Either is clearer than open I think (sorry, bof). Which do you prefer?

comment:13 in reply to:  12 ; Changed 13 years ago by Patrick Schaaf

Replying to ChrisNelson:

Replying to rjollos:

Replying to ChrisNelson:

(In [10559]) Add openClosedTickets option. Refs #8961.

Minor suggestion: I think that the purpose of this option would be way more clear if it was named collapseClosedTickets (and defaulting to 0, of course).

One of my colleagues suggested expandClosedTickets and keep the same sense. Either is clearer than open I think (sorry, bof). Which do you prefer?

No need to be sorry - I wasn't entirely happy with openClosed, too.

I prefer expandClosedTickets with default 1.

comment:14 in reply to:  13 Changed 13 years ago by Ryan J Ollos

Replying to bof:

I prefer expandClosedTickets with default 1.

+1 for expandClosedTickets.

comment:15 Changed 13 years ago by Chris Nelson

(In [10581]) Rename "openClosedTickets" to "expandClosedTickets". Refs #8961.

comment:16 Changed 13 years ago by Chris Nelson

(In [10583]) Remove unimplented option which snuck into push. Refs #8961.

comment:17 Changed 13 years ago by Chris Nelson

Resolution: fixed
Status: reopenedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Chris Nelson.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.