{# Rich pill for a source event. Pass `summary` dict (from _fetch_event_summary) when available; falls back to bare id otherwise. #} {% macro event_pill(event_id, summary=None) -%} {% set s = summary or {} %} {% set code = s.get("event_code") %} {% set state = s.get("state") %} {% if code %}{{ code }}{% endif %} {{ event_id }} {% if state %}{{ state }}{% endif %} {% if s.get("timestamp") %}{{ s.timestamp }}{% endif %} {% if s.get("triggered_count") %}→ {{ s.triggered_count }} inv{% endif %} {%- endmacro %}