プロジェクト

全般

プロフィール

Vote #79232

完了

Query links for subtasks on issue page

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Issues_2
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
2
version_id:
152
issue_org_id:
28471
author_id:
115781
assigned_to_id:
332
comments:
32
status_id:
5
tracker_id:
2
plus1:
2
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

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.


journals

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.
--------------------------------------------------------------------------------
+1 - I would dearly love this.
--------------------------------------------------------------------------------
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.

<pre>
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;
</pre>
--------------------------------------------------------------------------------
This patch implements Ewan's proposal. It's quite convenient to filter subtasks this way. Good idea!

--------------------------------------------------------------------------------
here's how it looks now...

!{border: 1px solid #ccc;}subtask_query_links.png!
--------------------------------------------------------------------------------
+1, it's a green light from me ;-)
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
I reworked a little bit the patch proposed by Bernhard:

!subtasks.png!

What do you think?
--------------------------------------------------------------------------------
IMHO, it looks like a nice improvement. :-)
--------------------------------------------------------------------------------
I've added a new patch with Marius' improvements. In my opinion it would be a nice improvement to ship with version:4.2.0. What do you think?
--------------------------------------------------------------------------------
Bernhard Rohloff wrote:
> I've added a new patch with Marius' improvements. In my opinion it would be a nice improvement to ship with version: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.

!{width: 600px; border: 1px solid #ccc;}.clipboard-202011051408-i3dmb.png!

However, after you click the "2 open" link, the issues list displays only *1* issue.

!{width: 600px; border: 1px solid #ccc;}.clipboard-202011051409-nusza.png!
--------------------------------------------------------------------------------
Maybe #28471#note-11 can be fixed by using "contains" operator instead of "is" operator.
--------------------------------------------------------------------------------
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. :-)
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
Committed the patch. Thank you for your contribution.
--------------------------------------------------------------------------------
We should add some functional tests.
--------------------------------------------------------------------------------
Here's some test code. Since I'm not very used to rails testing, I'm not sure if it's sufficient enough.

<pre><code class="diff">
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!(
</code>
</pre>
--------------------------------------------------------------------------------
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

I took the liberty to rewrite a little bit the current implementation in order to:
* 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

!{border: 1px solid grey; widht:80%}.subtasks_v2.png!
--------------------------------------------------------------------------------
Some tests fail on Postgres and Sql server.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
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 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.

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
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 attachment:0001-Include-only-visible-issues-in-subtasks-stats.patch but the test fails if you run it with Ruby 2.4.

<pre>
$ 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

..............................
</pre>

This is because @issue_path@ method returns a different value depending on the version of Ruby.

<pre><code class="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"
</code></pre>
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Committed attachment:0001-Include-only-visible-issues-in-subtasks-stats.patch and attachment:0002-Unescape-href-values-before-asserting.patch in r20718.

Thank you for providing the fixes and improvements.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------


related_issues

relates,Closed,35559,Query links for related issues on issue page

Admin Redmine さんが3年以上前に更新

  • カテゴリIssues_2 にセット
  • 対象バージョン4.2.0_152 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0