|
c588255…
|
ragelink
|
1 |
{% extends "base.html" %} |
|
c588255…
|
ragelink
|
2 |
{% block title %}Branch Protection — {{ project.name }} — Fossilrepo{% endblock %} |
|
c588255…
|
ragelink
|
3 |
|
|
c588255…
|
ragelink
|
4 |
{% block content %} |
|
c588255…
|
ragelink
|
5 |
<h1 class="text-2xl font-bold text-gray-100 mb-2">{{ project.name }}</h1> |
|
c588255…
|
ragelink
|
6 |
{% include "fossil/_project_nav.html" %} |
|
c588255…
|
ragelink
|
7 |
|
|
c588255…
|
ragelink
|
8 |
<div class="flex items-center justify-between mb-6"> |
|
c588255…
|
ragelink
|
9 |
<div> |
|
c588255…
|
ragelink
|
10 |
<h2 class="text-lg font-semibold text-gray-200">Branch Protection Rules</h2> |
|
c588255…
|
ragelink
|
11 |
<p class="text-sm text-gray-500 mt-1">Protect branches from unreviewed changes and require CI checks to pass.</p> |
|
c588255…
|
ragelink
|
12 |
</div> |
|
c588255…
|
ragelink
|
13 |
<div class="flex items-center gap-3"> |
|
0e40dc2…
|
ragelink
|
14 |
<span class="search-wrap"> |
|
c588255…
|
ragelink
|
15 |
<input type="search" |
|
c588255…
|
ragelink
|
16 |
name="search" |
|
c588255…
|
ragelink
|
17 |
value="{{ search }}" |
|
c588255…
|
ragelink
|
18 |
placeholder="Search rules..." |
|
0e40dc2…
|
ragelink
|
19 |
aria-label="Search branch protection rules" |
|
c588255…
|
ragelink
|
20 |
class="rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand text-sm px-3 py-1.5" |
|
c588255…
|
ragelink
|
21 |
hx-get="{% url 'fossil:branch_protections' slug=project.slug %}" |
|
c588255…
|
ragelink
|
22 |
hx-trigger="input changed delay:300ms, search" |
|
c588255…
|
ragelink
|
23 |
hx-target="#protection-content" |
|
c588255…
|
ragelink
|
24 |
hx-swap="innerHTML" |
|
0e40dc2…
|
ragelink
|
25 |
hx-push-url="true" |
|
0e40dc2…
|
ragelink
|
26 |
hx-indicator="closest .search-wrap" /> |
|
0e40dc2…
|
ragelink
|
27 |
<svg class="search-spinner animate-spin h-4 w-4" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg> |
|
0e40dc2…
|
ragelink
|
28 |
</span> |
|
c588255…
|
ragelink
|
29 |
<a href="{% url 'fossil:branch_protection_create' slug=project.slug %}" |
|
c588255…
|
ragelink
|
30 |
class="inline-flex items-center rounded-md bg-brand px-3 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-brand-hover"> |
|
c588255…
|
ragelink
|
31 |
Add Rule |
|
c588255…
|
ragelink
|
32 |
</a> |
|
c588255…
|
ragelink
|
33 |
</div> |
|
c588255…
|
ragelink
|
34 |
</div> |
|
c588255…
|
ragelink
|
35 |
|
|
c588255…
|
ragelink
|
36 |
<div id="protection-content"> |
|
c588255…
|
ragelink
|
37 |
{% if rules %} |
|
c588255…
|
ragelink
|
38 |
<div class="space-y-3"> |
|
c588255…
|
ragelink
|
39 |
{% for rule in rules %} |
|
c588255…
|
ragelink
|
40 |
<div class="rounded-lg bg-gray-800 border border-gray-700"> |
|
c588255…
|
ragelink
|
41 |
<div class="px-5 py-4"> |
|
c588255…
|
ragelink
|
42 |
<div class="flex items-start justify-between gap-4"> |
|
c588255…
|
ragelink
|
43 |
<div class="flex-1 min-w-0"> |
|
c588255…
|
ragelink
|
44 |
<div class="flex items-center gap-3 mb-1"> |
|
c588255…
|
ragelink
|
45 |
<code class="text-sm font-mono font-medium text-gray-100">{{ rule.branch_pattern }}</code> |
|
c588255…
|
ragelink
|
46 |
{% if rule.restrict_push %} |
|
c588255…
|
ragelink
|
47 |
<span class="inline-flex rounded-full bg-yellow-900/50 px-2 py-0.5 text-xs font-semibold text-yellow-300">Push restricted</span> |
|
c588255…
|
ragelink
|
48 |
{% endif %} |
|
c588255…
|
ragelink
|
49 |
{% if rule.require_status_checks %} |
|
c588255…
|
ragelink
|
50 |
<span class="inline-flex rounded-full bg-blue-900/50 px-2 py-0.5 text-xs font-semibold text-blue-300">CI required</span> |
|
c588255…
|
ragelink
|
51 |
{% endif %} |
|
c588255…
|
ragelink
|
52 |
</div> |
|
c588255…
|
ragelink
|
53 |
<div class="flex items-center gap-3 text-xs text-gray-500 mt-1 flex-wrap"> |
|
c588255…
|
ragelink
|
54 |
{% if rule.require_status_checks and rule.required_contexts %} |
|
c588255…
|
ragelink
|
55 |
<span>Required contexts: {{ rule.required_contexts|truncatewords:10 }}</span> |
|
c588255…
|
ragelink
|
56 |
{% endif %} |
|
c588255…
|
ragelink
|
57 |
<span>Created {{ rule.created_at|timesince }} ago</span> |
|
c588255…
|
ragelink
|
58 |
</div> |
|
c588255…
|
ragelink
|
59 |
</div> |
|
c588255…
|
ragelink
|
60 |
<div class="flex items-center gap-2 flex-shrink-0"> |
|
c588255…
|
ragelink
|
61 |
<a href="{% url 'fossil:branch_protection_edit' slug=project.slug pk=rule.pk %}" |
|
c588255…
|
ragelink
|
62 |
class="text-xs text-gray-400 hover:text-brand-light">Edit</a> |
|
c588255…
|
ragelink
|
63 |
<form method="post" action="{% url 'fossil:branch_protection_delete' slug=project.slug pk=rule.pk %}" |
|
c588255…
|
ragelink
|
64 |
class="inline" onsubmit="return confirm('Delete this protection rule?')"> |
|
c588255…
|
ragelink
|
65 |
{% csrf_token %} |
|
c588255…
|
ragelink
|
66 |
<button type="submit" class="text-xs text-red-400 hover:text-red-300">Delete</button> |
|
c588255…
|
ragelink
|
67 |
</form> |
|
c588255…
|
ragelink
|
68 |
</div> |
|
c588255…
|
ragelink
|
69 |
</div> |
|
c588255…
|
ragelink
|
70 |
</div> |
|
c588255…
|
ragelink
|
71 |
</div> |
|
c588255…
|
ragelink
|
72 |
{% endfor %} |
|
c588255…
|
ragelink
|
73 |
</div> |
|
c588255…
|
ragelink
|
74 |
{% else %} |
|
c588255…
|
ragelink
|
75 |
<div class="rounded-lg bg-gray-800 border border-gray-700 p-8 text-center"> |
|
c588255…
|
ragelink
|
76 |
<p class="text-sm text-gray-500">{% if search %}No rules matching "{{ search }}".{% else %}No branch protection rules configured.{% endif %}</p> |
|
c588255…
|
ragelink
|
77 |
{% if not search %} |
|
c588255…
|
ragelink
|
78 |
<a href="{% url 'fossil:branch_protection_create' slug=project.slug %}" |
|
c588255…
|
ragelink
|
79 |
class="mt-3 inline-flex items-center rounded-md bg-brand px-3 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-brand-hover"> |
|
c588255…
|
ragelink
|
80 |
Add the first rule |
|
c588255…
|
ragelink
|
81 |
</a> |
|
c588255…
|
ragelink
|
82 |
{% endif %} |
|
c588255…
|
ragelink
|
83 |
</div> |
|
c588255…
|
ragelink
|
84 |
{% endif %} |
|
c588255…
|
ragelink
|
85 |
{% include "includes/_pagination.html" %} |
|
c588255…
|
ragelink
|
86 |
</div> |
|
c588255…
|
ragelink
|
87 |
|
|
afe42d0…
|
ragelink
|
88 |
<div class="mt-6 rounded-md bg-gray-800/50 border border-gray-700 px-4 py-3"> |
|
afe42d0…
|
ragelink
|
89 |
<p class="text-xs text-gray-400">Branch protection is enforced on all push operations (HTTP sync, CLI push, SSH). Non-admin users are blocked from pushing when protection rules with "restrict push" are active. Admins bypass all restrictions.</p> |
|
c588255…
|
ragelink
|
90 |
</div> |
|
c588255…
|
ragelink
|
91 |
{% endblock %} |