| 1 |
{% extends "base.html" %} |
| 2 |
{% import "webhooks_panel.html" as w %} |
| 3 |
{% import "assistants_panel.html" as ai %} |
| 4 |
{% import "repo_tabs.html" as m %} |
| 5 |
{% block title %}Settings · {{ repo.owner }}/{{ repo.name }}{% endblock %} |
| 6 |
{% block bodyattrs %} data-repo="{{ repo.url }}"{% endblock %} |
| 7 |
{% block tabs %}{% call m::tabs(repo, "settings") %}{% endblock %} |
| 8 |
{% block content %} |
| 9 |
<div class="head"><h1>Settings <small>{{ repo.owner }}/{{ repo.name }}</small></h1></div> |
| 10 |
{% if let Some(n) = notice %}<p class="note">{{ n }}</p>{% endif %} |
| 11 |
{% if let Some(e) = error %}<p class="error">{{ e }}</p>{% endif %} |
| 12 |
<div class="sectioned"> |
| 13 |
<nav class="section-nav" aria-label="Sections"> |
| 14 |
<a href="#general">General</a> |
| 15 |
<a href="#landing">Landing requirements</a> |
| 16 |
<a href="#git-mirror">Git mirror</a> |
| 17 |
<a href="#checks">Required checks</a> |
| 18 |
<a href="#flow">OxygenFlow</a> |
| 19 |
{% if role == crate::auth::Role::Admin %}<a href="#webhooks">Webhooks</a> |
| 20 |
<a href="#assistants">AI assistants</a> |
| 21 |
<a href="#collaborators">Collaborators</a> |
| 22 |
<a href="#danger">Delete</a>{% endif %} |
| 23 |
</nav> |
| 24 |
<div class="sections"> |
| 25 |
<form class="card wide" id="general" method="post" action="{{ repo.url }}/settings"> |
| 26 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 27 |
<h2>General</h2> |
| 28 |
<label for="description">Description</label><input type="text" id="description" name="description" value="{{ row.description }}"> |
| 29 |
<label for="topics">Topics</label><input type="text" id="topics" name="topics" value="{{ row.topics }}" placeholder="rust version-control retro"> |
| 30 |
<p class="small mute">Separated by spaces or commas; letters, digits and dashes. People find repositories by them under Explore.</p> |
| 31 |
<label for="default_bookmark">Default bookmark</label><input type="text" id="default_bookmark" name="default_bookmark" value="{{ row.default_bookmark }}"> |
| 32 |
<label>Visibility{% if role != crate::auth::Role::Admin %} <span class="mute">(admins only)</span>{% endif %}</label> |
| 33 |
<div class="choice"> |
| 34 |
<label><input type="radio" name="visibility" value="public"{% if row.visibility == "public" %} checked{% endif %}> public</label> |
| 35 |
<label><input type="radio" name="visibility" value="internal"{% if row.visibility == "internal" %} checked{% endif %}> internal</label> |
| 36 |
<label><input type="radio" name="visibility" value="private"{% if row.visibility == "private" %} checked{% endif %}> private</label> |
| 37 |
</div> |
| 38 |
<button type="submit">SAVE</button> |
| 39 |
</form> |
| 40 |
<form class="card wide" id="landing" method="post" action="{{ repo.url }}/settings/requirements"> |
| 41 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 42 |
<h2>Landing requirements</h2> |
| 43 |
<label for="required_approvals">Sealed approvals required</label><input type="number" id="required_approvals" name="required_approvals" min="0" value="{{ requirements.required_approvals }}"> |
| 44 |
<div class="choice"> |
| 45 |
<label><input type="checkbox" name="require_owners" value="1"{% if requirements.require_owners %} checked{% endif %}> code owners from <code>.oxyowners</code> must approve</label> |
| 46 |
<label><input type="checkbox" name="allow_conflicts" value="1"{% if requirements.allow_conflicts %} checked{% endif %}> allow landing with conflicts</label> |
| 47 |
</div> |
| 48 |
<button type="submit">SAVE</button> |
| 49 |
</form> |
| 50 |
<form class="card wide" id="git-mirror" method="post" action="{{ repo.url }}/settings/mirror"> |
| 51 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 52 |
<h2>Git mirror</h2> |
| 53 |
<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> |
| 54 |
<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> |
| 55 |
<button type="submit">SAVE</button> |
| 56 |
</form> |
| 57 |
<form class="card wide" id="checks" method="post" action="{{ repo.url }}/settings/checks"> |
| 58 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 59 |
<h2>Required checks</h2> |
| 60 |
<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"> |
| 61 |
<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> |
| 62 |
<button type="submit">SAVE</button> |
| 63 |
</form> |
| 64 |
<form class="card wide" id="flow" method="post" action="{{ repo.url }}/settings/flow"> |
| 65 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 66 |
<h2>OxygenFlow</h2> |
| 67 |
<p>Pushes to this repository {% if flow_enabled %}<strong>start runs</strong>{% else %}<strong>do not start runs</strong>{% endif %} of its <code>.flow/pipeline.kdl</code>.</p> |
| 68 |
{% if site_admin %} |
| 69 |
<div class="choice"> |
| 70 |
<label><input type="radio" name="flow" value="on"{% if row.flow == "on" %} checked{% endif %}> on</label> |
| 71 |
<label><input type="radio" name="flow" value="off"{% if row.flow == "off" %} checked{% endif %}> off</label> |
| 72 |
<label><input type="radio" name="flow" value="default"{% if row.flow.is_empty() %} checked{% endif %}> site default ({% if flow_default %}on{% else %}off{% endif %}, from <code>[flow] repos</code> in <code>hub.toml</code>)</label> |
| 73 |
</div> |
| 74 |
<p class="small mute">Runs use the site's runners, so only site administrators change this. It takes effect at the next push.</p> |
| 75 |
<button type="submit">SAVE</button> |
| 76 |
{% else %} |
| 77 |
<p class="small mute">A site administrator turns OxygenFlow on or off here.</p> |
| 78 |
{% endif %} |
| 79 |
</form> |
| 80 |
{% if role == crate::auth::Role::Admin %} |
| 81 |
<section class="panel" id="runners"> |
| 82 |
<h2>Runners</h2> |
| 83 |
<p class="small">The OxygenFlow runners that may take this repository's jobs: the site's, {{ row.owner }}'s, and this repository's own.</p> |
| 84 |
{% if let Some(t) = runner_token %}<p class="note">Register a runner for this repository with:</p><pre class="snippet">flow runner register {{ shell.base_url }} --token {{ t }} --name NAME</pre>{% endif %} |
| 85 |
{% if runners.is_empty() %}<p class="mute small">None yet: runs wait until a runner that serves this repository is added.</p>{% else %} |
| 86 |
<div class="table"><table> |
| 87 |
<tr><th>Runner</th><th>Status</th><th>Serves</th><th>Machine</th><th></th></tr> |
| 88 |
{% for (r, serves, own) in runners %}<tr><td><strong>{{ r.name }}</strong></td><td><span class="runner-status st-{{ r.status() }}">{{ r.status() }}</span></td><td class="small">{{ serves }}</td><td class="small">{% if r.arch.is_empty() %}<span class="mute">unknown</span>{% else %}{{ r.arch }} · {{ r.os }}{% endif %}</td> |
| 89 |
<td>{% if *own %}<form class="tiny" method="post" action="{{ repo.url }}/settings/runners/{{ r.id }}/remove" onsubmit="return confirm('Remove {{ r.name }}? Its credential stops working.')"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button class="danger-btn">remove</button></form>{% endif %}</td></tr>{% endfor %} |
| 90 |
</table></div>{% endif %} |
| 91 |
<form method="post" action="{{ repo.url }}/settings/runners/token"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button type="submit">Add a runner for this repository</button></form> |
| 92 |
</section> |
| 93 |
{% call w::panel(repo.url ~ "/settings", hooks, shell.csrf, "Each delivery is signed with the secret (X-Oxyhub-Signature) and retried with backoff for a day.") %} |
| 94 |
{% call ai::panel(repo.url ~ "/settings", assistants, shell.csrf, "This repository may ask these, beside the ones the site and its owner provide.") %} |
| 95 |
<section class="panel" id="collaborators"> |
| 96 |
<h2>Collaborators</h2> |
| 97 |
{% if collaborators.is_empty() %}<p class="mute small">Nobody beyond the owner{% if !teams.is_empty() %} and the organisation's members{% endif %}.</p>{% else %} |
| 98 |
<table class="small"> |
| 99 |
{% for c in collaborators %} |
| 100 |
<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> |
| 101 |
<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> |
| 102 |
{% endfor %} |
| 103 |
</table>{% endif %} |
| 104 |
<form class="card" method="post" action="{{ repo.url }}/settings/collaborators"> |
| 105 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 106 |
<div class="row"> |
| 107 |
<div><label for="username">Account</label><input type="text" id="username" name="username"></div> |
| 108 |
{% 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 %} |
| 109 |
<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> |
| 110 |
</div> |
| 111 |
<button type="submit">ADD</button> |
| 112 |
</form> |
| 113 |
</section> |
| 114 |
<details class="danger" id="danger"> |
| 115 |
<summary>Delete this repository</summary> |
| 116 |
<form class="card" method="post" action="{{ repo.url }}/settings/delete"> |
| 117 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 118 |
<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> |
| 119 |
<input type="text" name="confirm" required> |
| 120 |
<button type="submit">DELETE</button> |
| 121 |
</form> |
| 122 |
</details> |
| 123 |
{% endif %} |
| 124 |
</div> |
| 125 |
</div> |
| 126 |
{% endblock %} |