Files
FabledSteward/plugins/prometheus/templates/prometheus/templates.html
T
bvandeusenandClaude Opus 5.5 e42fde89f5
CI / lint (push) Successful in 1s
CI / integration (push) Successful in 1m15s
CI / unit (push) Successful in 1m27s
CI / publish (push) Successful in 1m5s
fix(prometheus): word the template audit actions; keep the list verdict's apostrophe out of an autoescaped expression (#5692)
Run 9093: test_every_logged_action_is_worded wanted the three
prometheus.template_* actions in ACTIONS, and the list's verdict wrote
"doesn't" as a Jinja string literal, which autoescape turns into '.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 09:24:34 -04:00

51 lines
3.1 KiB
HTML

{# plugins/prometheus/templates/prometheus/templates.html — the widget
templates the Prometheus dashboard widget can draw with (#5692): the ones
built in and the ones copied in here. One that no longer passes the
checker comes first, saying why: its widgets say so too. #}
{% extends "base.html" %}
{% from "_macros.html" import crumbs, page_header %}
{% from "prometheus/_tabs.html" import prometheus_tabs %}
{% block title %}Widget templates — Prometheus — Steward{% endblock %}
{% block section_tabs %}{{ prometheus_tabs("templates") }}{% endblock %}
{% block breadcrumb %}{{ crumbs([("Prometheus", "/plugins/prometheus/"), ("Widget templates", "")]) }}{% endblock %}
{% block content %}
{% set admin = session.user_role == 'admin' %}
{% set broken = templates|selectattr("problem")|list %}
{% set own = templates|rejectattr("bundled")|list %}
{% call page_header("Widget templates") %}
{% if admin %}<a class="btn btn-sm" href="/plugins/prometheus/templates/new">New template</a>{% endif %}
{% endcall %}
<p class="page-verdict">
{%- if broken|length == 1 %}<span class="tone-warn">1 template doesn't pass the checker; widgets drawn with it say so.</span>
{%- elif broken %}<span class="tone-warn">{{ broken|length }} templates don't pass the checker; widgets drawn with them say so.</span>
{%- else %}{{ templates|length }} template{{ "s" if templates|length != 1 }}: {{ templates|length - own|length }} built in, {{ own|length }} of your own.{% endif %}
</p>
<p class="field-hint">A template says which of a target's series the Prometheus dashboard widget shows, and how. Built-in ones can be copied and changed; your own you write here, or paste or upload one someone shared.</p>
<section class="card">
<table class="table">
<thead><tr><th scope="col">Template</th><th scope="col">Version</th><th scope="col">Used by</th><th scope="col">Changed</th><th scope="col"><span class="sr-only">Actions</span></th></tr></thead>
<tbody>
{% for t in templates %}
<tr>
<td>
<a href="/plugins/prometheus/templates/{{ t.key }}">{{ t.name }}</a>
{% if t.bundled %} <span class="tone-muted">built in</span>{% endif %}
{%- if t.problem %}<div class="cell-sub tone-warn" title="{{ t.problem }}">{{ t.problem }}</div>
{%- elif t.description %}<div class="cell-sub" title="{{ t.description }}">{{ t.description }}</div>{% endif %}
</td>
<td>{{ t.version if t.version is not none else "—" }}</td>
<td>{% if t.used %}{{ t.used }} widget{{ "s" if t.used != 1 }}{% else %}<span class="tone-muted">none</span>{% endif %}</td>
<td>{% if t.updated_at %}{{ t.updated_at|ago }}{% else %}<span class="tone-muted">with Steward</span>{% endif %}</td>
<td style="text-align:right;white-space:nowrap;">
<a class="btn btn-sm btn-ghost" href="/plugins/prometheus/templates/{{ t.key }}/export">Export</a>
{% if admin %}<a class="btn btn-sm btn-ghost" href="/plugins/prometheus/templates/new?from={{ t.key|urlencode }}">Duplicate</a>{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</section>
{% endblock %}