{% macro show_tree(assets, current_asset_name) %}
{% endmacro %} {% macro render_attributes(attributes) %} {% for key, value in attributes.items() %} {% if not key.endswith("_id") %} {% endif %} {% endfor %}
Attribute Value
{{ key }} {{ value }}
{% endmacro %} {# Render a button that opens the JSON attributes editor modal. Call json_attributes_editor_modal() once on the same page to include the modal + JS. Parameters: modal_id: unique HTML id for the modal (default "jsonAttributesModal") label: button label text field_label: optional form-field label rendered above the button field_description: optional small description rendered below the label #} {% macro json_attributes_editor_button(modal_id="jsonAttributesModal", label="Custom attributes", field_label=None, field_description=None) %} {% if field_label %} {% endif %} {% if field_description %} {{ field_description }} {% endif %} {% endmacro %} {# Render the JSON attributes editor modal and its JavaScript. Uses @json-editor/json-editor (https://github.com/json-editor/json-editor). Parameters: api_url: full API PATCH URL for this entity initial_attributes: the current attributes dict (Jinja variable, will be tojson'd) entity_name: displayed in the modal title modal_id: must match the id passed to json_attributes_editor_button() The modal has two tabs: Form — schema-driven Bootstrap form (good for simple flat attributes) JSON — raw editable textarea (type-accurate; authoritative on Save) Active theme is read from FLEXMEASURES_JSONEDITOR_THEME config. Available themes: "bootstrap5" (default), "bootstrap4", "bootstrap3", "tailwind", "spectre", "barebones", "html" #} {% macro json_attributes_editor_modal(api_url, initial_attributes, entity_name="", modal_id="jsonAttributesModal") %} {% set _theme = config.get("FLEXMEASURES_JSONEDITOR_THEME", "bootstrap5") %} {% endmacro %}