Default columns plugin

Added by Vitaly Klimov over 7 years ago

Up to date plugin page

http://www.redmine.org/plugins/redmine_default_columns

Intro

I would like to share plugin which i wrote to implement Feature request #3967. Plugin was tested on Redmine 0.9.0 (r3285) Please read below to get the idea of how it works:

Features

  • Allows to define default query on project by project basis
  • Allows to define default query based on project custom field value
  • Uses existing query system thus providing compatibility with future Redmine versions

Details

This plugin is very useful if you are using Redmine projects for more than one purpose. For example, we have projects for bug-tracking as well as for project management and invoice tracking. I was really missing the ability to define default query for project or group of projects - and without it it was very inconvenient to create set of public queries which you had manually apply each time you switch projects.

Logic behind the plugin

First of all - plugin uses existing queries system thus (hopefully) maintaining maximal compatibility with further Redmine versions. It uses existing queries and small patch to the Issues Controller to apply default query if no query is defined.

Plugin retrieves queries from dedicated project (defined in settings) and applies them to the current project.

I would advise to create dedicated project which will hold all the necessary types of queries. This project has to include all trackers and all custom fields to make all the types of queries possible.

How it works

There are several nested levels by which default query is determined

  • If the project has query with the name defined in plugin settings (field Default query name) plugin uses this query as a default query
  • If no such query exists in project, value of project custom field (defined in drop down Custom field to define type on the plugin settings screen) appended to the string Default_ to create query name
  • If no such custom field exists, value Default_Project used for query name
  • After that query with such name is retrieved from project defined in the drop down named Project with default queries (on the plugin settings screen)
  • If there are no such query exist then plugin does nothing

Example of usage

For example, we have projects of three several types - one for bug-tracking, another one for PM and another one for invoices. Also we have one special project named SpecialCase for whom we want to have its own default query.

Step by step tutorial

  1. Create special project which will hold all our default queries (lets call it DefaultQueries) We should include all possible trackers and issues' custom fields to this project to be able to create queries for all our projects
  2. Create project custom field which will hold project type (lets make it drop-down named Type with values Bugs, Invoices and Tasks). To make things easier we'll make it required for all projects with the default value of Tasks
  3. Set this custom field for each project according to the project type
  4. Go to plugin settings and select project we created (DefaultQueries) and custom field name (Type). We will leave value for the Default query name as it was - Default
  5. Go to the project DefaultQueries and create there three queries named Default_Bugs, Default_Tasks and Default_Invoices For each query we can use its own set of columns/sort order/grouping
  6. Go to the project SpecialCase and create query named Default

We all set for now.

What would happen if we will decide to view issues in the project with custom field Type set to Bugs? Plugin will lookup query named Default_Bugs in project DefaultQueries and apply it to the issues view! Same will be done for projects with type Tasks and Invoices - queries named Default_Tasks and Default_Invoices will be applied to their views. If we will choose project named SpecialCase the query named Default will be applied because it exists there regardless of the project type.

Installation and Setup

  1. Follow the Redmine plugin installation steps at: http://www.redmine.org/wiki/redmine/Plugins Make sure the plugin is installed to vendor/plugins/redmine_default_columns
  2. Restart your Redmine web servers (e.g. mongrel, thin, mod_rails)
  3. Login and configure the plugin (Administration > Plugins > Configure)

Replies (83)

RE: Default columns plugin - Added by Olivier Houdas over 4 years ago

For those having the same problem as Chris Darts (as I had myself)...
Queries created in the specific DefaultQueries (or XXX-Templates for Chris) project should NOT be Public, and should NOT be for All projects.

And I confirm that inserting VVK changes into a copy of <Redmine root>\apps\redmine\htdocs\app\views\issues\index.html.erb replacing <Redmine root>\apps\redmine\htdocs\plugins\redmine_default_columns\app\views\issues\index.html.erb works for redmine 2.1.2.

RE: Default columns plugin - Added by Thien Vuong over 3 years ago

I'm using Redmine 2.3.3

Without VVK change (using the plugin index.html.erb), it works but I lose the description field selection.
With VVK change, it kind of works, except it would lose all column setting (except for the description block)

RE: Default columns plugin - Added by Olivier Houdas over 3 years ago

@Thien Vuong: see http://www.redmine.org/issues/5893 regarding the possibility to filter on the Description field.

@Vitaly Klimov: someone in our company noticed a bug on the plugin:
  1. Display issues on a project using Default queries
  2. Click on a saved query
  3. Click Export as CSV at the bottom of the page

Result: it's the default query results which are exported, not the result of the saved query results displayed on the page.
A work around is to click the Apply button to execute the saved query again. This will get out of the saved query (showing the filters which can then be edited, by the way), and the CSV or PDF export will work.

RE: Default columns plugin - Added by Olivier Houdas almost 3 years ago

At last I found the time to have a look at the CSV export issue reported 9 months ago.
When exporting to CSV, the parameters received do not contain anymore that we are in the frame of a saved query. So we need to add a test to disable the plugin in the specific case of csv export, in addition to the case of using a saved query.
The change to do so is attached as a patch.

RE: Default columns plugin - Added by Olivier Houdas about 2 years ago

Not sure anyone's still using that plugin, but just in case...
Attached is a version which works with Redmine 3.1.0.
I removed compatibility with old versions of Rails and of Redmine to clean the code.

redmine_default_columns_v1.1.2.zip - Redmine 3.x compatible (24.3 KB)

RE: Default columns plugin - Added by Olivier Houdas over 1 year ago

And a new version with a fix for crashes on Gantt and Agenda views when no project is set (happens when clicking on the Calendar or Gantt links after following a bug list link from a My page block).

RE: Default columns plugin - Added by Steven Wong over 1 year ago

Olivier Houdas wrote:

And a new version with a fix for crashes on Gantt and Agenda views when no project is set (happens when clicking on the Calendar or Gantt links after following a bug list link from a My page block).

I haven't found a compatible version for Redmine 3.2 and I've watched over github for almost 5 months.

Thanks .

I will try it later. Thanks so much.

RE: Default columns plugin - Added by Olivier Houdas 3 months ago

For those interested, here is an update for a version which works with Redmine 3.4.2 (and only with Redmine 3.4.x or above, for earlier versions, use earlier versions of the plugin).

redmine_default_columns_v014.zip - v 0.1.4, Redmine 3.4.x compatibility (23.7 KB)

1 2 3 4 (76-83/83)