Feature #33418
Bulk addition of related issues
Status: | Reopened | Start date: | ||
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | - | % Done: | 0% | |
Category: | Issues | |||
Target version: | 4.2.0 | |||
Resolution: | Fixed |
Description
Sometimes you need to add a lot of relations to an issue and it's getting really hard when there're 50 or more relations.
The patch provides bulk create for relations. Fill an input field with ids (delimited with comma) and press form's button.
Related issues
Associated revisions
Bulk addition of related issues (#33418).
Patch by Dmitry Makurin and Marius BALTEANU.
Allow issue relation autocomplete to select multiple values (#33418).
Patch by Marius BALTEANU.
History
#1
Updated by Robert Korulczyk 8 months ago
+1. I miss this feature so much...
#3
Updated by Go MAEDA 7 months ago
- Related to Feature #29272: Create several relations at the same time via Issue Relations API added
#6
Updated by Go MAEDA 3 months ago
Go MAEDA wrote:
The only one small issue of the patch is that issue auto-complete feature does not work. But I think we can resolve it by using Tribute.js which is used for inline auto complete feature (#31989).
I realized that implementing the feature with Tribute.js is not so easy because the auto-complete should be triggered without typing a preceding "#" in the related issues section.
Now I think it is OK even if the feature does not support auto-comple for multiple issue ids because it is a trivial matter compared to the usefulness of this feature.
#7
Updated by Marius BALTEANU about 1 month ago
- Assignee set to Marius BALTEANU
#8
Updated by Marius BALTEANU about 1 month ago
- File 0002-Allow-issue-relation-autocomplete-to-select-multiple.patch added
- File 0001-Rework-patch-from-33418.patch
added
Dmitry, thanks for posting the patch. I find this feature really useful.
Regarding your proposed solution, I don't think that it's a good ideea to remove the validation from the model because it will allow setting a non visible issue if you by-pass the controller (from a plugin, for example).
I'm attaching two patches:
1. 0001-Rework-patch-from-33418.patch
Based on the existing patch, but keeping the validation in the model and also fixes some edge-case bugs (for ex: no error if you press Add without typing the issue id).
2. 0002-Allow-issue-relation-autocomplete-to-select-multiple
Adds a new JS autocomplete function that allows searching for multiple values. If the solution is good enough, I'll add a system test for it.
#9
Updated by Go MAEDA about 1 month ago
Marius, thank you for improving the patch. I tried out the patches #33418#note-8 and found they are really nice.
Marius BALTEANU wrote:
2. 0002-Allow-issue-relation-autocomplete-to-select-multiple
Adds a new JS autocomplete function that allows searching for multiple values. If the solution is good enough, I'll add a system test for it.
I didn't feel strange compared to the autocomplete in Redmine 4.1.0.
#10
Updated by Marius BALTEANU about 1 month ago
- File deleted (
0002-Allow-issue-relation-autocomplete-to-select-multiple.patch)
#11
Updated by Marius BALTEANU about 1 month ago
- File 0002-Allow-issue-relation-autocomplete-to-select-multiple.patch
added
- Assignee deleted (
Marius BALTEANU) - Target version changed from Candidate for next major release to 4.2.0
Updated the second patch to include a test.
Let's discuss this for 4.2.0.
#13
Updated by Go MAEDA 25 days ago
- Related to deleted (Feature #29272: Create several relations at the same time via Issue Relations API)
#14
Updated by Go MAEDA 25 days ago
- Duplicated by Feature #29272: Create several relations at the same time via Issue Relations API added
#15
Updated by Go MAEDA 25 days ago
- Duplicated by deleted (Feature #29272: Create several relations at the same time via Issue Relations API)
#16
Updated by Go MAEDA 25 days ago
- Related to Feature #29272: Create several relations at the same time via Issue Relations API added
#17
Updated by Marius BALTEANU 23 days ago
- File accept_issue_to_id_as_array.patch
added
- Status changed from Closed to Reopened
- Assignee deleted (
Go MAEDA)
I'm reopening this to discuss about the API part which is not implemented 100% correctly.
1. Request:
Currently, for bulk addition of related issues, the request should contains the ids as comma-delimited string, please see the below example (param issue_to_id
):
post(
'/issues/2/relations.xml',
:params => {:relation => {:issue_to_id => "7, 8", :relation_type => 'relates'}}
)
I think we should accept also an array of ids:
post(
'/issues/2/relations.xml',
:params => {:relation => {:issue_to_id => [7, 8], :relation_type => 'relates'}}
)
The attached patch allows this.
2. Response:
Currently, the response contain only the latest relation added:
{ "relation": { "id": 107, "issue_id": 2, "issue_to_id": 8, "relation_type": "relates", "delay": null } }
I think the response should contain all the created relations:
{ "relations": [ { "id": 114, "issue_id": 2, "issue_to_id": 7, "relation_type": "relates", "delay": null }, { "id": 115, "issue_id": 2, "issue_to_id": 8, "relation_type": "relates", "delay": null } ] }
but I'm not sure how to handle the case when the response contain both successfully created relations and non-successfully relations. From what I know, we don't have this kind of mixed API response in Redmine.
I see two options:
1. We change the current implementation to be transactional. In this way, we reject the entire request if an error occurs.
2. We respond with succes if at least one relation was created successfully and we append the error messages to the response:
{ "relations": [ { "id": 114, "issue_id": 2, "issue_to_id": 7, "relation_type": "relates", "delay": null }, { "id": 115, "issue_id": 2, "issue_to_id": 8, "relation_type": "relates", "delay": null } ], "errors": [ "Related issue has already been taken: #3", ] }
Any feedback is welcome!