Skip to content

Commit

Permalink
Loading the report's data prior to loading bundle's code.
Browse files Browse the repository at this point in the history
  • Loading branch information
elongl committed Sep 4, 2023
1 parent e637e83 commit c51ac7d
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,12 @@ def generate_report(

dumped_output_data = json.dumps(output_data)
encoded_output_data = base64.b64encode(dumped_output_data.encode("utf-8"))
compiled_output_html = f"""
{template_html_code}
<script>
window.onload = function() {{
window.elementaryData = JSON.parse(atob('{encoded_output_data.decode("utf-8")}'));
}}
</script>
"""

compiled_output_html = (
f"<script>"
f"window.elementaryData = JSON.parse(atob('{encoded_output_data.decode('utf-8')}'));"
f"</script>"
f"{template_html_code}"
)
with open(html_path, "w", encoding="utf-8") as html_file:
html_file.write(compiled_output_html)

Expand Down

0 comments on commit c51ac7d

Please sign in to comment.