Ilogeek / redmine_issue_dynamic_edit

Allows users to dynamically update (AJAX) issue's attributes from issue details page without any refresh (JIRA like)
http://www.redmine.org/plugins/redmine_issue_dynamic_edit
MIT License
137 stars 55 forks source link

Plugin doesn't work if Redmine's root directory is not '/' (for example '/redmine') #2

Closed TrumanRu closed 7 years ago

TrumanRu commented 7 years ago

Great idea! But doesn't work for now. Redmine 3.3.3 After selected new value - uninterruptible refresh arrows display. Refreshing Issue displays old value. I'm staying tuned! ;-)

Ilogeek commented 7 years ago

Hello TrumanRu,

The uninterruptible refresh arrows problem appears when the AJAX call to update your issue fails. The last commit add some logs that may appears in your Javascript console when the problem appears and can help us to find a solution.

Is it possible that the user you used to update the value doesn't have the correct permission to edit the issue ? Upgrading your Redmine instance could also be a solution

TrumanRu commented 7 years ago

Permissions were full. It was the administrator of this Redmine instance and the manager of that project. But I think if the user who can't edit exact issue shouln'd see edit controls in it.

I'll add logs later.

TrumanRu commented 7 years ago

After I reinstalled plugin I see different error: "Error (check console)" for 1-2 seconds then value of the field changed to new selected value. But! After I refreshed the page the old value displays.

production.log (ip address, token and login are masqueraded)

Started GET "/redmine/issues/4988" for 256.256.256.256 at 2017-08-18 15:32:31 +0300
Processing by IssuesController#show as HTML
  Parameters: {"id"=>"4988"}
  Current user: tsybanenko.ivan (id=60)
  Rendered issues/_action_menu.html.erb (16.6ms)
  Rendered plugins/redmine_issue_tabs/app/views/redmine_issue_tabs/_blank.html.erb (0.5ms)
  Rendered plugins/redmine_issue_tabs/app/views/redmine_issue_tabs/_timelog.html.erb (2.4ms)
  Rendered common/_tabs.html.erb (6.4ms)
  Rendered plugins/redmine_issue_tabs/app/views/hooks/redmine_issue_tabs/_rm_history_tabs.html.erb (13.2ms)
  Rendered plugins/redmineup_tags/app/views/issues/_tags.html.erb (3.7ms)
  Rendered plugins/status_button/app/views/issues/_status_button.html.erb (20.0ms)
  Rendered plugins/unread_issues/app/views/hooks/unread_isues/_issue_bottom_details.html.erb (1.4ms)
  Rendered plugins/redmine_customize/app/views/customize/_issues_show_description_bottom.html.erb (4.6ms)
  Rendered plugins/redmine_checklists/app/views/issues/_checklist.html.erb (4.1ms)
  Rendered issue_relations/_form.html.erb (4.1ms)
  Rendered issues/_relations.html.erb (7.2ms)
  Rendered issues/_action_menu.html.erb (10.4ms)
  Rendered issues/_form_custom_fields.html.erb (18.8ms)
  Rendered issues/_attributes.html.erb (66.1ms)
  Rendered plugins/redmine_customize/app/views/customize/_issues_form_details_bottom.html.erb (0.5ms)
  Rendered plugins/redmine_serial_number_field/app/views/issues/_remove_serial_number_field.html.erb (0.4ms)
  Rendered plugins/redmineup_tags/app/views/issues/_tags_form.html.erb (2.0ms)
  Rendered plugins/redmine_checklists/app/views/issues/_checklist_fields.html.erb (3.1ms)
  Rendered plugins/redmine_checklists/app/views/issues/_checklist_fields.html.erb (2.7ms)
  Rendered plugins/redmine_checklists/app/views/issues/_checklist_form.html.erb (13.1ms)
  Rendered issues/_form.html.erb (119.8ms)
  Rendered attachments/_form.html.erb (9.8ms)
  Rendered issues/_edit.html.erb (156.4ms)
  Rendered plugins/redmine_contacts/app/views/contacts_issues/_contacts.html.erb (0.8ms)
  Rendered plugins/redmineup_tags/app/views/issues/_tags_sidebar.html.erb (4.5ms)
  Rendered plugins/redmine_project_team/app/views/issues/_team_sidebar.html.erb (0.6ms)
  Rendered issues/_sidebar.html.erb (65.2ms)
  Rendered watchers/_watchers.html.erb (19.2ms)
  Rendered issues/show.html.erb within layouts/base (484.8ms)
  Rendered plugins/a_common_libs/app/views/hooks/a_common_libs/_html_head.html.erb (12.4ms)
  Rendered plugins/ajax_counters/app/views/hooks/ajax_counters/_html_head.html.erb (2.0ms)
  Rendered plugins/custom_menu/app/views/hooks/custom_menu/_html_head.html.erb (3.7ms)
  Rendered plugins/extra_queries/app/views/extra_queries/hooks/_html_head.html.erb (1.8ms)
  Rendered plugins/global_roles/app/views/hooks/global_roles/_head.html.erb (0.7ms)
  Rendered plugins/redmine__select2/app/views/redmine__select2/_includes.html.erb (1.8ms)
  Rendered plugins/redmine_contacts/app/views/contacts_issues/_additional_assets.html.erb (1.0ms)
  Rendered plugins/redmine_customize/app/views/customize/_top_menu.html.erb (0.4ms)
  Rendered plugins/redmine_customize/app/views/customize/_layouts_base_html_head.html.erb (3.1ms)
  Rendered plugins/redmine_editor_preview_tab/app/views/redmine_editor_preview_tab/_redmine_editor_preview_tab_partial.html.erb (2.0ms)
  Rendered plugins/redmine_jstoolbar_ext/app/views/redmine_jstoolbar_ext/_redmine_jstoolbar_ext_partial.html.erb (0.6ms)
  Rendered plugins/redmine_jstoolbar_ext_buttons/app/views/redmine_jstoolbar_ext_buttons/_redmine_jstoolbar_ext_buttons_partial.html.erb (1.7ms)
  Rendered plugins/redmine_jstoolbar_ext_images/app/views/redmine_jstoolbar_ext_images/_redmine_jstoolbar_ext_images_partial.html.erb (1.0ms)
  Rendered plugins/unread_issues/app/views/hooks/unread_isues/_add_css.html.erb (0.7ms)
  Rendered plugins/usability/app/views/hooks/usability/_html_head.html.erb (4.7ms)
  Rendered plugins/clipboard_image_paste/app/views/clipboard_image_paste/_headers.html.erb (1.6ms)
  Rendered plugins/custom_menu/app/views/hooks/custom_menu/_view_layouts_base_body_bottom.erb (0.6ms)
  Rendered plugins/global_roles/app/views/hooks/global_roles/_view_layouts_base_body_bottom.html.erb (0.5ms)
  Rendered plugins/redmine_contacts/app/views/common/_contacts_select2_data.html.erb (1.1ms)
  Rendered plugins/usability/app/views/hooks/usability/_body_bottom.html.erb (0.8ms)
  Rendered plugins/clipboard_image_paste/app/views/clipboard_image_paste/_add_form.html.erb (7.4ms)
Completed 200 OK in 790ms (Views: 608.2ms | ActiveRecord: 107.2ms)
Started PATCH "/redmine/issues/4988" for 256.256.256.256 at 2017-08-18 15:32:41 +0300
Processing by IssuesController#update as HTML
  Parameters: {"utf8"=>"?", "authenticity_token"=>"0123456789012345678901234567890123456789012/012345678901234567890123456789012345678901==", "form_update_triggered_by"=>"", "issue"=>{"is_private"=>"0", "project_id"=>"72", "tracker_id"=>"8", "subject"=>"test 1.1", "description"=>"", "status_id"=>"2", "priority_id"=>"7", "assigned_to_id"=>"60", "category_id"=>"", "fixed_version_id"=>"", "parent_issue_id"=>"4987", "start_date"=>"2017-07-29", "due_date"=>"", "estimated_hours"=>"", "done_ratio"=>"0", "custom_field_values"=>{"3"=>"60", "10"=>"", "4"=>"", "1"=>"", "6"=>"", "11"=>"", "7"=>"", "8"=>"0", "14"=>""}, "tag_list"=>[""], "notes"=>"", "private_notes"=>"0", "lock_version"=>"2"}, "time_entry"=>{"hours"=>"", "activity_id"=>"", "comments"=>""}, "last_journal_id"=>"17025", "commit"=>"Принять", "id"=>"4988"}
  Current user: tsybanenko.ivan (id=60)
= Running shared code for Issue (#4988) "Task #4988: test 1.1"
= Finished running shared code for Issue (#4988) "Task #4988: test 1.1"
= Running before_save custom workflows for Issue (#4988) "Task #4988: test 1.1"
== Running before_save custom workflow "Prevent closing an issue if it has open descendants"
== Running before_save custom workflow "Prevent closing (Resolved or Testing) issue if there is no spent time entries for this issue"
== Running before_save custom workflow "Mandatory field 'Customer priority'"
= Finished running before_save custom workflows for Issue (#4988) "Task #4988: test 1.1"
= Running shared code for Issue (#4987) "Bug #4987: test 1"
= Finished running shared code for Issue (#4987) "Bug #4987: test 1"
= Running before_save custom workflows for Issue (#4987) "Bug #4987: test 1"
== Running before_save custom workflow "Prevent closing an issue if it has open descendants"
== Running before_save custom workflow "Prevent closing (Resolved or Testing) issue if there is no spent time entries for this issue"
== Running before_save custom workflow "Mandatory field 'Customer priority'"
= Finished running before_save custom workflows for Issue (#4987) "Bug #4987: test 1"
= Running after_save custom workflows for Issue (#4987) "Bug #4987: test 1"
= Finished running after_save custom workflows for Issue (#4987) "Bug #4987: test 1"
  Rendered mailer/_issue.text.erb (31.8ms)
  Rendered mailer/issue_edit.text.erb (41.6ms)
  Rendered plugins/usability/app/views/us_mailer_patched_views/mailer/_issue.html.erb (6.9ms)
  Rendered plugins/usability/app/views/us_mailer_patched_views/mailer/issue_edit.html.erb within layouts/rmp_mailer (15.8ms)
= Running after_save custom workflows for Issue (#4988) "Task #4988: test 1.1"
= Finished running after_save custom workflows for Issue (#4988) "Task #4988: test 1.1"
Redirected to http://dev.domain.com/redmine/issues/4988
Completed 302 Found in 682ms (ActiveRecord: 167.9ms)
Started GET "/redmine/issues/4988" for 256.256.256.256 at 2017-08-18 15:32:42 +0300
Processing by IssuesController#show as HTML
  Parameters: {"id"=>"4988"}
  Current user: tsybanenko.ivan (id=60)
  Rendered issues/_action_menu.html.erb (16.2ms)
  Rendered plugins/redmine_issue_tabs/app/views/redmine_issue_tabs/_blank.html.erb (0.6ms)
  Rendered plugins/redmine_issue_tabs/app/views/redmine_issue_tabs/_timelog.html.erb (2.7ms)
  Rendered common/_tabs.html.erb (7.3ms)
  Rendered plugins/redmine_issue_tabs/app/views/hooks/redmine_issue_tabs/_rm_history_tabs.html.erb (14.4ms)
  Rendered plugins/redmineup_tags/app/views/issues/_tags.html.erb (4.3ms)
  Rendered plugins/status_button/app/views/issues/_status_button.html.erb (25.0ms)
  Rendered plugins/unread_issues/app/views/hooks/unread_isues/_issue_bottom_details.html.erb (1.5ms)
  Rendered plugins/redmine_customize/app/views/customize/_issues_show_description_bottom.html.erb (5.1ms)
  Rendered plugins/redmine_checklists/app/views/issues/_checklist.html.erb (4.2ms)
  Rendered issue_relations/_form.html.erb (4.5ms)
  Rendered issues/_relations.html.erb (7.7ms)
  Rendered issues/_action_menu.html.erb (11.4ms)
  Rendered issues/_form_custom_fields.html.erb (20.4ms)
  Rendered issues/_attributes.html.erb (71.1ms)
  Rendered plugins/redmine_customize/app/views/customize/_issues_form_details_bottom.html.erb (0.6ms)
  Rendered plugins/redmine_serial_number_field/app/views/issues/_remove_serial_number_field.html.erb (0.7ms)
  Rendered plugins/redmineup_tags/app/views/issues/_tags_form.html.erb (2.3ms)
  Rendered plugins/redmine_checklists/app/views/issues/_checklist_fields.html.erb (3.5ms)
  Rendered plugins/redmine_checklists/app/views/issues/_checklist_fields.html.erb (2.9ms)
  Rendered plugins/redmine_checklists/app/views/issues/_checklist_form.html.erb (14.8ms)
  Rendered issues/_form.html.erb (131.0ms)
  Rendered attachments/_form.html.erb (5.7ms)
  Rendered issues/_edit.html.erb (164.4ms)
  Rendered plugins/redmine_contacts/app/views/contacts_issues/_contacts.html.erb (0.9ms)
  Rendered plugins/redmineup_tags/app/views/issues/_tags_sidebar.html.erb (4.5ms)
  Rendered plugins/redmine_project_team/app/views/issues/_team_sidebar.html.erb (0.7ms)
  Rendered issues/_sidebar.html.erb (61.2ms)
  Rendered watchers/_watchers.html.erb (8.3ms)
  Rendered issues/show.html.erb within layouts/base (490.9ms)
  Rendered plugins/a_common_libs/app/views/hooks/a_common_libs/_html_head.html.erb (11.8ms)
  Rendered plugins/ajax_counters/app/views/hooks/ajax_counters/_html_head.html.erb (1.6ms)
  Rendered plugins/custom_menu/app/views/hooks/custom_menu/_html_head.html.erb (3.1ms)
  Rendered plugins/extra_queries/app/views/extra_queries/hooks/_html_head.html.erb (1.4ms)
  Rendered plugins/global_roles/app/views/hooks/global_roles/_head.html.erb (0.7ms)
  Rendered plugins/redmine__select2/app/views/redmine__select2/_includes.html.erb (2.0ms)
  Rendered plugins/redmine_contacts/app/views/contacts_issues/_additional_assets.html.erb (1.3ms)
  Rendered plugins/redmine_customize/app/views/customize/_top_menu.html.erb (0.5ms)
  Rendered plugins/redmine_customize/app/views/customize/_layouts_base_html_head.html.erb (3.6ms)
  Rendered plugins/redmine_editor_preview_tab/app/views/redmine_editor_preview_tab/_redmine_editor_preview_tab_partial.html.erb (2.4ms)
  Rendered plugins/redmine_jstoolbar_ext/app/views/redmine_jstoolbar_ext/_redmine_jstoolbar_ext_partial.html.erb (0.6ms)
  Rendered plugins/redmine_jstoolbar_ext_buttons/app/views/redmine_jstoolbar_ext_buttons/_redmine_jstoolbar_ext_buttons_partial.html.erb (1.9ms)
  Rendered plugins/redmine_jstoolbar_ext_images/app/views/redmine_jstoolbar_ext_images/_redmine_jstoolbar_ext_images_partial.html.erb (1.3ms)
  Rendered plugins/unread_issues/app/views/hooks/unread_isues/_add_css.html.erb (0.9ms)
  Rendered plugins/usability/app/views/hooks/usability/_html_head.html.erb (5.2ms)
  Rendered plugins/clipboard_image_paste/app/views/clipboard_image_paste/_headers.html.erb (1.8ms)
  Rendered plugins/custom_menu/app/views/hooks/custom_menu/_view_layouts_base_body_bottom.erb (0.6ms)
  Rendered plugins/global_roles/app/views/hooks/global_roles/_view_layouts_base_body_bottom.html.erb (0.6ms)
  Rendered plugins/redmine_contacts/app/views/common/_contacts_select2_data.html.erb (1.3ms)
  Rendered plugins/usability/app/views/hooks/usability/_body_bottom.html.erb (0.8ms)
  Rendered plugins/clipboard_image_paste/app/views/clipboard_image_paste/_add_form.html.erb (7.7ms)
Completed 200 OK in 788ms (Views: 594.4ms | ActiveRecord: 119.1ms)
Ilogeek commented 7 years ago

Sorry when i spoke about logs in Javascript console i meant from your web browser (eg for chrome)

The AJAX call used to dynamically update the data may display an error in the console that looks like this :

The error message you saw "Error (check console)" come from the plugin (assets/javascripts/issue_dynamic_edit.js) and only appears when the AJAX call has failed. We need to find why, in your case, the call can't be performed correctly. If the error message appears after a dynamic update, logs also appear in your Javascript console until you refresh the page.

At the same time, I've installed a 3.3.3 Redmine version and everything works fine.

Do you try to edit an attribute which will break your workflow ? For example trying to set a specific status that can't be reach before an other status ? Trying to close a parent issue with still opened children issues ?

On the issues list page (eg example.com/projects/example-project/issues), when you right-click on an issue and update an attribute with the contextual menu (changing the status, the priority ...) ; does the modification applies to the issue ?

TrumanRu commented 7 years ago

I've tried to change issue's priority. I don't have any workflow rules for this operation.

In JS console I've got this: responseText: "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">↵<html><head>↵<title>404 Not Found</title>↵</head><body>↵<h1>Not Found</h1>↵<p>The requested URL /joomla/issues/bulk_update was not found on this server.</p>↵<hr>↵<address>Apache/2.2.6 (Fedora) Server at dev.domain.com Port 80</address>↵</body></html>"

Open Redmine by IP: responseText: "<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">↵<html><head>↵<title>404 Not Found</title>↵</head><body>↵<h1>Not Found</h1>↵<p>The requested URL /issues/bulk_update was not found on this server.</p>↵</body></html>"

It's because of root path in my Redmine - /redmine

I just changed line 95 in assets/javascripts/issue_dynamic_edit.js (added /redmine to begin of the string) and for now all works.

Thank you!

TrumanRu commented 7 years ago

Now the right way.

inserted line 136 in lib/details_issue_hooks.rb: o << " var _BASE_REDMINE_PATH = \"#{Redmine::Utils.relative_url_root}\";\n"

changed line 95 in assets/javascripts/issue_dynamic_edit.js: url: _BASE_REDMINE_PATH + '/issues/bulk_update?back_url=%2F&amp;ids%5B%5D=' + _ISSUE_ID + '&amp;issue%5B' + field_name + '%5D=' + field_value,

Ilogeek commented 7 years ago

Thank you a lot for your analysis. 👍 I've updated the plugin with your correction and tested it. Everything looks fine