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 strexy strexy over 7 years ago

Hi Vitaly,
I have 36 different trackers on 7 projects. According to your instructions, I have to create a new custom field (TYPE) with all my trackers listed inside and set it REQUIRED. If so, when I create a new issue I will have to select the TRACKER field (default redmine field) and the TYPE field (created by me). Is it correct?
I think it'd be a little boring to select twice the type of a new issue (tracker and type), especially when you create lots of new issues.
Tell me if I misunderstood your instructions, thanks.

PS a default queries per project basis is a really interesting feature..

|strexy

RE: Default columns plugin - Added by Vitaly Klimov over 7 years ago

Hi strexy

No, you have to create only one custom field named TYPE for projects (Administration->Custom Fields->Projects) You may create it as a list where you will list all the project types.

Also you have to create special standalone projects in which all the queries will be.

You DO NOT have to add new field to the issue' custom fields.

You may want to check Example of Usage in my original post to get the idea.

RE: Default columns plugin - Added by Vitaly Klimov over 7 years ago

Updated version. Folder names fixed for full compatibility with case-sensitive file systems.

RE: Default columns plugin - Added by Vitaly Klimov about 7 years ago

Attached is version 004 which fixes wrong sort order bug in default queries

RE: Default columns plugin - Added by Vitaly Klimov almost 7 years ago

Version 0.0.5

Registered on the Redmine plugins page: http://www.redmine.org/plugins/redmine_default_columns

Features added

  • Allows to define default global query for displaying all issues
  • Allows to define user his/hers own default queries for each project
  • Allows to define user his/hers global query for displaying all issues
  • Allows to define user query that will be applied individually for each user allowing to directly jump to project and apply specefic query upon logon

Please download version from plugin page

RE: Default columns plugin - Added by Chris Darts over 6 years ago

I've tried to follow the steps as detailed above with the latest version of the plugin (redmine_default_columns_v005). However, it still show the standard 'Issues' query layout with the default columns.

I have done the following:
  1. Created a project called 'XXX-TEMPLATE' to save my default queries
  2. Created custom project field called 'Phase' with the items 'Initiating, Planning, Execution, Sustain'
  3. Set the custom field 'Phase' on one of my test projects ('TEST') to 'Planning'
  4. Changed the plugin settings to use 'XXX-TEMPLATE' and 'Phase' to look for the saved queries (all other settings remain as default)
  5. Selected 'XXX-TEMPLATE' and created a custom query which is named 'Default_Planning'
  6. Selected the project 'TEST' from the list and went to the 'Issues' tab - I can see the link to the 'Default_Planning' query, but the list is displayed using the Redmine default columns and ordering.

I'm not quite sure where I'm going wrong. Any help would be greatly appreciated.

Thanks,

Chris

RE: Default columns plugin - Added by Chris Darts over 6 years ago

I've just deleted and created a new query with the same name (Default_Planning) and same details and it now seems to be working fine. Not quite sure what the problem was, but it's now resolved. Please ignore my previous post.

Great plugin, thanks!

RE: Default columns plugin - Added by Luis Serrano Aranda over 6 years ago

Version 0.0.6

I have mixed up two plugins (Default columns 0.0.5 and show descriptions 0.0.2) and I have added some permissions (I think is very interesting) to see whether or not the options and filters in the list of requests.

Thanks Vitaly Klimov (Default columns) & Alexandr Poplavsky (Show description) for your great work.

RE: Default columns plugin - Added by Andrey Bruggemann over 6 years ago

Portuguese(Brazil) translation (tested with version 0.0.5)

pt-BR.yml Magnifier - Portuguese(Brazil) translation (tested with version 0.0.5) (455 Bytes)

RE: Default columns plugin - Added by Luis Serrano Aranda over 6 years ago

New version with a bug solved

RE: Default columns plugin - Added by Luis Serrano Aranda over 6 years ago

Luis Serrano Aranda wrote:

New version with a bug solved v 0.0.7

RE: Default columns plugin - Added by Luis Serrano Aranda over 6 years ago

Luis Serrano Aranda wrote:

New version with a bug solved v 0.0.7

RE: Default columns plugin - Added by Chris Darts over 6 years ago

After installing v0.0.7 in Redmine v1.1.2 I recieve the following error when trying to view the issues tab for a project:

ArgumentError in Issues#index

Showing vendor/plugins/redmine_default_columns/app/views/issues/index.rhtml where line #15 raised:

wrong number of arguments (1 for 2)
Extracted source (around line #15):

12: 
13:     <%= hidden_field_tag('project_id', @project.to_param) if @project %>
14:         <div id="query_form_content" class="hide-when-print">
15: <% if User.current.allowed_to_globally?(:filter_issues_option) %>
16: <%# VVK changes start %>
17:     <fieldset id="filters" class="collapsible <%= @query.new_record? && @query.name != "_QPP_"  ? "" : "collapsed" %>">
18: <%# VVK changes end %>

Any ideas?

RE: Default columns plugin - Added by Luis Serrano Aranda over 6 years ago

Put in the line 15 or something similar
<% if User.current.allowed_to_globally?(:filter_issues_option, issues = nil) %>

RE: Default columns plugin - Added by Chris Darts over 6 years ago

I just tried the following fix and now get this error:

NoMethodError in Issues#index

Showing vendor/plugins/redmine_default_columns_plus/app/views/issues/index.rhtml where line #15 raised:

undefined method `reverse_merge' for nil:NilClass
Extracted source (around line #15):

12: 
13:     <%= hidden_field_tag('project_id', @project.to_param) if @project %>
14:         <div id="query_form_content" class="hide-when-print">
15: <% if User.current.allowed_to_globally?(:filter_issues_option, issues = nil) %>
16: <%# VVK changes start %>
17:     <fieldset id="filters" class="collapsible <%= @query.new_record? && @query.name != "_QPP_"  ? "" : "collapsed" %>">
18: <%# VVK changes end %>

RE: Default columns plugin - Added by Luis Serrano Aranda over 6 years ago

What is your redmine version ?
plugins which are installed in Redmine?

Thanks

RE: Default columns plugin - Added by Chris Darts over 6 years ago

Redmine 1.1.2.stable.5450 (MySQL)

Plugins installed:

- customer_plugin
- redmine_better_gantt_chart
- redmine_knowledgebase
- redmine_tab
- redmine_time_tracker
- stuff_to_do_plugin
- timesheet_plugin

RE: Default columns plugin - Added by Anonymous over 6 years ago

I´m having the same problems as Chris Darts had:

- Created a project
- Created custom project field
- Set the custom field 'Phase' on one of my test projects
- Changed the plugin settings to look for the saved queries (all other settings remain as default)
- Selected project and created a custom query which is named 'Default_Planning'
- Selected the test-project from the list and went to the 'Issues' tab

I can see the link to the 'Default_Planning' query, but the list is displayed using the Redmine default columns and ordering.

Any idea how to debug?

RE: Default columns plugin - Added by Luis Serrano Aranda over 6 years ago

Could you try only this plugin ?

RE: Default columns plugin - Added by Anonymous over 6 years ago

?

I´m using 0.0.5.

RE: Default columns plugin - Added by Luis Serrano Aranda over 6 years ago

Could you try the 0.0.7 version (default column plus)?

Thanks

RE: Default columns plugin - Added by Chris Darts over 6 years ago

Luis,

Any update on the error reported above when trying to install version 0.0.7 on Redmine 1.1.2?

Thanks

RE: Default columns plugin - Added by Luis Serrano Aranda over 6 years ago

Let me this week-end

RE: Default columns plugin - Added by Chris Darts over 6 years ago

Sorry to hassle, but any news of 1.1.x compatibility?

RE: Default columns plugin - Added by Daniel Schaarschmidt over 6 years ago

Luis' workaround <% if User.current.allowed_to_globally?(:filter_issues_option, issues = nil) %> works, if you use {} instead of nil. At least the issues page is shown again ;-(

After that I get the same results (Redmine 1.2.0) as with version 005: If I change the query and click apply, all columns are deselected for the view. If I click on apply again, I get the default selection.

1 2 3 4 (1-25/83)