wiki:DynamicVariablesPlugin

Default and convert report dynamic variables to pulldowns

Description

This plugin applies to all reports that use dynamic variables. The plugin does two things for dynamic variables whose (uppercase) name exactly matches a built-in or custom (lowercase) select field name:

  • Dynamic variables are set to default values if unset
  • The text fields for dynamic variables are converted to pulldown menus

JavaScript is required for the second feature above.

Configuration

  1. Install the plugin (after downloading and unzipping):
    cd dynamicvariablesplugin/0.12
    sudo python setup.py bdist_egg
    sudo cp dist/TracDynamicVariables*.egg /your/trac/location/plugins/
    

See TracPlugins for more installation details and options. You'll likely need to restart Trac's web server after installation.

  1. Enable the plugin:
    [components]
    dynvars.* = enabled
    

You can alternatively use the Trac Web Admin GUI to enable any or all rules.

  1. (Optional) Set a [dynvars] section of field names with explicit option values. Example:
    [dynvars]
    daysback.options = 7|30
    

In the above example, daysback is not a custom ticket field but can set a DAYSBACK dynamic variable via a pulldown with the specified options. A [dynvars] section is not needed to configure dynamic variables that exactly match built-in or custom field names as shown in the screenshots below.

  1. Create/modify reports so that the names used for dynamic variables exactly match the names of the select field that it corresponds to. See an example below.

Bugs/Feature Requests

Existing bugs and feature requests for DynamicVariablesPlugin are here.

If you have any issues, create a new ticket.

Download

Download the zipped source from here.

Source

You can check out DynamicVariablesPlugin from here using Subversion, or browse the source with Trac.

Example

The only required configuration is in defining SQL reports. For example, a report for a specific milestone that also queries for a custom queue select field could be defined like this:

SELECT p.value AS __color__,
   t.id AS ticket, summary, component, severity, reporter
  FROM ticket t
  LEFT OUTER JOIN milestone m ON t.milestone = m.name
  LEFT JOIN enum p ON p.name = t.severity AND p.type = 'severity'
  LEFT OUTER JOIN ticket_custom q ON q.ticket = t.id and q.name = 'queue'
  WHERE q.value = '$QUEUE'
    AND milestone = '$MILESTONE'
  ORDER BY m.due ASC, p.value

Here's what this report would look like both before and after this plugin is installed and enabled:

Before

After

Completed milestones are omitted from the pulldown menu.

Recent Changes

[14032] by rjollos on 2014-07-25 13:34:51
Changed license to 3-Clause BSD with permission of author. Refs #11832.
[13991] by rjollos on 2014-06-22 11:47:31
Indentation and whitespace cleanup using reindent.py.
[11092] by robguttman on 2012-01-02 16:39:40
fixed python path

Author/Contributors

Author: robguttman
Maintainer: robguttman
Contributors:

Last modified 2 years ago Last modified on Aug 1, 2012, 5:18:35 AM

Attachments (2)

Download all attachments as: .zip