Allow changing the script type, add root to visualization config

This commit is contained in:
guerler
2024-09-04 09:56:11 +03:00
parent 59b189d3cb
commit f0d148cdc7
2 changed files with 5 additions and 3 deletions
@@ -13,6 +13,7 @@
<%def name="get_body()">
## Collect incoming data
<% data_incoming = {
"root": h.url_for("/"),
"visualization_id": visualization_id,
"visualization_name": visualization_name,
"visualization_plugin": visualization_plugin,
@@ -24,6 +25,7 @@
<div id="${container}" data-incoming='${h.dumps(data_incoming)}'></div>
## Add script tag
<% src = script_attributes.get("src") %>
<script type="text/javascript" src=${src}></script>
<% script_src = script_attributes.get("src") %>
<% script_type = script_attributes.get("type") or "module" %>
<script type="${script_type}" src=${script_src}></script>
</%def>
@@ -221,7 +221,7 @@ class DataSourceParser:
# when no tests are given, default to isinstance( object, model_class )
returned["tests"] = self.parse_tests(xml_tree.findall("test"))
# to_params (optional, 0 or more) - tells the registry to set certain params based on the model_clas, tests
# to_params (optional, 0 or more) - tells the registry to set certain params based on the model_class, tests
returned["to_params"] = {}
if to_params := self.parse_to_params(xml_tree.findall("to_param")):
returned["to_params"] = to_params