OXYGENHUB
# d7e2c2754807 oxygenhub / templates / org_settings.html
13.0 KiB · HTML · last changed Runner updates for an organisation's own runners 10 days ago source blame history raw
19bb31ff Andy McCall ↶ 1
{% extends "base.html" %}
8fb35df7 Andy McCall ↶ 2
{% import "webhooks_panel.html" as w %}
e71846aa Andy McCall ↶ 3
{% import "assistants_panel.html" as ai %}
2a83f530 Andy McCall ↶ 4
{% import "variables_panel.html" as va %}
4ac01a73 Andy McCall ↶ 5
{% import "secrets_panel.html" as se %}
dc5c6429 Andy McCall ↶ 6
{% import "runner_update_fields.html" as ruf %}
19bb31ff Andy McCall ↶ 7
{% block title %}{{ org.name }} settings{% endblock %}
8
{% block content %}
9
<div class="head"><h1>{{ org.name }} <small>organisation settings · <a href="/{{ org.name }}">repositories</a></small></h1></div>
64caed18 Andy McCall ↶ 10
<div class="sectioned">
11
<nav class="section-nav" aria-label="Sections">
12
  <a href="#general">General</a>
a160b98f Andy McCall ↶ 13
  <a href="#logo">Logo</a>
64caed18 Andy McCall ↶ 14
  <a href="#members">Members</a>
8fb35df7 Andy McCall ↶ 15
  <a href="#webhooks">Webhooks</a>
2a83f530 Andy McCall ↶ 16
  <a href="#variables">Variables</a>
4ac01a73 Andy McCall ↶ 17
  <a href="#secrets">Secrets</a>
e71846aa Andy McCall ↶ 18
  <a href="#assistants">AI assistants</a>
64caed18 Andy McCall ↶ 19
  <a href="#teams">Teams</a>
8ddebaa7 Andy McCall ↶ 20
  <a href="#storage">Storage</a>
d7d18246 Andy McCall ↶ 21
  <a href="#backups">Backups</a>
64caed18 Andy McCall ↶ 22
</nav>
23
<div class="sections">
19bb31ff Andy McCall ↶ 24
{% if let Some(n) = notice %}<p class="note">{{ n }}</p>{% endif %}
25
{% if let Some(e) = error %}<p class="error">{{ e }}</p>{% endif %}
d7d18246 Andy McCall ↶ 26
<section class="panel" id="backups"><h2>Backups</h2><p class="small">Copy every repository {{ org.name }} owns, with its issues, proposals and wiki, hourly to a bucket or directory you control. <a class="go small" href="/orgs/{{ org.name }}/settings/backups">Set up backups</a></p></section>
64caed18 Andy McCall ↶ 27
<form class="card" id="general" method="post" action="/orgs/{{ org.name }}/settings">
19bb31ff Andy McCall ↶ 28
  <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
29
  <label for="display_name">Display name</label><input type="text" id="display_name" name="display_name" value="{{ org.display_name }}">
30
  <label for="description">Description</label><input type="text" id="description" name="description" value="{{ org.description }}">
31
  <label for="default_role">Members' default role on the organisation's repositories</label>
32
  <select id="default_role" name="default_role">{% for r in ["none", "read", "triage", "write", "maintain", "admin"] %}<option value="{{ r }}"{% if org.default_role.as_str() == *r %} selected{% endif %}>{{ r }}</option>{% endfor %}</select>
33
  <button type="submit">SAVE</button>
a160b98f Andy McCall ↶ 34
</form>
35
<form class="card picture-card" id="logo" method="post" action="/orgs/{{ org.name }}/settings/avatar" enctype="multipart/form-data">
36
  <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
37
  <h2>Logo</h2>
38
  <div class="picture-row">
39
    <img class="avatar xl" src="/avatar/{{ org.name }}?v={{ org.avatar }}" alt="{{ org.name }} logo" width="96" height="96">
40
    <div>
41
      <label for="logo-file">Upload a logo</label>
42
      <input type="file" id="logo-file" name="picture" accept="image/png,image/jpeg,image/webp">
43
      <p class="small mute">PNG (transparency is kept), JPEG or WebP, up to 5 MiB. It is cropped to the middle square and resized to 400×400.</p>
44
      <button type="submit" name="action" value="upload">UPLOAD</button>
45
      {% if !org.avatar.is_empty() %}<button type="submit" name="action" value="remove" class="danger-btn">REMOVE</button>{% endif %}
46
    </div>
47
  </div>
19bb31ff Andy McCall ↶ 48
</form>
64caed18 Andy McCall ↶ 49
<section class="panel" id="members">
19bb31ff Andy McCall ↶ 50
  <h2>Members</h2>
51
  <table class="small">{% for (a, r) in members %}<tr><td><a href="/{{ a.username }}">{{ a.username }}</a></td><td>{{ r }}</td>
52
  <td><form class="tiny" method="post" action="/orgs/{{ org.name }}/settings/members"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><input type="hidden" name="username" value="{{ a.username }}"><button name="remove" value="1">remove</button></form></td></tr>{% endfor %}</table>
53
  <form class="card" method="post" action="/orgs/{{ org.name }}/settings/members">
54
    <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
55
    <div class="row"><div><label for="username">Account</label><input type="text" id="username" name="username" required></div>
56
    <div><label for="role">Role</label><select id="role" name="role"><option value="member">member</option><option value="owner">owner</option></select></div></div>
57
    <button type="submit">ADD OR CHANGE</button>
58
  </form>
59
</section>
8ddebaa7 Andy McCall ↶ 60
<form class="card" id="storage" method="post" action="/orgs/{{ org.name }}/settings/storage">
61
  <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
62
  <h2>Storage</h2>
63
  <p class="small mute">Where the organisation's new repositories may live. Repositories that exist stay where they are.</p>
64
  <label class="check"><input type="checkbox" name="require_bucket" value="1"{% if policy.require_bucket %} checked{% endif %}> Keep every new repository in a bucket, not on this server's disk</label>
65
  <label for="allowed">Buckets allowed, one store URL prefix per line (empty: any bucket)</label>
66
  <textarea id="allowed" name="allowed" rows="3" placeholder="s3://acme-london/repos/&#10;gs://acme-eu/" spellcheck="false">{{ policy.allowed.join("\n") }}</textarea>
67
  <p class="small mute">Listing the organisation's own buckets keeps its data where those buckets are: the provider, the region, the country.</p>
68
  <button type="submit">SAVE</button>
69
</form>
64caed18 Andy McCall ↶ 70
<section class="panel" id="teams">
19bb31ff Andy McCall ↶ 71
  <h2>Teams</h2>
72
  {% for (t, ms) in teams %}
73
  <p><strong>{{ t.name }}</strong>: {% for a in ms %}{{ a.username }}{% if !loop.last %}, {% endif %}{% endfor %}{% if ms.is_empty() %}<span class="mute">nobody yet</span>{% endif %}
74
  <form class="tiny" method="post" action="/orgs/{{ org.name }}/settings/teams"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><input type="hidden" name="team" value="{{ t.name }}"><button name="action" value="delete">delete team</button></form></p>
75
  {% endfor %}
76
  <form class="card" method="post" action="/orgs/{{ org.name }}/settings/teams">
77
    <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
78
    <div class="row"><div><label for="team">Team</label><input type="text" id="team" name="team" required></div>
79
    <div><label for="tuser">Account (for add or remove)</label><input type="text" id="tuser" name="username"></div></div>
80
    <div class="choice"><button type="submit" name="action" value="create">CREATE TEAM</button> <button type="submit" name="action" value="add">ADD MEMBER</button> <button type="submit" name="action" value="remove">REMOVE MEMBER</button></div>
81
  </form>
82
</section>
7974adb0 Andy McCall ↶ 83
<section class="panel" id="runners">
84
  <h2>Runners</h2>
85
  <p class="small">The OxygenFlow runners that may take this organisation's jobs: the site's, the organisation's, and those of its repositories.</p>
86
  {% if let Some(t) = runner_token %}<p class="note">Register a runner for the organisation with:</p><pre class="snippet">flow runner register {{ shell.base_url }} --token {{ t }} --name NAME</pre>{% endif %}
87
  {% if runners.is_empty() %}<p class="mute small">None yet: runs wait until a runner that serves them is added.</p>{% else %}
88
  <div class="table"><table>
89
  <tr><th>Runner</th><th>Status</th><th>Serves</th><th>Machine</th><th></th></tr>
90
  {% 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>
a7aa76ac Andy McCall 91
  <td>{% if *own %}<form class="tiny" method="post" action="/orgs/{{ org.name }}/settings/runners/{{ r.id }}/remove" data-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 %}
7974adb0 Andy McCall ↶ 92
  </table></div>{% endif %}
93
  <form method="post" action="/orgs/{{ org.name }}/settings/runners/token"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button type="submit">Add a runner for the organisation</button></form>
94
</section>
dc5c6429 Andy McCall ↶ 95
<section class="panel" id="runner-updates">
96
  <h2>Runner updates</h2>
97
  <p class="small">The organisation's own runners can update themselves: off unless chosen. Try a build on a test group first (runners you pick, or a percentage of them, the same machines every time), then turn updates on for the rest. A runner's own setting wins over a group's, a group's over the organisation's, the organisation's over the site's.</p>
98
  {% let ou = updates.owners[0] %}
99
  <form class="pol-form" method="post" action="/orgs/{{ org.name }}/settings/runners/updates/policy">
100
    <input type="hidden" name="_csrf" value="{{ shell.csrf }}"><input type="hidden" name="scope" value="owner"><input type="hidden" name="key" value="{{ org.name }}">
101
    <strong>The organisation</strong>{% call ruf::policy_fields(ou, false) %}<button type="submit">Save</button>
102
  </form>
103
  <h3>Test groups</h3>
104
  {% if updates.groups.is_empty() %}<p class="mute small">None yet.</p>{% endif %}
105
  {% for gv in updates.groups %}{% let g = gv.g %}
106
  <div class="card wide update-group">
107
    <h3>{{ g.name }} <small class="mute">{% if let Some(p) = g.percent %}{{ p }}%{% else %}chosen{% endif %} · {{ gv.members.len()|plural("runner", "runners") }} now</small></h3>
108
    <p class="small">{% for m in gv.members %}<span class="lbl">{{ m }}</span> {% endfor %}</p>
109
    <form class="pol-form" method="post" action="/orgs/{{ org.name }}/settings/runners/updates/policy">
110
      <input type="hidden" name="_csrf" value="{{ shell.csrf }}"><input type="hidden" name="scope" value="group"><input type="hidden" name="key" value="{{ g.id }}">
111
      {% call ruf::policy_fields(gv.policy, false) %}<button type="submit">Save settings</button>
112
    </form>
113
    <details><summary class="small">Who is in it</summary>
114
    <form method="post" action="/orgs/{{ org.name }}/settings/runners/updates/groups/{{ g.id }}">
115
      <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
116
      <label class="pol"><input type="radio" name="mode" value="percent"{% if g.percent.is_some() %} checked{% endif %}> a percentage: <input type="number" name="percent" min="1" max="100" value="{% if let Some(p) = g.percent %}{{ p }}{% endif %}">%</label>
117
      <label class="pol"><input type="radio" name="mode" value="chosen"{% if g.percent.is_none() %} checked{% endif %}> these runners:</label>
118
      <div class="pol-row">{% for rv in updates.runners %}<label class="pol"><input type="checkbox" name="runner" value="{{ rv.r.id }}"{% if gv.chosen.contains(rv.r.id) %} checked{% endif %}> {{ rv.r.name }}</label>{% endfor %}</div>
119
      <button type="submit">Save members</button>
120
    </form>
121
    <form class="tiny" method="post" action="/orgs/{{ org.name }}/settings/runners/updates/groups/{{ g.id }}/delete" data-confirm="Remove the test group {{ g.name }}?"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button class="danger-btn">remove group</button></form>
122
    </details>
123
  </div>
124
  {% endfor %}
125
  <form class="card wide" method="post" action="/orgs/{{ org.name }}/settings/runners/updates/groups">
126
    <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
127
    <h3>New test group</h3>
128
    <label class="pol">Name <input type="text" name="name" size="14" required placeholder="canary"></label>
129
    <label class="pol"><input type="radio" name="mode" value="percent"> a percentage of the organisation's runners: <input type="number" name="percent" min="1" max="100">%</label>
130
    <label class="pol"><input type="radio" name="mode" value="chosen" checked> these runners:</label>
131
    <div class="pol-row">{% for rv in updates.runners %}<label class="pol"><input type="checkbox" name="runner" value="{{ rv.r.id }}"> {{ rv.r.name }}</label>{% endfor %}</div>
132
    <button type="submit">Make group</button>
133
  </form>
134
  {% if !updates.runners.is_empty() %}
135
  <h3>The organisation's runners</h3>
136
  <div class="table"><table>
137
  <tr><th>Runner</th><th>Runs</th><th>Its policy</th><th>Now</th><th>Last said</th><th>Its own settings</th></tr>
138
  {% for rv in updates.runners %}{% let r = rv.r %}
139
  <tr><td><strong>{{ r.name }}</strong>{% for g in rv.groups %} <span class="lbl">{{ g }}</span>{% endfor %}</td>
140
    <td class="small">{% if r.version.is_empty() %}<span class="mute">unknown</span>{% else %}flow {{ r.version }}{% endif %}</td>
141
    <td class="small">{{ rv.effective_words() }}</td><td class="small">{{ rv.offer }}</td>
142
    <td class="small">{% if r.update_note.is_empty() %}<span class="mute">nothing yet</span>{% else %}{{ r.update_note }}{% endif %}</td>
143
    <td><form class="pol-form tiny" method="post" action="/orgs/{{ org.name }}/settings/runners/updates/policy"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><input type="hidden" name="scope" value="runner"><input type="hidden" name="key" value="{{ r.id }}">{% call ruf::policy_fields(rv.policy, false) %}<button type="submit">set</button></form></td></tr>
144
  {% endfor %}
145
  </table></div>
146
  {% endif %}
147
</section>
8fb35df7 Andy McCall ↶ 148
{% call w::panel("/orgs/" ~ org.name ~ "/settings", hooks, shell.csrf, "These hear every repository of the organisation, as well as each repository's own webhooks.") %}
2a83f530 Andy McCall ↶ 149
{% call va::panel("/orgs/" ~ org.name ~ "/settings", variables, shell.csrf, "Jobs of every repository of the organisation get these, beside the site's and each repository's own.") %}
4ac01a73 Andy McCall ↶ 150
{% call se::panel("/orgs/" ~ org.name ~ "/settings", secrets, shell.csrf, "Jobs of every repository of the organisation may use these, beside the site's and each repository's own.") %}
e71846aa Andy McCall ↶ 151
{% call ai::panel("/orgs/" ~ org.name ~ "/settings", assistants, shell.csrf, "Every repository of the organisation may ask these, beside the site's and its own.") %}
64caed18 Andy McCall ↶ 152
</div>
153
</div>
19bb31ff Andy McCall ↶ 154
{% endblock %}