|
1
|
{% extends "base.html" %} |
|
2
|
{% block title %}{{ form_title }} — {{ project.name }} — Fossilrepo{% endblock %} |
|
3
|
|
|
4
|
{% block content %} |
|
5
|
<h1 class="text-2xl font-bold text-gray-100 mb-2">{{ project.name }}</h1> |
|
6
|
{% include "fossil/_project_nav.html" %} |
|
7
|
|
|
8
|
<div class="mb-4"> |
|
9
|
<a href="{% url 'fossil:webhooks' slug=project.slug %}" class="text-sm text-brand-light hover:text-brand">← Back to Webhooks</a> |
|
10
|
</div> |
|
11
|
|
|
12
|
<div class="mx-auto max-w-3xl"> |
|
13
|
<h2 class="text-xl font-bold text-gray-100 mb-4">{{ form_title }}</h2> |
|
14
|
|
|
15
|
<form method="post" class="space-y-4 rounded-lg bg-gray-800 p-6 shadow border border-gray-700"> |
|
16
|
{% csrf_token %} |
|
17
|
|
|
18
|
<div> |
|
19
|
<label class="block text-sm font-medium text-gray-300 mb-1">Payload URL <span class="text-red-400">*</span></label> |
|
20
|
<input type="url" name="url" required placeholder="https://example.com/webhook" |
|
21
|
value="{% if webhook %}{{ webhook.url }}{% endif %}" |
|
22
|
class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm font-mono"> |
|
23
|
</div> |
|
24
|
|
|
25
|
<div> |
|
26
|
<label class="block text-sm font-medium text-gray-300 mb-1">Secret</label> |
|
27
|
<input type="password" name="secret" placeholder="{% if webhook and webhook.secret %}(unchanged){% else %}Optional HMAC secret{% endif %}" |
|
28
|
class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm font-mono"> |
|
29
|
<p class="mt-1 text-xs text-gray-500">Used to sign payloads with HMAC-SHA256. Leave blank for no signature.</p> |
|
30
|
</div> |
|
31
|
|
|
32
|
<div> |
|
33
|
<label class="block text-sm font-medium text-gray-300 mb-2">Events</label> |
|
34
|
<div class="space-y-2"> |
|
35
|
{% for value, label in event_choices %} |
|
36
|
<label class="flex items-center gap-2 text-sm text-gray-300 cursor-pointer"> |
|
37
|
<input type="checkbox" name="events" value="{{ value }}" |
|
38
|
{% if webhook %}{% if value in webhook.events %}checked{% endif %}{% elif value == "all" %}checked{% endif %} |
|
39
|
class="rounded border-gray-600 bg-gray-900 text-brand focus:ring-brand"> |
|
40
|
{{ label }} |
|
41
|
</label> |
|
42
|
{% endfor %} |
|
43
|
</div> |
|
44
|
</div> |
|
45
|
|
|
46
|
<label class="flex items-center gap-2 text-sm text-gray-300 cursor-pointer"> |
|
47
|
<input type="checkbox" name="is_active" |
|
48
|
{% if webhook %}{% if webhook.is_active %}checked{% endif %}{% else %}checked{% endif %} |
|
49
|
class="rounded border-gray-600 bg-gray-900 text-brand focus:ring-brand"> |
|
50
|
Active |
|
51
|
</label> |
|
52
|
|
|
53
|
<div class="flex justify-end gap-3 pt-2"> |
|
54
|
<a href="{% url 'fossil:webhooks' slug=project.slug %}" |
|
55
|
class="rounded-md bg-gray-700 px-4 py-2 text-sm font-semibold text-gray-100 shadow-sm ring-1 ring-inset ring-gray-600 hover:bg-gray-600"> |
|
56
|
Cancel |
|
57
|
</a> |
|
58
|
<button type="submit" class="rounded-md bg-brand px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-brand-hover"> |
|
59
|
{{ submit_label }} |
|
60
|
</button> |
|
61
|
</div> |
|
62
|
</form> |
|
63
|
</div> |
|
64
|
{% endblock %} |
|
65
|
|