{#- Shared UI macros. Import with {% import "_ui.html" as ui %}. -#} {%- set _ICONS = { "runs": '', "feedback": '', "ai": '', "api": '', "plus": '', "download": '', "upload": '', "copy": '', "check": '', "x": '', "trash": '', "alert": '', "info": '', "shield": '', "pause": '', "sun": '', "moon": '', "menu": '', "external": '', "file": '', "link": '', "search": '', "chevron-right": '', "arrow-right": '', "arrow-left": '', "target": '', "flask": '', "book": '', "history": '', "dollar": '', "cpu": '', "check-circle": '', "key": '', "refresh": '', "list": '', "database": '', "map": '', "play": '', "zap": '', "layers": '', "duplicate": '', "user": '', "clock": '', "hash": '', } -%} {#- Brand mark: a shield (detection) holding a Sigma, fanning out to several SIEM queries. -#} {% macro logo(size=34) -%} {%- endmacro %} {% macro icon(name, cls="") -%} {%- endmacro %} {#- Map any status word used by the app to a colour tone. -#} {% macro tone(s) -%} {%- set s = (s or "")|string -%} {%- if s in ("approved", "pass", "syntax-validated", "done", "applied", "ok", "fired", "quiet", "true_positive") or s.startswith("tested") -%}ok {%- elif s in ("failed", "fail", "rejected", "interrupted", "invalid", "not_fired", "false_positive", "critical", "high", "auth_error", "quota_exhausted", "daily_cap", "TLP:RED") -%}bad {%- elif s in ("draft", "open", "running", "reviewed", "medium", "rate_limited", "refused", "unavailable", "TLP:AMBER", "TLP:AMBER+STRICT", "benign_true_positive", "not-available") -%}warn {%- elif s in ("TLP:GREEN",) -%}ok {%- else -%}muted{%- endif -%} {%- endmacro %} {% macro status(text, t=None, label=None, dot=True) -%} {%- set tn = t or tone(text) -%} {% if dot %}{% endif %}{% if label %}{{ label }}{% endif %}{{ (text|string).replace('_', ' ') }} {%- endmacro %} {% macro stat(label, value, ico="target", t="", hint="", sub="") -%}
{{ icon(ico, "sm") }}{{ label }}
{{ value }}{% if sub %} {{ sub }}{% endif %}
{% if hint %}
{{ hint }}
{% endif %}
{%- endmacro %} {% macro copy_btn(target="", label="Copy", cls="btn ghost sm") -%} {%- endmacro %} {% macro code(text, title="", copy=True) -%}
{% if title %}
{{ title }}{% if copy %}{{ copy_btn() }}{% endif %}
{% endif %}
{{ text }}
{% if copy and not title %}{% endif %}
{%- endmacro %} {% macro empty(title, text="", ico="layers") -%}
{{ icon(ico, "lg") }}{{ title }}{% if text %}{{ text }}{% endif %}
{%- endmacro %} {% macro short_date(s) -%}{{ (s or "")[:16]|replace("T", " ") }}{%- endmacro %} {% macro review_badge(rs, running=False) -%} {%- if running -%}Review running {%- elif rs.state == "none" -%}Not reviewed {%- elif rs.state == "stale" -%}{{ icon("alert", "sm") }}Out of date {%- elif rs.state == "open" -%}{{ rs.open }} open {%- elif rs.state == "clean" -%}{{ icon("check", "sm") }}Reviewed, clean {%- else -%}{{ icon("check", "sm") }}Reviewed{%- endif -%} {%- endmacro %}