Feature #27988

Option to configure which trackers can be set as subtasks for each tracker

Added by Marius BALTEANU almost 2 years ago. Updated 26 days ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:Marius BALTEANU% Done:

0%

Category:Issues workflow
Target version:4.2.0
Resolution:

Description

A few months after we started using Redmine in Zitec, we developed the Redmine Restrict Tracker plugin which allows us to configure which trackers can be set as subtasks for each tracker.

Why we did the plugin?
We started with the following standard (for Agile development) trackers:
1. Epic
2. User Story
3. Task
4. Bug

After a few months, we observed a lot of mistakes made by our users: Epics having subtasks another Epics, Tasks having subtasks User Stories and so on.
Then we decide to create this plugin to restrict the subtasks to specific relations: Epics only with User Story trackers as subtasks, User Story only with Task and Bug trackers as subtasks, etc..

Current settings
The current workflow settings allows you to configure only if a tracker can/must be or not a subtasks (by making the field Parent task Read only, Required or Optional).

Because I find this feature very useful and a missing piece from the already powerful workflow settings, I've started work to a patch that implements this feature in the following way (different by the implementation from the plugin which has his own issues):


According to the settings from the image, the Feature tracker can have as subtasks only issues with Bug and Support trackers.

Please let me know what you think about this feature and the proposed implementation.

subtasks.png (146 KB) Marius BALTEANU, 2018-01-14 17:15

0002-Add-subtask-link-should-open-the-new-issue-form-with.patch Magnifier (6.87 KB) Marius BALTEANU, 2018-05-01 14:26

0003-Auto-complete-should-propose-only-valid-parents.patch Magnifier (4.01 KB) Marius BALTEANU, 2018-05-01 14:28

0001-Option-to-configure-which-trackers-can-be-set-as-sub.patch Magnifier (55 KB) Marius BALTEANU, 2018-05-05 22:52

subtask_only.png (57.9 KB) Marius BALTEANU, 2019-06-26 00:37

workflow_subtask_only.png (226 KB) Marius BALTEANU, 2019-06-26 00:39

0002-Add-subtask-link-should-open-the-new-issue-form-with-v2.patch Magnifier - The modified patch (6.91 KB) Andrea Bonadei, 2019-11-15 12:03


Related issues

Related to Redmine - Feature #29470: Possibility to mark tracker as "Subtask only" Reopened

History

#1 Updated by Marius BALTEANU almost 2 years ago

  • Category set to Issues workflow

#2 Updated by Shreyas Moolya almost 2 years ago

+1 Even I agree with this feature with my company having the same workflow with an Agile Environment,

Users add tasks with parent as tasks which makes no meaning since tasks should be as subtasks in a User story and not any task.

#3 Updated by Go MAEDA almost 2 years ago

I am in favor of this feature and looking forward to the patch.

This enhancement can enforce team members to make proper parent-child relations. I think both subtasking and workflow are the strong point of Redmine. This enhancement makes the strength more powerful.

#4 Updated by Marius BALTEANU over 1 year ago

Attached 3 patches for this feature:

1. 0001-Option-to-configure-which-trackers-can-be-set-as-sub.patch
  • Adds the possibility for admins to configure in the tracker page which trackers can be set as subtasks
  • Trackers with the parent field disabled are rendered as disabled in the subtasks section
  • When the parent field is disabled for a tracker, all the relations that contain the respective tracker as subtask are removed. In this way, we keep only valid relations and we avoid to check every time if the parent field is enabled or not
  • In order to not change the current behaviour, all trackers can have as subtasks all trackers (by default).
  • On save, parent tracker relation is validated.
2. 0002-Add-subtask-link-should-open-the-new-issue-form-with.patch
  • The subtasks section is not shown if the issue has no subtasks and the issue cannot have anymore any subtask
  • The new issue page opened from the Add subtask link take into consideration only valid parent - subtask relations.
3. 0003-Auto-complete-should-propose-only-valid-parents.patch
  • The auto complete for parent task field propose only issues that can be a valid parent.

Any feedback is really appreciated because I've tested the patches only on my local environment. For sure, there are some things that can be improved.

#5 Updated by Go MAEDA over 1 year ago

Thank you for posting the patch. But I encountered the following error when I tried to open "New issue" page.

ActionView::Template::Error (undefined local variable or method `preview_text_path' for #<#<Class:0x007fd85add6aa0>:0x007fd85adc7c80>
Did you mean?  preview_news_path
               preview_issue_path):
    37:                    :no_label => true %>
    38:   <% end %>
    39: </p>
    40: <%= wikitoolbar_for 'issue_description' %>
    41: <% end %>
    42:
    43: <div id="attributes" class="attributes">

lib/redmine/wiki_formatting/markdown/helper.rb:22:in `wikitoolbar_for'
app/views/issues/_form.html.erb:40:in `block in _app_views_issues__form_html_erb___2543741584618465749_70283606699800'
.
.
.

#6 Updated by Marius BALTEANU over 1 year ago

Go MAEDA wrote:

Thank you for posting the patch. But I encountered the following error when I tried to open "New issue" page.

[...]

I'm receiving the same errors when I apply/revert the patches from #27758 and I don't restart the webserver. Can you try restarting your webserver?

#7 Updated by Go MAEDA over 1 year ago

Marius BALTEANU wrote:

I'm receiving the same errors when I apply/revert the patches from #27758 and I don't restart the webserver. Can you try restarting your webserver?

You are right, I made an elementary mistake. Sorry.

#8 Updated by Go MAEDA over 1 year ago

I saw a confusing behavior of the patch.

Assume that an issue has some subtasks. And then a user disabled all subtask trackers for the tracker of the parent issue. The user can no longer add subtasks for the parent issue. This is an expected behavior.

But at the same time, the user cannot update any existing subtasks of the parent issue without removing the parent task. It is confusing behavior for me. I think existing parent - subtasks relations should be kept even after the subtask trackers setting is changed.

#9 Updated by Marius BALTEANU over 1 year ago

Go MAEDA wrote:

You are right, I made an elementary mistake. Sorry.

Don't worry, we all do.

Go MAEDA wrote:

But at the same time, the user cannot update any existing subtasks of the parent issue without removing the parent task. It is confusing behavior for me. I think existing parent - subtasks relations should be kept even after the subtask trackers setting is changed.

Agree with you, we should validate the relation only on change. I've fixed this behaviour in the attached patch.

#10 Updated by Marius BALTEANU over 1 year ago

  • File deleted (0001-Option-to-configure-which-trackers-can-be-set-as-sub.patch)

#11 Updated by Go MAEDA over 1 year ago

  • Target version set to 4.1.0

It looks good, setting target version to 4.1.0.

#12 Updated by Go MAEDA over 1 year ago

  • Assignee set to Jean-Philippe Lang

#13 Updated by Marius BALTEANU over 1 year ago

  • Duplicated by Feature #29470: Possibility to mark tracker as "Subtask only" added

#14 Updated by Kamil . over 1 year ago

Adding my two cents (as my feature request was considered as duplicate of this one)

There are some types of trackers (like "Story Blocker" or "Subtask") which makes sense only when it is a subtask.
Therefore I suggest adding additional checkbox "Subtask only" while creating new tracker.
When checked, new item can be created only as a Subtask, or in other words - the tracker must not be top-level tracker

#15 Updated by Marius BALTEANU over 1 year ago

  • Duplicated by deleted (Feature #29470: Possibility to mark tracker as "Subtask only")

#16 Updated by Marius BALTEANU over 1 year ago

  • Related to Feature #29470: Possibility to mark tracker as "Subtask only" added

#17 Updated by Jean-Philippe Lang 6 months ago

  • Target version changed from 4.1.0 to 4.2.0

Kamil . wrote:

Adding my two cents (as my feature request was considered as duplicate of this one)

There are some types of trackers (like "Story Blocker" or "Subtask") which makes sense only when it is a subtask.
Therefore I suggest adding additional checkbox "Subtask only" while creating new tracker.
When checked, new item can be created only as a Subtask, or in other words - the tracker must not be top-level tracker

I think it really makes sense to support this behaviour along with this feature.

#18 Updated by Marius BALTEANU 6 months ago

Jean-Philippe Lang wrote:

Kamil . wrote:

Adding my two cents (as my feature request was considered as duplicate of this one)

There are some types of trackers (like "Story Blocker" or "Subtask") which makes sense only when it is a subtask.
Therefore I suggest adding additional checkbox "Subtask only" while creating new tracker.
When checked, new item can be created only as a Subtask, or in other words - the tracker must not be top-level tracker

I think it really makes sense to support this behaviour along with this feature.

I can try to add this checkbox, but I’m a little bit worried about the complexity because in order to not confuse the admin users, we need also to modify in the Workflow -> Fields permissions the Parent Task field to be required and not editable for the users for those trackers that are marked as “Subtask only”. Is this ok?

#19 Updated by Marius BALTEANU 6 months ago

I was able to mark in the workflow the "Parent task" field as mandatory when the tracker is a subtask only (screenshots attached), but how we should handle the case when the user edits a workflow for multiple trackers (both subtask only and not subtask)? Should we add a warning?

#20 Updated by Dong Phan about 1 month ago

Hi Marius,

Thank you for the great patch! But I encounter a bug. I have the following setup: Tracker "Parent" has 2 possible subtasks "Child 1" and "Child 2".
When I add subtask from a "Parent" issue, the subtask's tracker automatically default to "Child 1", choosing "Child 2" will change it back to "Child 1", resulting not able to change tracker.
I found that in patch 2, I had to comment out this line from issues_helper.rb:
issue.tracker_id = trackers.detect{|t| t.id == parent_tracker_id} ? parent_tracker_id : trackers.first
and it fixes for me

#21 Updated by Marius BALTEANU about 1 month ago

  • Assignee changed from Jean-Philippe Lang to Marius BALTEANU

#22 Updated by Andrea Bonadei 26 days ago

Dong Phan wrote:

Hi Marius,

Thank you for the great patch! But I encounter a bug. I have the following setup: Tracker "Parent" has 2 possible subtasks "Child 1" and "Child 2".
When I add subtask from a "Parent" issue, the subtask's tracker automatically default to "Child 1", choosing "Child 2" will change it back to "Child 1", resulting not able to change tracker.
I found that in patch 2, I had to comment out this line from issues_helper.rb:
issue.tracker_id = trackers.detect{|t| t.id == parent_tracker_id} ? parent_tracker_id : trackers.first
and it fixes for me

Hi, I had the same problem as you did and I resolved it by adding an unless modifier:

issue.tracker_id = trackers.detect{|t| t.id == parent_tracker_id} ? parent_tracker_id : trackers.first unless params['issue']['tracker_id'].present?

In this way when you try to create a subtask it autofills the tracker_id but when you change it again it won't.
Attached is the modified patch file.

Also available in: Atom PDF