プロジェクト

全般

プロフィール

Vote #80862

完了

Bulk addition of related issues

Admin Redmine さんが約4年前に追加. 約4年前に更新.

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

0%

予定工数:
category_id:
2
version_id:
152
issue_org_id:
33418
author_id:
399232
assigned_to_id:
107353
comments:
24
status_id:
5
tracker_id:
2
plus1:
1
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

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.

example


journals

+1. I miss this feature so much...
--------------------------------------------------------------------------------

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

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

--------------------------------------------------------------------------------
I tried out the patch and found it really nice.

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

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

--------------------------------------------------------------------------------
Updated the second patch to include a test.

Let's discuss this for version:"4.2.0".
--------------------------------------------------------------------------------
Committed the patch. Thank you for improving Redmine.
--------------------------------------------------------------------------------

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

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

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

--------------------------------------------------------------------------------
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@):

<pre><code class="ruby">
post(
'/issues/2/relations.xml',
:params => {:relation => {:issue_to_id => "7, 8", :relation_type => 'relates'}}
)
</code></pre>

I think we should accept also an array of ids:
<pre><code class="ruby">
post(
'/issues/2/relations.xml',
:params => {:relation => {:issue_to_id => [7, 8], :relation_type => 'relates'}}
)
</code></pre>

The attached patch allows this.

*2. Response:*
Currently, the response contain only the latest relation added:
<pre>
{
"relation": {
"id": 107,
"issue_id": 2,
"issue_to_id": 8,
"relation_type": "relates",
"delay": null
}
}
</pre>

I think the response should contain all the created relations:
<pre>
{
"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
}
]
}
</pre>

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:
<pre>
{
"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",
]
}
</pre>

Any feedback is welcome!

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

--------------------------------------------------------------------------------
We will postpone the fixes for API to another version.
--------------------------------------------------------------------------------
hi everyone! I am the owner of redmine-java-api project (https://github.com/taskadapter/redmine-java-api).
I get a server error with Redmine 4.2.0 when trying to create a relation with the request body that previously worked for Redmine 3.x:

<pre>
{"relation"=>{"issue_to_id"=>576, "relation_type"=>"relates"}, "issue_id"=>"575"}

</pre>

the error is:

<pre>
NoMethodError (undefined method `split' for 576:Integer):

</pre>

because *issue_to_id* is now expected to be a string with commas, instead of a number.

is this a permanent change or just an experiment? it would be too expensive to maintain compatibility for multiple redmine versions in the java library.
--------------------------------------------------------------------------------
side note - if Redmine REST API supported returning some "server info", the clients could at least choose what json blob to send (for redmine 3.x, 4.x, etc). but since this is not supported, there is no good way to support several redmine REST formats in clients.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Thanks Alex Last for reporting this issue. It's a defect, I've created #35039 to track this, the fix will be available in version:"4.2.1".
--------------------------------------------------------------------------------

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


related_issues

relates,New,29272,Create several relations at the same time via Issue Relations API
relates,Closed,35039,API create issue relation method returns undefined method `split' when issue id is sent as integer
relates,Closed,35655,Create duplicated follows relations fails with 500 internal error

Admin Redmine さんが約4年前に更新

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

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

いいね!0
いいね!0