{# Shared template macros. Import with: {% from "_macros.html" import crumbs %} #} {# Breadcrumb trail. `items` is a list of (label, href) pairs, ordered root→current. Intermediate items with a truthy href render as links; the last item (or any item with an empty href) renders as plain current text. #} {% macro crumbs(items) -%} {%- endmacro %} {# A state as a labelled badge: up, down, stale, firing, pending, acknowledged, no_data, ok, warn, crit, resolved, inactive (formatting.STATES). `state` may be a string or an enum; `label` replaces the standard wording. #} {% macro status_badge(state, label=none, title=none) -%} {%- set tone, text = status_info(state) -%} {{ label or text }} {%- endmacro %} {# A state as a coloured dot. The dot is never the only signal: its label is read out to a screen reader, and shown beside it when `show_label`. #} {% macro status_dot(state, label=none, show_label=false) -%} {%- set tone, text = status_info(state) -%} {%- if show_label %}{{ label or text }}{% else %}{{ label or text }}{% endif %} {%- endmacro %} {# Threshold colouring: `threshold_style(value, kind)` (an inline style) and `status_class(value, kind)` ('ok' / 'warn' / 'crit' / 'unknown') are jinja globals reading the cutoffs from Settings → Thresholds. #} {# One headline number. `state` (a STATES name, or a status_class result) colours the value; `href` makes the whole tile a link. #} {% macro stat_tile(label, value, state=none, hint=none, href=none) -%} {%- set tone = status_info(state)[0] if state else none -%} {%- set body -%} {{ label }} {{ value }} {%- if hint %}{{ hint }}{% endif %} {%- endset -%} {%- if href -%} {{ body }} {%- else -%}
{{ message }}
{%- if action_label and action_href %}{{ action_label }}{% endif %}{{ subtitle }}
{% endif %}{{ text }}
{% endif %} {%- endmacro %} {# A table header that sorts its column (#5294). `url` is the list with this column as the sort (the route builds it, keeping the other filters); `active` and `desc` say whether it is the current sort and which way. A plain link: the whole page reloads, so the filter bar stays in step. #} {% macro sort_th(label, url, active=false, desc=false, cls=none, title=none) -%}