OXYGENHUB
# db72849cd22e oxygenhub / templates / repo_settings.html
6.6 KiB · HTML · last changed Milestone 0.5: API, webhooks, checks 1 month ago source blame history raw
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
<form class="card wide" method="post" action="{{ repo.url }}/settings">
11
  <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
12
  <h2>General</h2>
13
  <label for="description">Description</label><input type="text" id="description" name="description" value="{{ row.description }}">
14
  <label for="default_bookmark">Default bookmark</label><input type="text" id="default_bookmark" name="default_bookmark" value="{{ row.default_bookmark }}">
15
  <label>Visibility{% if role != crate::auth::Role::Admin %} <span class="mute">(admins only)</span>{% endif %}</label>
16
  <div class="choice">
17
    <label><input type="radio" name="visibility" value="public"{% if row.visibility == "public" %} checked{% endif %}> public</label>
18
    <label><input type="radio" name="visibility" value="internal"{% if row.visibility == "internal" %} checked{% endif %}> internal</label>
19
    <label><input type="radio" name="visibility" value="private"{% if row.visibility == "private" %} checked{% endif %}> private</label>
20
  </div>
21
  <button type="submit">SAVE</button>
22
</form>
23
<form class="card wide" method="post" action="{{ repo.url }}/settings/requirements">
24
  <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
25
  <h2>Landing requirements</h2>
26
  <label for="required_approvals">Sealed approvals required</label><input type="number" id="required_approvals" name="required_approvals" min="0" value="{{ requirements.required_approvals }}">
27
  <div class="choice">
28
    <label><input type="checkbox" name="require_owners" value="1"{% if requirements.require_owners %} checked{% endif %}> code owners from <code>.oxyowners</code> must approve</label>
29
    <label><input type="checkbox" name="allow_conflicts" value="1"{% if requirements.allow_conflicts %} checked{% endif %}> allow landing with conflicts</label>
30
  </div>
31
  <button type="submit">SAVE</button>
32
</form>
33
<form class="card wide" method="post" action="{{ repo.url }}/settings/checks">
34
  <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
35
  <h2>Required checks</h2>
36
  <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">
37
  <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>
38
  <button type="submit">SAVE</button>
39
</form>
40
{% if role == crate::auth::Role::Admin %}
41
<section class="panel">
42
  <h2>Webhooks</h2>
43
  {% if hooks.is_empty() %}<p class="mute small">None.</p>{% else %}
44
  <table class="small"><tr><th>URL</th><th>Events</th><th>Active</th><th></th></tr>
45
  {% for h in hooks %}<tr><td>{{ h.url }}</td><td>{{ h.events }}</td><td>{% if h.active %}yes{% else %}no{% endif %}</td>
46
  <td><a class="small" href="{{ repo.url }}/settings/hooks/{{ h.id }}/deliveries">deliveries</a>
47
  <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 %}
48
  </table>{% endif %}
49
  <form class="card" method="post" action="{{ repo.url }}/settings/hooks">
50
    <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
51
    <label for="hurl">URL</label><input type="text" id="hurl" name="url" placeholder="https://…" required>
52
    <label for="hsecret">Secret (signs each delivery)</label><input type="text" id="hsecret" name="secret">
53
    <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="*">
54
    <button type="submit">ADD WEBHOOK</button>
55
  </form>
56
</section>
57
<section class="panel">
58
  <h2>Collaborators</h2>
59
  {% if collaborators.is_empty() %}<p class="mute small">Nobody beyond the owner{% if !teams.is_empty() %} and the organisation's members{% endif %}.</p>{% else %}
60
  <table class="small">
61
  {% for c in collaborators %}
62
  <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>
63
  <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>
64
  {% endfor %}
65
  </table>{% endif %}
66
  <form class="card" method="post" action="{{ repo.url }}/settings/collaborators">
67
    <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
68
    <div class="row">
69
      <div><label for="username">Account</label><input type="text" id="username" name="username"></div>
70
      {% 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 %}
71
      <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>
72
    </div>
73
    <button type="submit">ADD</button>
74
  </form>
75
</section>
76
<details class="danger">
77
  <summary>Delete this repository</summary>
78
  <form class="card" method="post" action="{{ repo.url }}/settings/delete">
79
    <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
80
    <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>
81
    <input type="text" name="confirm" required>
82
    <button type="submit">DELETE</button>
83
  </form>
84
</details>
85
{% endif %}
86
{% endblock %}