Frontend table builder performance impoves

This commit is contained in:
norohind 2021-11-29 00:48:21 +03:00
parent 7d132ecb5f
commit cebe77cc09
Signed by: norohind
GPG Key ID: 01C3BECC26FB59E1
2 changed files with 3 additions and 3 deletions

View File

@ -181,7 +181,7 @@ activity_table_html_template = """
<script src="/js/json2htmltable.js"></script>
<script type="text/javascript">
window.onload = () => {
document.body.appendChild(buildHtmlTable(JSON.parse({items}))); // build table
document.body.appendChild(buildHtmlTable({items})); // build table
var table = document.querySelector("body > table")
var header = table.rows[0]

4
web.py
View File

@ -61,7 +61,7 @@ class ActivityHtml:
table_in_json: str = resp.text
resp.content_type = falcon.MEDIA_HTML
resp.text = utils.activity_table_html_template.replace('{items}', json.dumps(table_in_json))
resp.text = utils.activity_table_html_template.replace('{items}', table_in_json)
# what? f-strings? .format? never heard about them
@ -85,7 +85,7 @@ class ActivityDiffHtml:
resp.content_type = falcon.MEDIA_HTML
# table: str = json.dumps(model.get_diff_action_id(action_id))
resp.text = utils.activity_table_html_template.replace(
'{items}', json.dumps(json.dumps(model.get_diff_action_id(action_id)))
'{items}', json.dumps(model.get_diff_action_id(action_id))
)