mikitex70 / redmine_drawio

Macro plugin to embed draw.io diagrams into Redmine wiki pages
MIT License
121 stars 51 forks source link

When I add digarms to some old tasks, Page is staying in "loading' and when page is refreshed, it comes to old stage #93

Closed abeeshmp closed 3 years ago

abeeshmp commented 3 years ago

When I try to have a new diagram or edit a existing diagram in an old redmine issue, then I am not able to do it. The issue page stays in 'Loading message' for long time once I press on submit button.

When I looked into the redmine files/ folder, the new edit is getting saved as new file, but when I checked the database table 'attachement' the new attachement is not mapped to any tasks, its field container_id is NULL.

Could you pleaes help me to solve the issue.

abeeshmp commented 3 years ago

Adding some more information,

IF I edit a diagaram in a newer task and save , then I am getting following lines in the log,

192.168.16.12 - - [13/May/2021:11:31:35 IST] "POST /uploads.json?filename=test_7.png HTTP/1.1" 201 104 http://192.168.5.100:3000/issues/21878 -> /uploads.json?filename=test_7.png 192.168.16.12 - - [13/May/2021:11:31:36 IST] "GET /issues/21878.json?include=journals HTTP/1.1" 200 89467 http://192.168.5.100:3000/issues/21878 -> /issues/21878.json?include=journals 192.168.16.12 - - [13/May/2021:11:31:37 IST] "PUT /issues/21878.json HTTP/1.1" 200 0 http://192.168.5.100:3000/issues/21878 -> /issues/21878.json

But when am editing diagram in an older task and save, then am getting following lines only,

http://192.168.5.100:3000/issues/17050 -> /projects/207/issue_templates/set_pulldown?is_update_issue=true 192.168.16.12 - - [13/May/2021:11:32:09 IST] "POST /uploads.json?filename=abeesh_test_2.png HTTP/1.1" 201 104 http://192.168.5.100:3000/issues/17050 -> /uploads.json?filename=abeesh_test_2.png 192.168.16.12 - - [13/May/2021:11:32:09 IST] "GET /issues/17050.json?include=journals HTTP/1.1" 304 0 http://192.168.5.100:3000/issues/17050 -> /issues/17050.json?include=journals

PUT call is not happening here

I hope you would get some clue from this.

mikitex70 commented 3 years ago

Hi @abeeshmp, I've tested diagrams in a description of an issue with Redmine 4.1.1 and all is worked fine. Can you give me some more information like Redmine version and kind (vanilla, Bitnami, EasyRedmine, ecc. ), what plugins are installed... You can use the Administration -> Information page to get the relevant details.

abeeshmp commented 3 years ago

hi @mikitex70 ,

I also don't have issue when I use draw.io diagrams with the new/recent issues . Its happening with editing of diagarams in old issues or when I add new diagram to old issues.

Could you please look into the log I sent in previous comment? Do you get any idea why its stuck on GET request.?

Please see the details you asked for,

Environment: Redmine version 4.0.5.stable Ruby version 2.5.1-p57 (2018-03-29) [x86_64-linux-gnu] Rails version 5.2.3 Environment production Database adapter Mysql2 Mailer queue ActiveJob::QueueAdapters::AsyncAdapter Mailer delivery smtp SCM: Subversion 1.9.7 Git 2.17.1 Filesystem
Redmine plugins: plantuml 0.5.1 redmine_agile 1.6.0 redmine_checklists 3.1.18 redmine_ckeditor 1.2.2 redmine_custom_workflows 1.0.0 redmine_drawio 0.9.0 redmine_issue_templates 0.3.7 redmine_lightbox2 0.5.1 redmine_people 1.6.0 redmine_questions 1.0.2 redmine_resources 1.0.4 redmine_work_time 0.4.0 redmineup_tags 2.0.8

abeeshmp commented 3 years ago

@mikitex70 Please look into this, this is a blocking issue for us. Please help. If you can suggest some code debugging on this, I can do that as I am a software developer.

mikitex70 commented 3 years ago

I'm still testing but I'm unable to reproduce your issue. At work we use an old Redmine 3.3.2 with diagrams 5 years old and all is working. Can you give me some more information, like:

I suspect there is a Javascript error (strange it appens only on old issues): can you try to press F12 in the browser and see if there are Javascript errors in the console panel?

abeeshmp commented 3 years ago

@mikitex70 you are right, there is an error in java script. Am not sure about the reason. Please check the screenshort attached. image_2021_05_21T09_22_38_533Z image_2021_05_21T09_21_15_017Z

mikitex70 commented 3 years ago

Ok, now I know where too look for the error, I will try to replicate it. Diagrams are define in the description of the issue or in the notes (saved when an issue is updated)? The error raises when it look into issue notes, I will try with and without diagrams on them.

abeeshmp commented 3 years ago

The diagram was added to description section and the used option is drawio_attach.

The step I did is , double click on the diagram, then click on save but on on draw IO web page. Then it will come back to redmine issue page and it will stay with 'loading' message.

mikitex70 commented 3 years ago

I cannot reproduce the issue, but I've committed in the develop branch a fix that should solve it. Give it a try.

abeeshmp commented 3 years ago

Thats a good catch, It resolved the issue.

I put some console prints and understood that , I am getting note's body as null for some old issues. Do you have any idea why that is null for some issues alone?

mikitex70 commented 3 years ago

Glad to hear this. No idea, maybe an old Redmine version was saving journals in db in a different way, and when de-serializing them a null is put in the JSON. For me the fix is enough, and is also more correct to prevent future errors. I have another issue to resolve, then I will do a release.

abeeshmp commented 3 years ago

okay.Thankyou for your time.

mikitex70 commented 3 years ago

Fix release in version v1.0.3. Thanks for reporting this issue.