| 1 |
{% extends "base.html" %} |
| 2 |
{% import "repo_tabs.html" as m %} |
| 3 |
{% block title %}Settings · {{ repo.owner }}/{{ repo.name }}{% endblock %} |
| 4 |
{% block bodyattrs %} data-repo="{{ repo.url }}"{% endblock %} |
| 5 |
{% block tabs %}{% call m::tabs(repo, "settings") %}{% endblock %} |
| 6 |
{% block content %} |
| 7 |
<div class="head"><h1>Settings <small>{{ repo.owner }}/{{ repo.name }}</small></h1></div> |
| 8 |
{% if let Some(n) = notice %}<p class="note">{{ n }}</p>{% endif %} |
| 9 |
{% if let Some(e) = error %}<p class="error">{{ e }}</p>{% endif %} |
| 10 |
<div class="sectioned"> |
| 11 |
<nav class="section-nav" aria-label="Sections"> |
| 12 |
<a href="#general">General</a> |
| 13 |
<a href="#landing">Landing requirements</a> |
| 14 |
<a href="#git-mirror">Git mirror</a> |
| 15 |
<a href="#checks">Required checks</a> |
| 16 |
{% if role == crate::auth::Role::Admin %}<a href="#webhooks">Webhooks</a> |
| 17 |
<a href="#collaborators">Collaborators</a> |
| 18 |
<a href="#danger">Delete</a>{% endif %} |
| 19 |
</nav> |
| 20 |
<div class="sections"> |
| 21 |
<form class="card wide" id="general" method="post" action="{{ repo.url }}/settings"> |
| 22 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 23 |
<h2>General</h2> |
| 24 |
<label for="description">Description</label><input type="text" id="description" name="description" value="{{ row.description }}"> |
| 25 |
<label for="topics">Topics</label><input type="text" id="topics" name="topics" value="{{ row.topics }}" placeholder="rust version-control retro"> |
| 26 |
<p class="small mute">Separated by spaces or commas; letters, digits and dashes. People find repositories by them under Explore.</p> |
| 27 |
<label for="default_bookmark">Default bookmark</label><input type="text" id="default_bookmark" name="default_bookmark" value="{{ row.default_bookmark }}"> |
| 28 |
<label>Visibility{% if role != crate::auth::Role::Admin %} <span class="mute">(admins only)</span>{% endif %}</label> |
| 29 |
<div class="choice"> |
| 30 |
<label><input type="radio" name="visibility" value="public"{% if row.visibility == "public" %} checked{% endif %}> public</label> |
| 31 |
<label><input type="radio" name="visibility" value="internal"{% if row.visibility == "internal" %} checked{% endif %}> internal</label> |
| 32 |
<label><input type="radio" name="visibility" value="private"{% if row.visibility == "private" %} checked{% endif %}> private</label> |
| 33 |
</div> |
| 34 |
<button type="submit">SAVE</button> |
| 35 |
</form> |
| 36 |
<form class="card wide" id="landing" method="post" action="{{ repo.url }}/settings/requirements"> |
| 37 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 38 |
<h2>Landing requirements</h2> |
| 39 |
<label for="required_approvals">Sealed approvals required</label><input type="number" id="required_approvals" name="required_approvals" min="0" value="{{ requirements.required_approvals }}"> |
| 40 |
<div class="choice"> |
| 41 |
<label><input type="checkbox" name="require_owners" value="1"{% if requirements.require_owners %} checked{% endif %}> code owners from <code>.oxyowners</code> must approve</label> |
| 42 |
<label><input type="checkbox" name="allow_conflicts" value="1"{% if requirements.allow_conflicts %} checked{% endif %}> allow landing with conflicts</label> |
| 43 |
</div> |
| 44 |
<button type="submit">SAVE</button> |
| 45 |
</form> |
| 46 |
<form class="card wide" id="git-mirror" method="post" action="{{ repo.url }}/settings/mirror"> |
| 47 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 48 |
<h2>Git mirror</h2> |
| 49 |
<div class="choice"><label><input type="checkbox" name="enabled" value="1"{% if row.git_mirror %} checked{% endif %}> keep a read-only Git mirror of <strong>{{ row.default_bookmark }}</strong></label></div> |
| 50 |
<p class="small mute">For tools that only speak Git (CI runners, IDEs): <code>git clone {{ shell.base_url }}{{ repo.url }}.git</code>. Private repositories take a personal access token as the password. Pushing to the mirror is refused.{% if row.git_mirror && !row.git_mirror_state.is_empty() %} Last exported state <code>{{ row.git_mirror_state|short }}</code>.{% endif %}</p> |
| 51 |
<button type="submit">SAVE</button> |
| 52 |
</form> |
| 53 |
<form class="card wide" id="checks" method="post" action="{{ repo.url }}/settings/checks"> |
| 54 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 55 |
<h2>Required checks</h2> |
| 56 |
<label for="required_checks">Check names that must pass on a proposal's projected state (comma-separated)</label><input type="text" id="required_checks" name="required_checks" value="{{ required_checks }}" placeholder="build, test"> |
| 57 |
<p class="small mute">Any token with <code>checks:write</code> reports checks with <code>POST {{ shell.base_url }}/api/v1/repos/{{ repo.owner }}/{{ repo.name }}/checks</code>.</p> |
| 58 |
<button type="submit">SAVE</button> |
| 59 |
</form> |
| 60 |
{% if role == crate::auth::Role::Admin %} |
| 61 |
<section class="panel" id="webhooks"> |
| 62 |
<h2>Webhooks</h2> |
| 63 |
{% if hooks.is_empty() %}<p class="mute small">None.</p>{% else %} |
| 64 |
<table class="small"><tr><th>URL</th><th>Events</th><th>Active</th><th></th></tr> |
| 65 |
{% for h in hooks %}<tr><td>{{ h.url }}</td><td>{{ h.events }}</td><td>{% if h.active %}yes{% else %}no{% endif %}</td> |
| 66 |
<td><a class="small" href="{{ repo.url }}/settings/hooks/{{ h.id }}/deliveries">deliveries</a> |
| 67 |
<form class="tiny" method="post" action="{{ repo.url }}/settings/hooks"><input type="hidden" name="_csrf" value="{{ shell.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 %} |
| 68 |
</table>{% endif %} |
| 69 |
<form class="card" method="post" action="{{ repo.url }}/settings/hooks"> |
| 70 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 71 |
<label for="hurl">URL</label><input type="text" id="hurl" name="url" placeholder="https://…" required> |
| 72 |
<label for="hsecret">Secret (signs each delivery)</label><input type="text" id="hsecret" name="secret"> |
| 73 |
<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="*"> |
| 74 |
<button type="submit">ADD WEBHOOK</button> |
| 75 |
</form> |
| 76 |
</section> |
| 77 |
<section class="panel" id="collaborators"> |
| 78 |
<h2>Collaborators</h2> |
| 79 |
{% if collaborators.is_empty() %}<p class="mute small">Nobody beyond the owner{% if !teams.is_empty() %} and the organisation's members{% endif %}.</p>{% else %} |
| 80 |
<table class="small"> |
| 81 |
{% for c in collaborators %} |
| 82 |
<tr><td>{% if let Some(a) = c.account %}<a href="/{{ a.username }}">{{ a.username }}</a>{% else if let Some(t) = c.team %}team {{ t.name }}{% endif %}</td><td>{{ c.role }}</td> |
| 83 |
<td><form class="tiny" method="post" action="{{ repo.url }}/settings/collaborators"><input type="hidden" name="_csrf" value="{{ shell.csrf }}">{% if let Some(a) = c.account %}<input type="hidden" name="username" value="{{ a.username }}">{% else if let Some(t) = c.team %}<input type="hidden" name="team" value="{{ t.name }}">{% endif %}<button name="remove" value="1">remove</button></form></td></tr> |
| 84 |
{% endfor %} |
| 85 |
</table>{% endif %} |
| 86 |
<form class="card" method="post" action="{{ repo.url }}/settings/collaborators"> |
| 87 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 88 |
<div class="row"> |
| 89 |
<div><label for="username">Account</label><input type="text" id="username" name="username"></div> |
| 90 |
{% if !teams.is_empty() %}<div><label for="team">or team</label><select id="team" name="team"><option value="">—</option>{% for t in teams %}<option value="{{ t.name }}">{{ t.name }}</option>{% endfor %}</select></div>{% endif %} |
| 91 |
<div><label for="role">Role</label><select id="role" name="role"><option value="read">read</option><option value="triage">triage</option><option value="write" selected>write</option><option value="maintain">maintain</option><option value="admin">admin</option></select></div> |
| 92 |
</div> |
| 93 |
<button type="submit">ADD</button> |
| 94 |
</form> |
| 95 |
</section> |
| 96 |
<details class="danger" id="danger"> |
| 97 |
<summary>Delete this repository</summary> |
| 98 |
<form class="card" method="post" action="{{ repo.url }}/settings/delete"> |
| 99 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 100 |
<p class="small">The repository moves to the trash and is removed after the retention period. Type <code>{{ repo.owner }}/{{ repo.name }}</code> to confirm.</p> |
| 101 |
<input type="text" name="confirm" required> |
| 102 |
<button type="submit">DELETE</button> |
| 103 |
</form> |
| 104 |
</details> |
| 105 |
{% endif %} |
| 106 |
</div> |
| 107 |
</div> |
| 108 |
{% endblock %} |