sciapp / sampledb

Sample and Measurement Metadata Database
https://scientific-it-systems.iffgit.fz-juelich.de/SampleDB/
MIT License
21 stars 11 forks source link

Fixed the horrible performance loading the edit page with very large plotly objects #23

Closed MayerBjoern closed 3 years ago

MayerBjoern commented 3 years ago

The introduced jinja filter

"to_json_no_extra_escapes(indent=2)"

caused a horrendous performance while loading the edit page. It dumps the plolty object as a string via json.dumps and when the indent parameter is used formats it nice and pretty. But the formatting in a textarea seems to be very slow when you have over 130k datapoints in your plotly data, causing the page to seemingly lag for several seconds.

Now we just skip the indentation alltogether and initially load the textarea with a one-line JSON string and then afterwards format the JSON via javascript in the form_base js block.

FlorianRhiem commented 3 years ago

Thanks for the pull request, I've merged it into develop.