| 1 |
{% macro panel(base, hooks, csrf, what) %} |
| 2 |
<section class="panel" id="webhooks"> |
| 3 |
<h2>Webhooks</h2> |
| 4 |
<p class="small mute">{{ what }}</p> |
| 5 |
{% if hooks.is_empty() %}<p class="mute small">None.</p>{% else %} |
| 6 |
<table class="small"><tr><th>URL</th><th>Events</th><th>Active</th><th></th></tr> |
| 7 |
{% for h in hooks %}<tr><td>{{ h.url }}</td><td>{{ h.events }}</td><td>{% if h.active %}yes{% else %}no{% endif %}</td> |
| 8 |
<td><a class="small" href="{{ base }}/hooks/{{ h.id }}/deliveries">deliveries</a> |
| 9 |
<form class="tiny" method="post" action="{{ base }}/hooks"><input type="hidden" name="_csrf" value="{{ csrf }}"><input type="hidden" name="id" value="{{ h.id }}"><button name="action" value="ping">ping</button> <button name="action" value="toggle">{% if h.active %}disable{% else %}enable{% endif %}</button> <button name="action" value="delete">delete</button></form></td></tr>{% endfor %} |
| 10 |
</table>{% endif %} |
| 11 |
<form class="card" method="post" action="{{ base }}/hooks"> |
| 12 |
<input type="hidden" name="_csrf" value="{{ csrf }}"> |
| 13 |
<label for="hurl">URL</label><input type="text" id="hurl" name="url" placeholder="https://…" required> |
| 14 |
<label for="hsecret">Secret (signs each delivery)</label><input type="text" id="hsecret" name="secret"> |
| 15 |
<label for="hevents">Events (<code>*</code>, or a list such as <code>push,proposal,issue</code>)</label><input type="text" id="hevents" name="events" value="*"> |
| 16 |
<button type="submit">ADD WEBHOOK</button> |
| 17 |
</form> |
| 18 |
</section> |
| 19 |
{% endmacro %} |