Feature #34258
closedCreate tracker by copy
Added by Go MAEDA about 4 years ago. Updated almost 4 years ago.
0%
Description
When there are many custom fields or projects, configuring a new tracker is painful work. Imagine that there are 300 custom fields in your Redmine instance. You have to check/uncheck 300 checkboxes.
It can be mitigated if Redmine has a feature to copy existing tracker. The feature to copy a role is already exists (#9258).
Files
34258-copy-tracker.patch (6.13 KB) 34258-copy-tracker.patch | Takenori TAKAKI, 2020-11-20 09:06 |
Related issues
Updated by Takenori TAKAKI about 4 years ago
- File 34258-copy-tracker.patch 34258-copy-tracker.patch added
I made a patch to copy the tracker and attach it.
I confirmed that this patch works fine on latest trunk@20441.
Updated by Go MAEDA almost 4 years ago
- Target version set to Candidate for next major release
Thank you for posting the patch. I think the following change to the patch is necessary to fix an issue that the selection of "Copy workflow from" is cleared after validation error.
diff --git a/app/views/trackers/_form.html.erb b/app/views/trackers/_form.html.erb
index b7c4b773f..2ccd225e6 100644
--- a/app/views/trackers/_form.html.erb
+++ b/app/views/trackers/_form.html.erb
@@ -39,7 +39,7 @@
<% if @tracker.new_record? && @trackers.any? %>
<p><label for="copy_workflow_from"><%= l(:label_copy_workflow_from) %></label>
-<%= select_tag(:copy_workflow_from, content_tag("option") + options_from_collection_for_select(@trackers, :id, :name, @copy_from.try(:id))) %></p>
+<%= select_tag(:copy_workflow_from, content_tag("option") + options_from_collection_for_select(@trackers, :id, :name, params[:copy_workflow_from] || @copy_from.try(:id))) %></p>
<% end %>
<!--[eoform:tracker]-->
</div>
Updated by Go MAEDA almost 4 years ago
- Target version changed from Candidate for next major release to 4.2.0
Setting the target version to 4.2.0.
Updated by Takenori TAKAKI almost 4 years ago
Go MAEDA wrote:
Thank you for posting the patch. I think the following change to the patch is necessary to fix an issue that the selection of "Copy workflow from" is cleared after validation error.
Thank you for pointing out.
I confirmed that the proposed code solves the problem in case of Validation error.
Updated by Go MAEDA almost 4 years ago
- Related to Feature #841: Ability to copy an existing workflow when creating a new role added
Updated by Go MAEDA almost 4 years ago
- Subject changed from Ability to copy an existing tracker when creating a new tracker to Create tracker by copy
- Description updated (diff)
Updated by Go MAEDA almost 4 years ago
- Related to deleted (Feature #841: Ability to copy an existing workflow when creating a new role)
Updated by Go MAEDA almost 4 years ago
- Related to Feature #9258: Create role by copy added
Updated by Go MAEDA almost 4 years ago
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the patch. Thank you.
Updated by Go MAEDA almost 4 years ago
- Status changed from Closed to Reopened
The test randomly fails due to r20492.
$ bin/rake db:reset RAILS_ENV=test $ bin/rails test test/unit/tracker_test.rb:65 Run options: --seed 57984 # Running: E Error: TrackerTest#test_copy_from_should_copy_custom_fields: ActiveRecord::RecordNotFound: Couldn't find all IssueCustomFields with 'id': (1, 2, 6) [WHERE "custom_fields"."type" IN ('IssueCustomField')] (found 0 results, but was looking for 3). Couldn't find IssueCustomFields with ids 1, 2, 6. test/object_helpers.rb:68:in `generate' test/object_helpers.rb:76:in `generate!' test/unit/tracker_test.rb:66:in `test_copy_from_should_copy_custom_fields' bin/rails test test/unit/tracker_test.rb:65
This can be fixed by adding a fixture.
diff --git a/test/unit/tracker_test.rb b/test/unit/tracker_test.rb
index 1f3447da7..d4b383ea3 100644
--- a/test/unit/tracker_test.rb
+++ b/test/unit/tracker_test.rb
@@ -20,7 +20,7 @@
require File.expand_path('../../test_helper', __FILE__)
class TrackerTest < ActiveSupport::TestCase
- fixtures :trackers, :workflows, :issue_statuses, :roles, :issues, :projects, :projects_trackers, :enabled_modules
+ fixtures :trackers, :workflows, :issue_statuses, :roles, :issues, :custom_fields, :projects, :projects_trackers, :enabled_modules
def setup
User.current = nil
Updated by Takenori TAKAKI almost 4 years ago
Thanks Go MAEDA.
I could also confirm that the test fails in the environment where the database was rebuilt.
As you pointed out, I missed the addition of fixture on my patch.