FossilRepo

fossilrepo / templates / fossil / git_mirror.html
1
{% extends "base.html" %}
2
{% block title %}{% if editing_mirror %}Edit Mirror{% else %}Add Git Mirror{% endif %} — {{ 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="max-w-3xl">
9
<div class="flex items-center justify-between mb-6">
10
<h2 class="text-lg font-semibold text-gray-200">{% if editing_mirror %}Edit Git Mirror{% else %}Add Git Mirror{% endif %}</h2>
11
<a href="{% url 'fossil:sync' slug=project.slug %}" class="text-sm text-brand-light hover:text-brand">&larr; Back to Sync</a>
12
</div>
13
14
{# ── OAuth quick-connect (only shown when adding) ──────────────── #}
15
{% if not editing_mirror %}
16
<div class="rounded-lg bg-gray-800 border border-gray-700 p-5 mb-6">
17
<h3 class="text-sm font-semibold text-gray-200 mb-3 text-center">Quick Connect</h3>
18
<div class="flex items-center justify-center gap-3">
19
<a href="{% url 'fossil:oauth_github' slug=project.slug %}"
20
class="inline-flex items-center gap-2 rounded-md bg-gray-900 px-4 py-2 text-sm font-medium text-gray-200 ring-1 ring-inset ring-gray-600 hover:bg-gray-700">
21
<svg class="h-5 w-5" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/></svg>
22
Connect GitHub
23
</a>
24
<a href="{% url 'fossil:oauth_gitlab' slug=project.slug %}"
25
class="inline-flex items-center gap-2 rounded-md bg-gray-900 px-4 py-2 text-sm font-medium text-gray-200 ring-1 ring-inset ring-gray-600 hover:bg-gray-700">
26
<svg class="h-5 w-5" viewBox="0 0 24 24" fill="currentColor"><path d="M22.65 14.39L12 22.13 1.35 14.39a.84.84 0 0 1-.3-.94l1.22-3.78 2.44-7.51A.42.42 0 0 1 4.82 2a.43.43 0 0 1 .58 0 .42.42 0 0 1 .11.18l2.44 7.49h8.1l2.44-7.51A.42.42 0 0 1 18.6 2a.43.43 0 0 1 .58 0 .42.42 0 0 1 .11.18l2.44 7.51L23 13.45a.84.84 0 0 1-.35.94z"/></svg>
27
Connect GitLab
28
</a>
29
</div>
30
{% if request.session.github_oauth_token %}
31
<p class="mt-2 text-xs text-green-400 text-center">GitHub connected as {{ request.session.github_oauth_user }}. Token will be used for new mirrors.</p>
32
{% endif %}
33
{% if request.session.gitlab_oauth_token %}
34
<p class="mt-2 text-xs text-green-400 text-center">GitLab connected. Token will be used for new mirrors.</p>
35
{% endif %}
36
</div>
37
{% endif %}
38
39
{# ── Mirror form (add or edit) ─────────────────────────────────── #}
40
<div class="rounded-lg bg-gray-800 border border-gray-700 p-6">
41
<form method="post" class="space-y-4">
42
{% csrf_token %}
43
<input type="hidden" name="action" value="{% if editing_mirror %}update{% else %}create{% endif %}">
44
45
<div>
46
<label class="block text-sm font-medium text-gray-300 mb-1">Git Remote URL <span class="text-red-400">*</span></label>
47
<input type="text" name="git_remote_url" required
48
value="{{ editing_mirror.git_remote_url|default:'' }}"
49
placeholder="https://github.com/org/repo.git"
50
class="w-full rounded-md border-gray-700 bg-gray-900 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm px-3 py-2 font-mono">
51
</div>
52
53
<div class="grid grid-cols-2 gap-4">
54
<div>
55
<label class="block text-sm font-medium text-gray-300 mb-1">Sync Direction</label>
56
<select name="sync_direction" class="w-full rounded-md border-gray-700 bg-gray-900 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm">
57
{% for value, label in sync_direction_choices %}
58
<option value="{{ value }}" {% if editing_mirror and editing_mirror.sync_direction == value %}selected{% endif %}>{{ label }}</option>
59
{% endfor %}
60
</select>
61
</div>
62
<div>
63
<label class="block text-sm font-medium text-gray-300 mb-1">Auth Method</label>
64
<select name="auth_method" class="w-full rounded-md border-gray-700 bg-gray-900 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm">
65
{% for value, label in auth_method_choices %}
66
<option value="{{ value }}" {% if editing_mirror and editing_mirror.auth_method == value %}selected{% endif %}>{{ label }}</option>
67
{% endfor %}
68
</select>
69
</div>
70
</div>
71
72
<div>
73
<label class="block text-sm font-medium text-gray-300 mb-1">Token / Credential</label>
74
<input type="password" name="auth_credential"
75
placeholder="{% if editing_mirror %}Leave blank to keep current credential{% else %}ghp_xxxxxxxxxxxx{% endif %}"
76
class="w-full rounded-md border-gray-700 bg-gray-900 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm px-3 py-2 font-mono">
77
<p class="mt-1 text-xs text-gray-500">
78
{% if editing_mirror %}Leave blank to keep the existing credential.{% else %}For token auth: GitHub Personal Access Token or GitLab Access Token.{% endif %}
79
</p>
80
</div>
81
82
<div class="grid grid-cols-2 gap-4">
83
<div>
84
<label class="block text-sm font-medium text-gray-300 mb-1">Fossil Branch</label>
85
<input type="text" name="fossil_branch"
86
value="{{ editing_mirror.fossil_branch|default:'trunk' }}"
87
class="w-full rounded-md border-gray-700 bg-gray-900 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm px-3 py-2">
88
</div>
89
<div>
90
<label class="block text-sm font-medium text-gray-300 mb-1">Git Branch</label>
91
<input type="text" name="git_branch"
92
value="{{ editing_mirror.git_branch|default:'main' }}"
93
class="w-full rounded-md border-gray-700 bg-gray-900 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm px-3 py-2">
94
</div>
95
</div>
96
97
<div class="grid grid-cols-2 gap-4">
98
<div>
99
<label class="block text-sm font-medium text-gray-300 mb-1">Sync Mode</label>
100
<select name="sync_mode" class="w-full rounded-md border-gray-700 bg-gray-900 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm">
101
{% for value, label in sync_mode_choices %}
102
<option value="{{ value }}" {% if editing_mirror and editing_mirror.sync_mode == value %}selected{% endif %}>{{ label }}</option>
103
{% endfor %}
104
</select>
105
</div>
106
<div>
107
<label class="block text-sm font-medium text-gray-300 mb-1">Schedule (cron)</label>
108
<input type="text" name="sync_schedule"
109
value="{{ editing_mirror.sync_schedule|default:'*/15 * * * *' }}"
110
class="w-full rounded-md border-gray-700 bg-gray-900 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm px-3 py-2 font-mono">
111
<p class="mt-1 text-xs text-gray-500">Default: every 15 minutes</p>
112
</div>
113
</div>
114
115
{# Sync content options #}
116
<div>
117
<span class="block text-sm font-medium text-gray-300 mb-2">Sync Content</span>
118
<div class="flex items-center gap-6">
119
<label class="flex items-center gap-2 text-sm text-gray-300">
120
<input type="checkbox" name="sync_tickets"
121
{% if editing_mirror and editing_mirror.sync_tickets %}checked{% endif %}
122
class="rounded border-gray-600 bg-gray-900 text-brand focus:ring-brand">
123
Tickets as Issues
124
</label>
125
<label class="flex items-center gap-2 text-sm text-gray-300">
126
<input type="checkbox" name="sync_wiki"
127
{% if editing_mirror and editing_mirror.sync_wiki %}checked{% endif %}
128
class="rounded border-gray-600 bg-gray-900 text-brand focus:ring-brand">
129
Wiki pages
130
</label>
131
</div>
132
<p class="mt-1 text-xs text-gray-500">Code is always synced. Optionally sync tickets and wiki.</p>
133
</div>
134
135
<div class="flex items-center justify-between pt-2">
136
<a href="{% url 'fossil:sync' slug=project.slug %}" class="text-sm text-gray-400 hover:text-gray-200">Cancel</a>
137
<button type="submit" class="rounded-md bg-brand px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-brand-hover">
138
{% if editing_mirror %}Update Mirror{% else %}Add Mirror{% endif %}
139
</button>
140
</div>
141
</form>
142
</div>
143
</div>
144
{% endblock %}
145

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button