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
134 stars 56 forks source link

issuse Edit status get JSeror #20

Closed emiestas closed 6 years ago

emiestas commented 6 years ago

in console:

jquery-1.11.1-ui-1.11.0-ujs-3.1.4.js:4 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. send @ jquery-1.11.1-ui-1.11.0-ujs-3.1.4.js:4 issue_dynamic_edit.js:238 -------- Error while updating the issue attribute dynamically -------- issue_dynamic_edit.js:239 xhr data: issue_dynamic_edit.js:240 Object issue_dynamic_edit.js:241 msg data: issue_dynamic_edit.js:242 error issue_dynamic_edit.js:243 error data: issue_dynamic_edit.js:244 DOMException: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'https://redmine.vilnius.lt/issues/bulk_update?back_url=%2Fissues%2F6735&ids%5B%5D=6735&issue%5Bstatus_id%5D=5'. at Object.send (https://redmine.vilnius.lt/javascripts/jquery-1.11.1-ui-1.11.0-ujs-3.1.4.js:4:25549) at Function.ajax (https://redmine.vilnius.lt/javascripts/jquery-1.11.1-ui-1.11.0-ujs-3.1.4.js:4:21302) at issueDynamicUpdate (https://redmine.vilnius.lt/plugin_assets/redmine_issue_dynamic_edit/javascripts/issue_dynamic_edit.js:150:9) at HTMLSelectElement. (https://redmine.vilnius.lt/plugin_assets/redmine_issue_dynamic_edit/javascripts/issue_dynamic_edit.js:259:3) at HTMLSelectElement.dispatch (https://redmine.vilnius.lt/javascripts/jquery-1.11.1-ui-1.11.0-ujs-3.1.4.js:3:8436) at HTMLSelectElement.r.handle (https://redmine.vilnius.lt/javascripts/jquery-1.11.1-ui-1.11.0-ujs-3.1.4.js:3:5139) issue_dynamic_edit.js:245 ----------------------------------------------------------

Ilogeek commented 6 years ago

Hello @emiestas

I tried to reproduce your problem with no success. It looks like you tried to change the status of the issue 6735. This procedure works well on my environment. We will try to figure out the problem together :

emiestas commented 6 years ago

This problem started after 0.4.7 (2017-12-04) this version also when edit status;prioritity date.. yes I have a lot of plugins maybe there are problem :(

image

image

emiestas commented 6 years ago

I found the problem When I swich of https, you plugin work perfect. Where can be problem? image image

Apache config ` server { listen 80; server_name redmine.vilnius.lt;

if ($http_x_forwarded_proto != https) {

return 301 https://$server_name$request_uri;

}

location / {
proxy_pass http://redmine.vilnius.vilnius.lt;

proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }

}

`

Ilogeek commented 6 years ago

Hello @emiestas

Great analysis on your side !

Is your Redmine configured to work on http or https protocol ? (In the Redmine settings : http://www.redmine.org/projects/redmine/wiki/RedmineSettings) It may be a cross origin problem on your server ?

One trick we could try : https://forum.jquery.com/topic/jquery-ajax-post-over-https-not-working

If you edit issue_dynamic_edit.js at line 155, swtiching async: false to async:true ; does it resolve your issue ?

emiestas commented 6 years ago

issue_dynamic_edit.js So i try to change, but it doesn't fix bug. I rol back async: false.

What aoub in console this image it is your plugin error or no?

Ilogeek commented 6 years ago

Did you removed the 2 occurences of async: false ? One more parameter that can interfere on the AJAX request is crossDomain: true that can be removed. If it doesn't work neither it may be then a cross origin problem with the server configuration which results in not allowing AJAX call in https or something like that.

Concerning the JS error you raised, did you have this issue before you edited the file ? If we look at issue_dynamic_edit.js:107 it seems that $('#required_field_array').html() returns undefined in your case and then can't be properly parsed as a JSON string. I'll check for that to add a check on it.

I'll keep you informed as soon as I commit a patch

Ilogeek commented 6 years ago

@timesong did a great work and fixed the JSON parse issue 👍

emiestas commented 6 years ago

So after update in 3.4. version got another Error image

and I can't change the status it is not saved image

image

emiestas commented 6 years ago

Ok, downgreid your version it works

Ilogeek commented 6 years ago

Hello @emiestas

Thank you for your feedback. My last commit provides a fix for your JS issue ("outerHTML of undefined"). You can now upgrade to the last version and get the Custom Fields support.

I'm happy to see that you solved your server (and https requests) problem. May I ask you what was the solution for this issue ?

If you find the plugin helpful, please take a minute to star it on Github and rate it on http://www.redmine.org/plugins/redmine_issue_dynamic_edit 👍 Thank you for your help

emiestas commented 6 years ago

I change apache settings and rolback this version 0.4.8 (2017-12-14)

Sets header transfer prom proxy to backend server

    proxy_redirect    default;
        proxy_set_header  Host               $host;
        proxy_set_header  X-Real-IP          $remote_addr;
        proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header  X-Forwarded-Proto  https;
        fastcgi_read_timeout 6000;

Simple requests

if ($request_method ~* "(GET|POST)") {
  add_header "Access-Control-Allow-Origin"  *;
}

Preflighted requests

if ($request_method = OPTIONS ) {
  add_header "Access-Control-Allow-Origin"  *;
  add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, HEAD";
  add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept";
  return 200;
}