{# Component library for the panel. Every component here is driven by an explicit context, so a template never reaches into a manager or a model. The state vocabulary is fixed and shared: "active", "idle", "failed" and "busy". Those four words are what the state rail, the badge and the notice all agree on, so an operator learns the language once and it holds on every screen. #} {% set _STATE_ALIASES = { "active": "active", "running": "active", "valid": "active", "enabled": "active", "failed": "failed", "error": "failed", "expired": "failed", "corrupt": "failed", "busy": "busy", "deploying": "busy", "renewing": "busy", "expiring": "busy", "building": "busy", "restoring": "busy" } %} {% macro state_class(state) -%} {{- _STATE_ALIASES.get(state | lower, "idle") -}} {%- endmacro %} {% macro badge(state, text=none) -%} {{ text or state }} {%- endmacro %} {# A resource row. Its state travels as a pill with a coloured dot - the v2 direction retired the 3px rail - so running your eye down a list still tells you the health of everything on it, in words as well as colour. meta is a list of (label, value) pairs rendered in mono. Keep it to the three or four facts an operator scans for, not everything the record holds. note is one further line, for what a tool said about this record verbatim: certbot's own validity line, or a backup's description. It is not a place for commentary. state_text is the state in words; when the caller has none, the pill carries the state's own name, because a dot on its own is unreadable to anyone who cannot see this particular pair of hues and invisible to a screen reader. Used with {% call %} so the caller supplies the action buttons: {% call m.row("example.com", "active", meta) %} {{ m.action_button("Restart", "/api/apps/example.com/restart") }} {% endcall %} #} {% macro row(name, state, meta=[], href=none, row_id=none, note=none, state_text=none) %}
{{ subtitle }}
{% endif %}{{ body }}
{% if action_label and action_href %} {{ action_label }} {% endif %} {% if command %}Or run {{ command }}
{{ fix }}
{% if output %}{{ output }}{% endif %}
| {{ label }} | {{ value }} |
|---|