Feature #6432

Allow Roadmap view without any related issues

Added by Mischa The Evil about 11 years ago. Updated 17 days ago.

Status:ReopenedStart date:2010-09-18
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Roadmap
Target version:5.0.0
Resolution:Fixed

Description

Extensive subject

Allow a Roadmap view, without any related issues, when at least one tracker is configured by a Redmine Administrator as to show its issues by default on the roadmap1.

Introduction

I noticed some unexpected behaviour in the roadmap view a while ago which I already discussed over IRC with Eric Davis. Here follows an extraction.

Discussion

Mischa The Evil wrote:

When I deselect all trackers I expect to recieve a roadmap view showing all versions without any related issues. Instead, I recieve the roadmap with the related issues in the trackers that are selected by the Redmine Administrator as to be shown on the roadmap by default.

This is due to the fact that when I deselect all trackers no :tracker_ids params are passed to the VersionsController hence @selected_tracker_ids = (default_trackers || selectable_trackers).collect {|t| t.id.to_s } becomes assigned2.

If the url is manually crafted into something like "/roadmap?tracker_ids%5B%5D=none" (notice the explicit none-value) the expected roadmap view is rendered though.

There doesn't seem to be any hidden fields for none that are selected. It seems rather caused by the retrieve_selected_tracker_ids method in the VersionsController (source:/trunk/app/controllers/versions_controller.rb#L147), which checks if any tracker_ids-params are in the URL and because I deselected all trackers there aren't any.

class VersionsController < ApplicationController
  ...
  def index
    @trackers = @project.trackers.find(:all, :order => 'position')
    retrieve_selected_tracker_ids(@trackers, @trackers.select {|t| t.is_in_roadmap?})
    ...
  end
  ...
  ...
private
  ...
  def retrieve_selected_tracker_ids(selectable_trackers, default_trackers=nil)
    if ids = params[:tracker_ids]
      @selected_tracker_ids = (ids.is_a? Array) ? ids.collect { |id| id.to_i.to_s } : ids.split('/').collect { |id| id.to_i.to_s }
    else
      @selected_tracker_ids = (default_trackers || selectable_trackers).collect {|t| t.id.to_s }
    end
  end
end

Eric Davis wrote:

If you unselect everything, I would think it would return nothing and not the default.

Mischa The Evil wrote:

Redmine returns the default there because of a specific setting for each of the trackers to show the tracker in the roadmap whether or not. It's code from the time we also had the seperate changelog view3.

Eric Davis wrote:

Hmm...

Mischa The Evil wrote:

Indeed, my reaction was the same at first. I was so far able to trace the issue back to the retrieve_selected_tracker_ids method in the VersionsController.

Eric Davis wrote:

What do you think we should do?

Mischa The Evil wrote:

I can't tell (yet). Especially since it's acceptable that an admin configures all the trackers to be not shown on the roadmap by default. Thus I conclude upto now that Redmine can't rely on the existance of the tracker_ids-param in the URL if we want to be able to recieve the expected none setting... :S

I'll add it as a feature request on Redmine to accept an explicit none-setting for the selected_trackers on the roadmap.

Footnotes

1 See RedmineIssueTrackingSetup.

2 The following graph shows the trace to this assignment. I took it from a full HTML-export from FreeMind (which I attach also as retrieve_selected_tracker_ids-FreeMind_html_export.zip).

3 This view is removed by JPL in r3162 which relates to issue #2972.

retrieve_selected_tracker_ids.png (26.4 KB) Mischa The Evil, 2010-09-19 06:07

retrieve_selected_tracker_ids-FreeMind_html_export.zip (20.6 KB) Mischa The Evil, 2010-09-19 06:07

0001-Allow-Roadmap-view-without-showing-any-related-issue.patch Magnifier - Patch against trunk @ r21200. (2.72 KB) Mischa The Evil, 2021-08-24 06:48


Related issues

Related to Redmine - Feature #2972: Improve Changelog feature (separate tab and merge Roadmap... Closed 2009-03-15
Related to Redmine - Feature #32278: Display Global Roadmap without any tracker New

Associated revisions

Revision 21204
Added by Go MAEDA 18 days ago

Allow Roadmap view without any related issues (#6432).

Patch by Mischa The Evil.

History

#1 Updated by Jan Niggemann (redmine.org team member) about 9 years ago

Just for those wondering, this is still present in 1.4.3, although it's no big deal for us...

#2 Updated by Mischa The Evil almost 2 years ago

  • Related to Feature #32278: Display Global Roadmap without any tracker added

#3 Updated by Mischa The Evil 29 days ago

I just noticed this issue again. I haven't tested this thoroughly but the following patch should do the trick:

 app/views/versions/_sidebar.html.erb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/app/views/versions/_sidebar.html.erb b/app/views/versions/_sidebar.html.erb
index abfe9c67c..6b34b34b8 100644
--- a/app/views/versions/_sidebar.html.erb
+++ b/app/views/versions/_sidebar.html.erb
@@ -3,6 +3,7 @@
 <ul>
 <% @trackers.each do |tracker| %>
   <li>
+    <%= hidden_field_tag "tracker_ids[]", nil, :id => nil %>
     <label>
       <%= check_box_tag("tracker_ids[]", tracker.id,
                         (@selected_tracker_ids.include? tracker.id.to_s),

#4 Updated by Mischa The Evil 29 days ago

Here's a proper patch file, produced by git format-patch, against trunk @ r21200. It includes the diff I posted above and a crude and rudimentary, but functioning system test.

#5 Updated by Go MAEDA 29 days ago

  • Target version set to Candidate for next minor release

#6 Updated by Go MAEDA 29 days ago

  • Target version changed from Candidate for next minor release to Candidate for next major release

#7 Updated by Go MAEDA 25 days ago

  • Target version changed from Candidate for next major release to 5.0.0

The patched behavior is more natural than the current behavior. To me, this is rather a "Defect" than a "Feature".

Setting the target version to 5.0.0.

#8 Updated by Go MAEDA 18 days ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch. Thank you for your contribution.

#9 Updated by Marius BALTEANU 17 days ago

  • Status changed from Closed to Reopened

Mischa, Go, why did you choose a system test for this case? A functional test should be enough to cover this.

Also available in: Atom PDF