Feature #28471
closedQuery links for subtasks on issue page
0%
Description
The header on issue page "Subtasks" list issues, in some way, with some defaults columns. It would be very helpful if the section header could be clickable link to issue queries showing those issues:
- Subtasks should link to issue query with filter parent "contains" the issue number
It would be good to have same thing for "Related issues" but there seems to be no filter allowing to show all types of relations.
Files
Related issues
Updated by Go MAEDA over 6 years ago
It is a nice idea. Many people have requested to add more columns to the list of subtasks and related issues. It will be the solution to the request if we can move to the issues list with one click.
Updated by Ewan Makepeace about 5 years ago
Specofically whjen I am in the Roadmap I can jump from the simple list of issues in a target verson such as:
http://www.redmine.org/versions/127
To a query on either All Issues:
http://www.redmine.org/projects/redmine/issues?fixed_version_id=127&set_filter=1&status_id=%2A
Or just Open or Closed. This is hugely useful as I can then sort, group and filter to get the answers I need.
However when subtasks are grouped under a parent task there is no shortcut. I can search all issues by Parent (which is often enough) but:
- I would like to see this as a shortcut on the issue page (just above subtasks)
- I often have nested groups of tasks and so really want to see all subtasks and not just those that are a direct child of the current task.
SELECT i.* FROM issues i JOIN issues p ON p.root_id = i.root_id AND p.lft<i.lft AND p.rgt>i.rgt WHERE p.id = @PARENT_ID;
Updated by Bernhard Rohloff about 5 years ago
This patch implements Ewan's proposal. It's quite convenient to filter subtasks this way. Good idea!
Updated by Bernhard Rohloff about 5 years ago
- File subtask_query_links.png subtask_query_links.png added
here's how it looks now...
Updated by Go MAEDA almost 5 years ago
- Target version set to Candidate for next major release
Updated by Marius BĂLTEANU over 4 years ago
- File subtasks.png subtasks.png added
I reworked a little bit the patch proposed by Bernhard:
What do you think?
Updated by Bernhard Rohloff over 4 years ago
IMHO, it looks like a nice improvement. :-)
Updated by Bernhard Rohloff about 4 years ago
I've added a new patch with Marius' improvements. In my opinion it would be a nice improvement to ship with 4.2.0. What do you think?
Updated by Go MAEDA almost 4 years ago
- File clipboard-202011051408-i3dmb.png clipboard-202011051408-i3dmb.png added
- File clipboard-202011051409-nusza.png clipboard-202011051409-nusza.png added
Bernhard Rohloff wrote:
I've added a new patch with Marius' improvements. In my opinion it would be a nice improvement to ship with 4.2.0. What do you think?
Thank you for updating the patch. I think the feature is nice but the number of open/closed issues and filtered issues don't not match if subtasks has its subtasks (grand child).
See the example below. The issue has a subtask (#15 "child"). And the subtask has a subtask (#16 "grand child"). Redmine says that there are 2 open issues.
However, after you click the "2 open" link, the issues list displays only 1 issue.
Updated by Go MAEDA almost 4 years ago
Maybe #28471#note-11 can be fixed by using "contains" operator instead of "is" operator.
Updated by Bernhard Rohloff almost 4 years ago
- File query_links_for_subtasks_marius_flavor_V2.diff query_links_for_subtasks_marius_flavor_V2.diff added
Thank you Maeda san for testing my patch. Here's a slightly better version of my previous patch including your suggestion. It's indeed better to do it this way. :-)
Updated by Go MAEDA almost 4 years ago
- Target version changed from Candidate for next major release to 4.2.0
Bernhard Rohloff wrote:
Thank you Maeda san for testing my patch. Here's a slightly better version of my previous patch including your suggestion. It's indeed better to do it this way. :-)
Thank you for updating the patch. The patch now looks good. Setting the target to 4.2.0.
Updated by Go MAEDA almost 4 years ago
- Subject changed from Make "Subtasks" section headers a links to issue query to Query links for subtasks on issue page
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the patch. Thank you for your contribution.
Updated by Marius BĂLTEANU almost 4 years ago
- Status changed from Closed to Reopened
We should add some functional tests.
Updated by Bernhard Rohloff almost 4 years ago
Here's some test code. Since I'm not very used to rails testing, I'm not sure if it's sufficient enough.
Index: test/functional/issues_controller_test.rb =================================================================== --- test/functional/issues_controller_test.rb (Revision 20333) +++ test/functional/issues_controller_test.rb (Arbeitskopie) @@ -2299,6 +2299,49 @@ end end + def test_show_should_show_subtasks_links_to_queries + child = Issue. + create!( + :project_id => 1, :author_id => 1, :tracker_id => 1, + :parent_issue_id => 1, :subject => 'Child issue' + ) + get(:show, :params => {:id => 1}) + assert_response :success + assert_select 'div#issue_tree' do + assert_select 'p' do + assert_select 'a', :text => '1 issue' + assert_select 'a', :text => '1 open' + end + end + Issue. + create!( + :project_id => 1, :author_id => 1, :tracker_id => 1, + :parent_issue_id => child.id, :subject => 'Child of child' + ) + get(:show, :params => {:id => 1}) + assert_response :success + assert_select 'div#issue_tree' do + assert_select 'p' do + assert_select 'a', :text => '2 issues' + assert_select 'a', :text => '2 open' + end + end + Issue. + create!( + :project_id => 1, :author_id => 1, :tracker_id => 1, + :parent_issue_id => 1, :status_id => 5, :subject => 'Closed child issue' + ) + get(:show, :params => {:id => 1}) + assert_response :success + assert_select 'div#issue_tree' do + assert_select 'p' do + assert_select 'a', :text => '3 issues' + assert_select 'a', :text => '2 open' + assert_select 'a', :text => '1 closed' + end + end + end + def test_show_should_list_parents issue = Issue. create!(
Updated by Marius BĂLTEANU almost 4 years ago
- File subtasks.png added
- File 0001-Include-only-visible-issues-in-subtasks-stats.patch added
Thanks Bernhard for the tests.
Reviewing them, I found out that the current implementation has two issues:- issue visibility is not checked
- there are quite many queries to get the subtasks
- fix the issue visibility
- get subtasks using one query by grouping them
- move the entire logic from view to helper
- change the layout to show the subtasks count as badge
- finalise the tests
Updated by Marius BĂLTEANU almost 4 years ago
- Assignee changed from Go MAEDA to Marius BĂLTEANU
Some tests fail on Postgres and Sql server.
Updated by Marius BĂLTEANU almost 4 years ago
- File deleted (
0001-Include-only-visible-issues-in-subtasks-stats.patch)
Updated by Marius BĂLTEANU almost 4 years ago
- File 0001-Include-only-visible-issues-in-subtasks-stats.patch 0001-Include-only-visible-issues-in-subtasks-stats.patch added
- Assignee deleted (
Marius BĂLTEANU)
I've fixed the issue by casting the values returned from the database to boolean. Now the tests pass on all three database types: https://gitlab.com/redmine-org/redmine/-/pipelines/225982433
Updated by Marius BĂLTEANU almost 4 years ago
- File subtasks_v2.png subtasks_v2.png added
Updated by Bernhard Rohloff almost 4 years ago
- Assignee set to Marius BĂLTEANU
Thank you Marius for reviewing and improving my work. I really like the badge style.
BTW my implementation was shamelessly copied from the versions/_overview partial found in the roadmap. So we may have room for improvements over there, too.
Updated by Bernhard Rohloff almost 4 years ago
- Assignee deleted (
Marius BĂLTEANU)
Updated by Go MAEDA almost 4 years ago
Marius BALTEANU wrote:
I've fixed the issue by casting the values returned from the database to boolean. Now the tests pass on all three database types: https://gitlab.com/redmine-org/redmine/-/pipelines/225982433
Thank you for posting the 0001-Include-only-visible-issues-in-subtasks-stats.patch but the test fails if you run it with Ruby 2.4.
$ ruby test/functional/issues_controller_test.rb Run options: --seed 49701 # Running: ......................F Failure: IssuesControllerTest#test_show_should_show_subtasks_stats [test/functional/issues_controller_test.rb:2354]: Expected at least 1 element matching "span.open a[href="/issues?parent_id=~1&set_filter=true&status_id=o"]", found 0.. Expected 0 to be >= 1. bin/rails test test/functional/issues_controller_test.rb:2343 ....................................S..............................................................................................................................................S.....................................................................................................................................................S....................................F Failure: IssuesControllerTest#test_show_subtasks_stats_should_not_link_if_issue_has_zero_open_or_closed_subtasks [test/functional/issues_controller_test.rb:2367]: Expected at least 1 element matching "span.open a[href="/issues?parent_id=~1&set_filter=true&status_id=o"]", found 0.. Expected 0 to be >= 1. bin/rails test test/functional/issues_controller_test.rb:2361 ..............................
This is because issue_path
method returns a different value depending on the version of Ruby.
# Ruby 2.4
(byebug) issues_path(parent_id: "~1", set_filter: true)
"/issues?parent_id=%7E1&set_filter=true"
# Ruby 2.5 or later
(byebug) issues_path(parent_id: "~1", set_filter: true)
"/issues?parent_id=~1&set_filter=true"
Updated by Marius BĂLTEANU almost 4 years ago
- File 0002-Unescape-href-values-before-asserting.patch 0002-Unescape-href-values-before-asserting.patch added
- Assignee changed from Marius BĂLTEANU to Go MAEDA
Can you try on Ruby 2.4 using the attached patch, please? It should pass now. If still doesn't, I will create a local environment with 2.4.
Updated by Go MAEDA almost 4 years ago
- Assignee changed from Go MAEDA to Marius BĂLTEANU
Marius BALTEANU wrote:
Can you try on Ruby 2.4 using the attached patch, please? It should pass now.
Thank you, I confirmed that there is no test failure with 2.4.
Updated by Go MAEDA almost 4 years ago
- Assignee changed from Marius BĂLTEANU to Go MAEDA
Updated by Go MAEDA almost 4 years ago
- Status changed from Reopened to Closed
Committed 0001-Include-only-visible-issues-in-subtasks-stats.patch and 0002-Unescape-href-values-before-asserting.patch in r20718.
Thank you for providing the fixes and improvements.
Updated by Go MAEDA about 3 years ago
- Related to Feature #35559: Query links for related issues on issue page added