Commit e5000142e8

e5000142e8d889dcf0972fbcb6c5998fab104dbd

parent: 19da287c68

Verified · cmc ci/build: success ci/quality: success ci/test: failure

cmc <hello@cleberg.net> · 2026-11-25 07:18 UTC

web: polish repo-level tabs (code, issues, mrs, builds, releases, settings)

Layout: unified · split

Changed files (10)
internal/web/static/app.js +13 −4
@@ -374,11 +374,19 @@
374374 }
375375 });
376376
377 // ---- 8. Live client-side table & list filters ----
377 // ---- 8. Live client-side table, list & link filters ----
378378 document.addEventListener('input', (e) => {
379 const inp = e.target.closest('input[data-filter-table], input[data-filter-list]');
379 const inp = e.target.closest('input[data-filter-table], input[data-filter-list], input[data-filter-links]');
380380 if (!inp) return;
381381 const q = inp.value.trim().toLowerCase();
382 if (inp.dataset.filterLinks) {
383 const box = inp.closest('.' + inp.dataset.filterLinks);
384 if (!box) return;
385 for (const a of box.querySelectorAll('a:not(.allrefs)')) {
386 a.hidden = q !== '' && !a.textContent.toLowerCase().includes(q);
387 }
388 return;
389 }
382390 if (inp.dataset.filterTable) {
383391 const table = document.getElementById(inp.dataset.filterTable);
384392 if (!table) return;
@@ -397,11 +405,11 @@
397405 }
398406 });
399407
400 // ---- 9. In-place Refresh (/admin, /) ----
408 // ---- 9. In-place Refresh (/admin, /, /builds, /notifications) ----
401409 document.addEventListener('click', async (e) => {
402410 const btn = e.target.closest('button[data-refresh]');
403411 if (!btn) return;
404 const url = btn.dataset.refresh;
412 const url = btn.dataset.refresh === 'self' ? location.href : btn.dataset.refresh;
405413 const targetId = btn.dataset.refreshTarget || 'admin-queues';
406414 btn.disabled = true;
407415 try {
@@ -413,6 +421,7 @@
413421 const cur = document.getElementById(targetId);
414422 if (next && cur) {
415423 cur.replaceWith(next);
424 initCopyButtons(next);
416425 initScrollSpy();
417426 showToast('Refreshed');
418427 }
internal/web/static/style.css +44
@@ -2403,3 +2403,47 @@ nav.newtabs {
24032403ul.issuelist li.unread {
24042404 box-shadow: inset 3px 0 0 var(--mark);
24052405}
2406
2407/* ---- repo-level tabs polish ---- */
2408.treefilter {
2409 width: 11rem;
2410 min-width: 8rem;
2411 height: 32px;
2412}
2413.reffilter {
2414 display: block;
2415 width: calc(100% - var(--sp-4));
2416 margin: var(--sp-1) var(--sp-2) var(--sp-2);
2417 height: 28px;
2418 font-size: var(--fs-1);
2419}
2420.facts .about, .facts .clone {
2421 background: var(--canvas);
2422 border: 1px solid var(--faint);
2423 border-radius: var(--r-card);
2424 padding: var(--sp-4);
2425}
2426.popform-stack {
2427 flex-direction: column;
2428 align-items: stretch;
2429}
2430.popform-stack input, .popform-stack select, .popform-stack button {
2431 width: 100%;
2432}
2433.releasehead-top {
2434 display: flex;
2435 align-items: center;
2436 gap: var(--sp-2);
2437 flex-wrap: wrap;
2438}
2439.releasehead-top h2 {
2440 margin: 0;
2441 display: inline-flex;
2442 align-items: center;
2443 gap: var(--sp-2);
2444 flex-wrap: wrap;
2445}
2446article.release.setcard {
2447 border-top: 1px solid var(--faint);
2448 padding: var(--sp-5);
2449}
internal/web/templates/build.html +7 −2
@@ -1,16 +1,20 @@
11{{define "width"}}wide{{end}}
22{{define "title"}}build {{.Build.Number}} · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
33{{define "content"}}
4<div id="build-root">
45{{if .Notice}}<p class="error" role="alert">{{.Notice}}</p>{{end}}
56<div class="headrow">
67<h1>Build {{.Build.Number}} <span class="chip check-{{.Build.Status}}">{{.Build.Status}}</span></h1>
78<span class="spacer"></span>
9<div class="btngroup">
10{{if not .Live}}<button type="button" class="btn" data-refresh="self" data-refresh-target="build-root">Refresh</button>{{end}}
811{{if and .CanWrite (or (eq .Build.Status "pending") (eq .Build.Status "running"))}}
9<form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/builds/{{.Build.Number}}/cancel" class="actions">
10 <button type="submit" class="btn">{{if eq .Build.Status "running"}}Cancel (stops at the runner's next check){{else}}Cancel{{end}}</button>
12<form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/builds/{{.Build.Number}}/cancel" class="inline">
13 <button type="submit" class="danger">{{if eq .Build.Status "running"}}Cancel (stops at the runner's next check){{else}}Cancel{{end}}</button>
1114</form>
1215{{end}}
1316</div>
17</div>
1418<p class="meta">{{.Build.Job}} on {{.Build.Ref}} · <code><a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/commit/{{.Build.SHA}}">{{printf "%.10s" .Build.SHA}}</a></code> · queued {{when .Build.CreatedAt}}{{if .Build.FinishedAt}} · finished {{when .Build.FinishedAt}}{{with .Duration}} · ran {{.}}{{end}}{{end}}{{if .Failed}} · <a href="#failed">Jump to failure</a>{{end}}</p>
1519{{if .Live}}<p class="meta">This page updates itself until the build ends. If it stops without a “build finished” line, reload to pick it up again. <a href="?follow=0">Show it without updates</a></p>
1620<pre class="code buildlog" tabindex="0">{{.Log}}</pre>
@@ -20,4 +24,5 @@
2024 <pre class="code buildlog" tabindex="0">{{.Text}}</pre>
2125</details>{{end}}
2226{{else if .Log}}<pre class="code buildlog" tabindex="0">{{.Log}}</pre>{{else}}<p class="empty-note">no log yet</p>{{end}}
27</div>
2328{{end}}
internal/web/templates/builds.html +20 −13
@@ -1,8 +1,8 @@
11{{define "width"}}wide{{end}}
22{{define "title"}}builds · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
33{{define "content"}}
4<div class="withcol">
5<nav class="sidecol" aria-label="Filters">
4<div class="withcol" id="builds-root">
5<nav class="sidecol" aria-label="Filters" data-tab-swap="builds-root">
66<details class="sidedrop">
77<summary><span class="sideword">Filters</span>{{range .Facets}}{{range .Items}}{{if .Active}} <span class="sideon">{{.Label}}</span>{{end}}{{end}}{{end}}</summary>
88 {{range .Facets}}{{if .Items}}<div class="grp">
@@ -22,22 +22,29 @@
2222<div class="colmain">
2323<div class="listhead">
2424 <h1>Builds</h1>
25 <span class="spacer"></span>
26 <div class="btngroup">
27 <button type="button" class="btn" data-refresh="self" data-refresh-target="builds-root">Refresh</button>
28 {{if and .CanWrite .Jobs}}<details class="popover">
29 <summary class="button">Run job</summary>
30 <div class="popmenu">
31 <form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/builds" class="popform popform-stack">
32 <label for="job" class="colhead">Run a job now</label>
33 <select id="job" name="job">
34 {{range .Jobs}}<option value="{{.Name}}">{{.Name}}{{if .Schedule}} (schedule {{.Schedule}}){{else if .Tags}} (tags {{.Tags}}){{end}}</option>{{end}}
35 </select>
36 <button type="submit">Run</button>
37 </form>
38 </div>
39 </details>{{end}}
40 </div>
2541</div>
2642{{if .Notice}}<p class="error" role="alert">{{.Notice}}</p>{{end}}
27{{if and .CanWrite .Jobs}}
28<form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/builds" class="setform">
29 <label for="job">Run a job now</label>
30 <select id="job" name="job">
31 {{range .Jobs}}<option value="{{.Name}}">{{.Name}}{{if .Schedule}} (schedule {{.Schedule}}){{else if .Tags}} (tags {{.Tags}}){{end}}</option>{{end}}
32 </select>
33 <button type="submit" class="btn">Run</button>
34</form>
35{{end}}
3643<details class="editbox"><summary>Status badge</summary>
3744<p class="meta">Paste into a README; it shows the newest build's state. Markdown:</p>
38<pre class="code" tabindex="0">[![build](https://{{.Host}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/badge/build.svg)](https://{{.Host}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/builds)</pre>
45<pre class="code copyable" tabindex="0">[![build](https://{{.Host}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/badge/build.svg)](https://{{.Host}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/builds)</pre>
3946<p class="meta">Org:</p>
40<pre class="code" tabindex="0">[[https://{{.Host}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/builds][https://{{.Host}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/badge/build.svg]]</pre>
47<pre class="code copyable" tabindex="0">[[https://{{.Host}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/builds][https://{{.Host}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/badge/build.svg]]</pre>
4148<p class="meta">Add <code>?job=name</code> for one job.</p>
4249</details>
4350<p class="meta">{{len .Builds}} build{{if ne (len .Builds) 1}}s{{end}} in {{len .Runs}} run{{if ne (len .Runs) 1}}s{{end}}{{if .Older}} on this page{{end}}{{if or .Filter.Ref .Filter.Status .Filter.Job}}, <a href="?">clear filters</a>{{end}}</p>
internal/web/templates/issues.html +7 −3
@@ -1,7 +1,7 @@
11{{define "width"}}wide{{end}}
22{{define "title"}}issues · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
33{{define "content"}}
4<div class="withcol">
4<div class="withcol" id="issues-root">
55{{template "sidecol" .Facets}}
66<div class="colmain">
77<div class="listhead">
@@ -13,9 +13,13 @@
1313 </form>
1414 {{range .Filters}}<p class="meta">{{.Key}}: {{if eq .Key "label"}}<span class="chip label" style="{{index $.LabelColors .Value}}">{{.Value}}</span>{{else}}<b>{{.Value}}</b>{{end}} <a href="{{.Clear}}">clear</a></p>{{end}}
1515 <span class="spacer"></span>
16 <p class="meta"><a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/milestones">milestones</a> · <a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/labels">labels</a>{{if .Viewer}} · <a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/issues/new">new issue</a>{{end}}</p>
16 <div class="btngroup">
17 <a class="button btn" href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/milestones">Milestones</a>
18 <a class="button btn" href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/labels">Labels</a>
19 {{if .Viewer}}<a class="button" href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/issues/new">New issue</a>{{end}}
20 </div>
1721</div>
18{{if .Facets}}<nav class="statebar" aria-label="State">{{range (index .Facets 0).Items}}<a{{if .Active}} aria-current="page"{{end}} href="{{.Href}}">{{.Label}}</a>{{end}}</nav>{{end}}
22{{if .Facets}}<nav class="statebar" aria-label="State" data-tab-swap="issues-root">{{range (index .Facets 0).Items}}<a{{if .Active}} aria-current="page"{{end}} href="{{.Href}}">{{.Label}}</a>{{end}}</nav>{{end}}
1923<ul class="issuelist rows">
2024{{range .Issues}}<li>
2125 <div class="issuemain">
internal/web/templates/layout.html +1
@@ -145,6 +145,7 @@
145145{{define "refmenu"}}{{if .Branches}}<details class="refmenu">
146146 <summary class="refchip">{{template "branchicon"}} {{.Ref}}</summary>
147147 <div class="refdrop">
148 {{if gt (len .Branches) 5}}<input type="search" class="reffilter" placeholder="Filter branches…" aria-label="Filter branches" data-filter-links="refdrop">{{end}}
148149 {{range .Branches}}<a href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/{{$.RefKind}}/{{.Name}}/{{$.DirPath}}">{{.Name}}</a>
149150 {{end}}<a class="allrefs" href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/refs">All refs →</a>
150151 </div>
internal/web/templates/mrs.html +6 −5
@@ -1,7 +1,7 @@
11{{define "width"}}wide{{end}}
22{{define "title"}}merge requests · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
33{{define "content"}}
4<div class="withcol">
4<div class="withcol" id="mrs-root">
55{{template "sidecol" .Facets}}
66<div class="colmain">
77<div class="listhead">
@@ -12,11 +12,12 @@
1212 <input type="hidden" name="state" value="{{.State}}">
1313 </form>
1414 {{range .Filters}}<p class="meta">{{.Key}}: {{if eq .Key "label"}}<span class="chip label" style="{{index $.LabelColors .Value}}">{{.Value}}</span>{{else}}<b>{{.Value}}</b>{{end}} <a href="{{.Clear}}">clear</a></p>{{end}}
15 <span class="spacer"></span>
16 {{if .CanOpenMR}}<a class="button" href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/mrs/new">New merge request</a>
17 {{else if .Viewer}}<a class="button btn" href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/fork">Fork this repository to propose a change</a>
18 {{else}}<a class="button btn" href="/login">Sign in to propose a change</a>{{end}}
1519</div>
16{{if .CanOpenMR}}<p class="meta"><a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/mrs/new">New merge request</a></p>
17{{else if .Viewer}}<p class="meta"><a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/fork">Fork this repository to propose a change</a></p>
18{{else}}<p class="meta"><a href="/login">Sign in to propose a change</a></p>{{end}}
19{{if .Facets}}<nav class="statebar" aria-label="State">{{range (index .Facets 0).Items}}<a{{if .Active}} aria-current="page"{{end}} href="{{.Href}}">{{.Label}}</a>{{end}}</nav>{{end}}
20{{if .Facets}}<nav class="statebar" aria-label="State" data-tab-swap="mrs-root">{{range (index .Facets 0).Items}}<a{{if .Active}} aria-current="page"{{end}} href="{{.Href}}">{{.Label}}</a>{{end}}</nav>{{end}}
2021<ul class="issuelist rows">
2122{{range .MRs}}{{$n := .Number}}<li>
2223 <div class="issuemain">
internal/web/templates/releases.html +38 −24
@@ -1,6 +1,10 @@
11{{define "title"}}releases · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
22{{define "content"}}
3<h1>Releases</h1>
3<div class="pagehead">
4 <h1>Releases</h1>
5 <span class="grow"></span>
6 <a class="button btn" href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/refs">All tags</a>
7</div>
48{{if .Notice}}<p class="error" role="alert">{{.Notice}}</p>{{end}}
59{{if and .CanWrite .FreeTags}}
610{{$want := .Draft.Or "release" "tag" ""}}
@@ -15,48 +19,58 @@
1519 </p>
1620 <p><input type="text" name="title" aria-label="Title" placeholder="title (defaults to the tag)" value="{{.Draft.Or "release" "title" ""}}"></p>
1721 <p><textarea name="notes" aria-label="Notes" rows="6" placeholder="what changed">{{.Draft.Or "release" "notes" ""}}</textarea></p>
18 <p><button type="submit" class="btn">Create release</button> {{template "previewbtn"}} <button type="submit" name="summarize" value="1" class="btn">Summarize changes</button></p>
22 <p class="btngroup"><button type="submit">Create release</button> {{template "previewbtn"}} <button type="submit" name="summarize" value="1" class="btn">Summarize changes</button></p>
1923</form>
2024</details>
2125{{else if .CanWrite}}<p class="meta">Push a tag to create a release from it.</p>{{end}}
2226{{range $rel := .Releases}}
23<article class="release">
27<article class="release setcard">
2428 <header class="releasehead">
25 <h2>{{$rel.Title}}</h2>
26 <p class="meta"><span class="refchip">{{$rel.Tag}}</span> {{if $rel.Author}}{{$rel.Author}} · {{end}}{{when $rel.CreatedAt}} · <a href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/archive/{{$rel.Tag}}.tar.gz">source tar.gz</a></p>
29 <div class="releasehead-top">
30 <h2>{{$rel.Title}} <span class="refchip">{{$rel.Tag}}</span></h2>
31 <span class="grow"></span>
32 <a class="button btn" href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/archive/{{$rel.Tag}}.tar.gz">source tar.gz</a>
33 {{if $.CanAdmin}}<details class="popover"><summary class="popbtn popbtn-danger">Delete</summary><div class="popmenu">
34 <p class="meta">Deleting is permanent and takes the assets with it. The tag stays.</p>
35 <form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases" class="popform popform-stack">
36 <input type="hidden" name="action" value="delete">
37 <input type="hidden" name="tag" value="{{$rel.Tag}}">
38 {{template "confirmfield" $rel.Tag}}
39 <button type="submit" class="danger">Delete release</button>
40 </form>
41 </div></details>{{end}}
42 </div>
43 <p class="meta">{{if $rel.Author}}{{$rel.Author}} · {{end}}{{when $rel.CreatedAt}}</p>
2744 </header>
2845 {{if $rel.NotesHTML}}<div class="rendered">{{$rel.NotesHTML}}</div>{{end}}
2946 {{$form := printf "release:%s" $rel.Tag}}
30 {{if $.CanWrite}}<details class="editbox"{{if $.Draft.Is $form}} open{{end}}><summary>Edit</summary>
47 {{if $.CanWrite}}<details class="editbox"{{if $.Draft.Is $form}} open{{end}}><summary>Edit release</summary>
3148 {{if $.Draft.Is $form}}{{template "previewblock" $.Draft.HTML}}{{end}}
3249 <form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases" class="commentform">
3350 <input type="hidden" name="action" value="edit">
3451 <input type="hidden" name="tag" value="{{$rel.Tag}}">
3552 <p><input type="text" name="title" aria-label="Title" value="{{$.Draft.Or $form "title" $rel.Title}}"></p>
3653 <p><textarea name="notes" aria-label="Notes" rows="6">{{$.Draft.Or $form "notes" $rel.Notes}}</textarea></p>
37 <p><button type="submit" class="btn">Save</button> {{template "previewbtn"}}</p>
54 <p class="btngroup"><button type="submit">Save</button> {{template "previewbtn"}}</p>
3855 </form>
39 {{if $.CanAdmin}}<form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases" class="commentform">
40 <input type="hidden" name="action" value="delete">
41 <input type="hidden" name="tag" value="{{$rel.Tag}}">
42 <p class="meta">Deleting is permanent and takes the assets with it. The tag stays.</p>
43 <p>{{template "confirmfield" $rel.Tag}} <button type="submit" class="danger">Delete release</button></p>
44 </form>{{end}}</details>{{end}}
45 {{if $rel.Assets}}<table class="assets">
56 </details>{{end}}
57 {{if $rel.Assets}}<div class="tablewrap"><table class="assets">
4658 <thead><tr><th scope="col">File</th><th scope="col">Bytes</th><th scope="col">SHA-256</th>{{if $.CanWrite}}<th scope="col"><span class="vh">actions</span></th>{{end}}</tr></thead>
47 {{range $rel.Assets}}<tr>
59 <tbody>{{range $rel.Assets}}<tr>
4860 <td class="name"><a href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases/download/{{$rel.Tag}}/{{.Name}}">{{.Name}}</a></td>
4961 <td class="size">{{.Size}}</td>
5062 <td class="sha"><code title="{{.SHA256}}">{{short .SHA256}}</code></td>
51 {{if $.CanWrite}}<td class="act"><form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases/assets" class="inline">
52 <input type="hidden" name="action" value="remove">
53 <input type="hidden" name="tag" value="{{$rel.Tag}}">
54 <input type="hidden" name="name" value="{{.Name}}">
55 {{template "confirmfield" .Name}}
56 <button type="submit" class="danger">Remove</button>
57 </form></td>{{end}}
58 </tr>{{end}}
59 </table>{{end}}
63 {{if $.CanWrite}}<td class="act"><details class="popover"><summary class="popbtn popbtn-danger">Remove</summary><div class="popmenu">
64 <form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases/assets" class="popform popform-stack">
65 <input type="hidden" name="action" value="remove">
66 <input type="hidden" name="tag" value="{{$rel.Tag}}">
67 <input type="hidden" name="name" value="{{.Name}}">
68 {{template "confirmfield" .Name}}
69 <button type="submit" class="danger">Remove</button>
70 </form>
71 </div></details></td>{{end}}
72 </tr>{{end}}</tbody>
73 </table></div>{{end}}
6074 {{if $.CanWrite}}<details class="editbox"><summary>Add asset</summary>
6175 <form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases/assets" enctype="multipart/form-data" class="commentform">
6276 <input type="hidden" name="tag" value="{{$rel.Tag}}">
internal/web/templates/settings.html +52 −44
@@ -2,10 +2,12 @@
22{{define "title"}}settings · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
33{{define "content"}}
44{{$base := printf "/%s/%s/settings" .Repo.OwnerName .Repo.Name}}
5<h1>Settings</h1>
5<div class="pagehead">
6 <h1>Settings</h1>
7</div>
68{{if .Notice}}{{if .Saved}}<p class="notice" role="status">{{.Notice}}</p>{{else}}<p class="error" role="alert">{{.Notice}}{{if .Reauth}} <a href="/login">Sign in again</a>{{end}}</p>{{end}}{{end}}
79<div class="withcol narrow">
8<nav class="sidecol" aria-label="Sections">
10<nav class="sidecol sticky" aria-label="Sections" data-scrollspy="1">
911<details class="sidedrop">
1012<summary><span class="sideword">Sections</span></summary>
1113 <div class="grp"><h2 class="colhead">Sections</h2>
@@ -26,7 +28,7 @@
2628</nav>
2729<div class="colmain">
2830
29<section id="identity"><h2>Identity</h2>
31<section id="identity" class="setcard"><h2>Identity</h2>
3032<form method="post" action="{{$base}}" class="setform">
3133 <input type="hidden" name="field" value="description">
3234 <div><label for="description">Description</label></div>
@@ -45,7 +47,7 @@
4547 <div><input type="text" id="topics" name="topics" value="{{or (index .Submitted "topics") (join .Topics ", ")}}"></div>
4648 <div><button type="submit" class="btn">Save</button></div>
4749</form>
48{{if .Branches}}<form method="post" action="{{$base}}" class="setform">
50{{if .Branches}}<form method="post" action="{{$base}}" class="setform" data-autosave="1">
4951 <input type="hidden" name="field" value="default-branch">
5052 <div><label for="default-branch">Default branch</label></div>
5153 <div><select id="default-branch" name="default-branch">{{$cur := .Repo.DefaultBranch}}{{range .Branches}}<option value="{{.Name}}"{{if eq .Name $cur}} selected{{end}}>{{.Name}}</option>{{end}}</select></div>
@@ -53,7 +55,7 @@
5355</form>{{end}}
5456</section>
5557
56<section id="access"><h2>Access</h2>
58<section id="access" class="setcard"><h2>Access</h2>
5759<form method="post" action="{{$base}}" class="setform">
5860 <input type="hidden" name="field" value="visibility">
5961 <div><span class="fieldname">Visibility</span></div>
@@ -63,7 +65,7 @@
6365 </div>
6466 <div><button type="submit" class="btn">Save</button></div>
6567</form>
66<form method="post" action="{{$base}}" class="setform">
68<form method="post" action="{{$base}}" class="setform" data-autosave="1">
6769 <input type="hidden" name="field" value="git-daemon">
6870 <div><label for="git-daemon">Serve over git://</label><p class="hint">Public repositories only.</p></div>
6971 <div class="check"><input type="checkbox" id="git-daemon" name="git-daemon" value="on"{{if .Repo.Settings.GitDaemon}} checked{{end}}></div>
@@ -92,7 +94,7 @@
9294</form>
9395</section>
9496
95<section id="webhooks"><h2>Webhooks</h2>
97<section id="webhooks" class="setcard"><h2>Webhooks</h2>
9698{{if .Hooks}}
9799<ul class="protlist">
98100{{range .Hooks}}<li><span class="mono">#{{.ID}}</span> <code>{{.URL}}</code> <span class="meta">{{.Events}}{{if .Secret}}, signed{{end}}</span>
@@ -104,18 +106,21 @@
104106{{end}}
105107</ul>
106108{{else}}<p class="meta">No webhooks.</p>{{end}}
107<form method="post" action="{{$base}}" class="setform stack" autocomplete="off">
108 <input type="hidden" name="field" value="webhook-add">
109 <label for="hook-url">Add a webhook</label>
110 <input type="text" id="hook-url" name="url" value="{{index .Submitted "url"}}" placeholder="https://ci.example.org/hook" spellcheck="false">
111 <label for="hook-events">Events</label>
112 <p class="hint">Comma separated, or <code>*</code> for all.</p>
113 <input type="text" id="hook-events" name="events" value="{{or (index .Submitted "events") "*"}}" spellcheck="false">
114 <label for="hook-secret">Secret</label>
115 <p class="hint">Optional. Signs each delivery; it is not shown again.</p>
116 <input type="password" id="hook-secret" name="secret" value="" autocomplete="new-password">
117 <button type="submit" class="btn">Add</button>
118</form>
109<details class="editbox"{{if or (index .Submitted "url") (index .Submitted "events")}} open{{end}}>
110 <summary>Add a webhook</summary>
111 <form method="post" action="{{$base}}" class="setform stack" autocomplete="off">
112 <input type="hidden" name="field" value="webhook-add">
113 <label for="hook-url">Payload URL</label>
114 <input type="text" id="hook-url" name="url" value="{{index .Submitted "url"}}" placeholder="https://ci.example.org/hook" spellcheck="false">
115 <label for="hook-events">Events</label>
116 <p class="hint">Comma separated, or <code>*</code> for all.</p>
117 <input type="text" id="hook-events" name="events" value="{{or (index .Submitted "events") "*"}}" spellcheck="false">
118 <label for="hook-secret">Secret</label>
119 <p class="hint">Optional. Signs each delivery; it is not shown again.</p>
120 <input type="password" id="hook-secret" name="secret" value="" autocomplete="new-password">
121 <span class="btngroup"><button type="submit">Add webhook</button></span>
122 </form>
123</details>
119124<h3>Recent deliveries</h3>
120125{{if .Deliveries}}<div class="tablewrap"><table class="keys">
121126<thead><tr class="cols"><th scope="col">id</th><th scope="col">event</th><th scope="col">url</th><th scope="col">state</th><th scope="col"><span class="vh">actions</span></th></tr></thead>
@@ -133,9 +138,9 @@
133138{{else}}<p class="meta">Nothing delivered yet.</p>{{end}}
134139</section>
135140
136<section id="gates"><h2>Merge gates</h2>
141<section id="gates" class="setcard"><h2>Merge gates</h2>
137142<p class="meta">Checked before a merge, in this order: checks, approvals, resolved threads, signatures.</p>
138<form method="post" action="{{$base}}" class="setform">
143<form method="post" action="{{$base}}" class="setform" data-autosave="1">
139144 <input type="hidden" name="field" value="require-checks">
140145 <div><label for="require-checks">Required checks</label><p class="hint">Requires CI to succeed.{{with .Repo.Settings.RequiredContexts}} Also waits for {{range $i, $c := .}}{{if $i}}, {{end}}<code>{{$c}}</code>{{end}} until they report{{if not $.Repo.Settings.RequireChecks}}, once this is on{{end}}.{{end}}</p></div>
141146 <div class="check"><input type="checkbox" id="require-checks" name="require-checks" value="on"{{if .Repo.Settings.RequireChecks}} checked{{end}}></div>
@@ -153,19 +158,19 @@
153158 <div class="num"><input type="number" id="approvals" name="approvals" min="0" max="10" value="{{.Repo.Settings.RequireApprovals}}"></div>
154159 <div><button type="submit" class="btn">Save</button></div>
155160</form>
156<form method="post" action="{{$base}}" class="setform">
161<form method="post" action="{{$base}}" class="setform" data-autosave="1">
157162 <input type="hidden" name="field" value="require-resolved">
158163 <div><label for="require-resolved">Review threads</label><p class="hint">Every thread on the diff must be resolved before merging.</p></div>
159164 <div class="check"><input type="checkbox" id="require-resolved" name="require-resolved" value="on"{{if .Repo.Settings.RequireResolved}} checked{{end}}></div>
160165 <div><button type="submit" class="btn">Save</button></div>
161166</form>
162<form method="post" action="{{$base}}" class="setform">
167<form method="post" action="{{$base}}" class="setform" data-autosave="1">
163168 <input type="hidden" name="field" value="require-codeowners">
164169 <div><label for="require-codeowners">CODEOWNERS</label><p class="hint">Code owners must approve.</p></div>
165170 <div class="check"><input type="checkbox" id="require-codeowners" name="require-codeowners" value="on"{{if .Repo.Settings.RequireCodeowners}} checked{{end}}></div>
166171 <div><button type="submit" class="btn">Save</button></div>
167172</form>
168<form method="post" action="{{$base}}" class="setform">
173<form method="post" action="{{$base}}" class="setform" data-autosave="1">
169174 <input type="hidden" name="field" value="require-signed">
170175 <div><label for="require-signed">Signed commits</label><p class="hint">Every commit in the request must carry a verified signature. Squash and merge strategies are refused, since both mint an unsigned commit.</p></div>
171176 <div class="check"><input type="checkbox" id="require-signed" name="require-signed" value="on"{{if .Repo.Settings.RequireSignedCommits}} checked{{end}}></div>
@@ -173,14 +178,14 @@
173178</form>
174179</section>
175180
176{{if or .ScanAvailable .Security.Enabled}}<section id="security"><h2>Code scanning</h2>
181{{if or .ScanAvailable .Security.Enabled}}<section id="security" class="setcard"><h2>Code scanning</h2>
177182<form method="post" action="{{$base}}" class="setform">
178183 <input type="hidden" name="field" value="security">
179184 <div><label for="security-enabled">Scheduled scan</label><p class="hint">Runs the instance's code scanner over <code>{{.Repo.DefaultBranch}}</code> on its schedule, on a runner attached to this repository, and keeps an issue of what it finds.</p></div>
180185 <div class="check"><input type="checkbox" id="security-enabled" name="security" value="on"{{if .Security.Enabled}} checked{{end}}></div>
181186 <div><button type="submit" class="btn">Save</button></div>
182187</form>
183{{if .ScanAvailable}}<form method="post" action="{{$base}}" class="setform">
188{{if .ScanAvailable}}<form method="post" action="{{$base}}" class="setform" data-autosave="1">
184189 <input type="hidden" name="field" value="security-frequency">
185190 <div><label for="security-frequency">Frequency</label><p class="hint">Daily, weekly on Sunday, or monthly on the 1st, at {{printf "%02d:00" .ScanHour}} UTC.</p></div>
186191 <div><select id="security-frequency" name="security-frequency">{{$freq := .ScanFrequency}}{{range .ScanFrequencies}}<option value="{{.}}"{{if eq . $freq}} selected{{end}}>{{.}}</option>{{end}}</select></div>
@@ -233,8 +238,8 @@
233238</section>
234239{{end}}
235240
236<section id="secrets"><h2>Secret scan</h2>
237<form method="post" action="{{$base}}" class="setform">
241<section id="secrets" class="setcard"><h2>Secret scan</h2>
242<form method="post" action="{{$base}}" class="setform" data-autosave="1">
238243 <input type="hidden" name="field" value="secret-scan">
239244 <div><label for="secret-scan">Pushes</label><p class="hint">Each push's new files are checked for credentials in known formats. Warn accepts the push and tells the pusher where; block refuses it. Only the path, line and kind of credential are reported, never the value.</p></div>
240245 <div><select id="secret-scan" name="secret-scan">{{$mode := or .Repo.Settings.SecretScan "warn"}}<option value="off"{{if eq $mode "off"}} selected{{end}}>off</option><option value="warn"{{if eq $mode "warn"}} selected{{end}}>warn</option><option value="block"{{if eq $mode "block"}} selected{{end}}>block</option></select></div>
@@ -248,7 +253,7 @@
248253</form>
249254</section>
250255
251<section id="branches"><h2>Protected branches</h2>
256<section id="branches" class="setcard"><h2>Protected branches</h2>
252257{{if .Repo.Settings.ProtectedBranches}}
253258<ul class="protlist">
254259{{$mr := .Repo.Settings.RequireMR}}{{range .Repo.Settings.ProtectedBranches}}<li><code>{{.}}</code>{{if $mr}} <span class="hint">Direct pushes refused, merge requests only.</span>{{end}}
@@ -266,7 +271,7 @@
266271 <div><select id="branch" name="branch">{{range .Branches}}<option value="{{.Name}}">{{.Name}}</option>{{end}}</select></div>
267272 <div><button type="submit" class="btn">Protect</button></div>
268273</form>
269<form method="post" action="{{$base}}" class="setform">
274<form method="post" action="{{$base}}" class="setform" data-autosave="1">
270275 <input type="hidden" name="field" value="require-mr">
271276 <div><label for="require-mr">Require merge requests</label><p class="hint">Every protected branch changes through a merge request. A direct push is refused in pre-receive.</p></div>
272277 <div class="check"><input type="checkbox" id="require-mr" name="require-mr" value="on"{{if .Repo.Settings.RequireMR}} checked{{end}}></div>
@@ -274,7 +279,7 @@
274279</form>
275280</section>
276281
277<section id="tags"><h2>Protected tags</h2>
282<section id="tags" class="setcard"><h2>Protected tags</h2>
278283{{if .Repo.Settings.ProtectedTags}}
279284<ul class="protlist">
280285{{range .Repo.Settings.ProtectedTags}}<li><code>{{.}}</code>
@@ -294,7 +299,7 @@
294299</form>
295300</section>
296301
297<section id="deps"><h2>Dependencies</h2>
302<section id="deps" class="setcard"><h2>Dependencies</h2>
298303<form method="post" action="{{$base}}" class="setform">
299304 <input type="hidden" name="field" value="deps">
300305 <div><label for="deps-enabled">Check for updates and advisories</label><p class="hint">Evaluates the manifests and lockfiles on <code>{{.Repo.DefaultBranch}}</code> against the registries and OSV, and opens an issue for each. Updates for Go, NPM, Crates, and PyPI; advisories for those and SwiftPM.</p></div>
@@ -346,7 +351,7 @@
346351{{end}}
347352</section>
348353
349<section id="runners"><h2>Runners</h2>
354<section id="runners" class="setcard"><h2>Runners</h2>
350355{{if .Runners}}
351356<ul class="protlist">
352357{{range .Runners}}<li><code>{{.Fingerprint}}</code> <span class="meta">{{.Username}}{{if .LastSeen}}, last poll {{when .LastSeen}}{{else}}, never polled{{end}}{{if .BuildNumber}}, running {{.BuildRepo}} #{{.BuildNumber}} {{.BuildJob}}{{end}}{{if .Jobs}}, only {{join .Jobs ", "}}{{end}}</span>
@@ -358,19 +363,22 @@
358363{{end}}
359364</ul>
360365{{else}}<p class="meta">No runners attached. Builds for this repository run on the runners attached here; a repository with none queues builds nothing claims.</p>{{end}}
361<form method="post" action="{{$base}}" class="setform stack">
362 <input type="hidden" name="field" value="runner-add">
363 <label for="runner-key">Attach a runner</label>
364 <p class="hint">Install <code>gitbay-runner</code>, run <code>gitbay-runner init</code>, and paste the key it prints. The runner builds your commits with the repository's secrets; merge requests from forks wait unless it runs with <code>-untrusted</code>.</p>
365 <textarea id="runner-key" name="key" rows="3" spellcheck="false" placeholder="ssh-ed25519 AAAA… (from gitbay-runner init)">{{index .Submitted "key"}}</textarea>
366 <label for="runner-jobs">Jobs</label>
367 <p class="hint">Leave empty for every job. Name jobs, comma-separated, to have this runner claim only those here, for instance <code>gitbay-security</code> on a runner with the code scanning image.</p>
368 <input type="text" id="runner-jobs" name="jobs" value="{{index .Submitted "jobs"}}">
369 <button type="submit" class="btn">Attach</button>
370</form>
366<details class="editbox"{{if or (index .Submitted "key") (index .Submitted "jobs")}} open{{end}}>
367 <summary>Attach a runner</summary>
368 <form method="post" action="{{$base}}" class="setform stack">
369 <input type="hidden" name="field" value="runner-add">
370 <label for="runner-key">Runner public key</label>
371 <p class="hint">Install <code>gitbay-runner</code>, run <code>gitbay-runner init</code>, and paste the key it prints. The runner builds your commits with the repository's secrets; merge requests from forks wait unless it runs with <code>-untrusted</code>.</p>
372 <textarea id="runner-key" name="key" rows="3" spellcheck="false" placeholder="ssh-ed25519 AAAA… (from gitbay-runner init)">{{index .Submitted "key"}}</textarea>
373 <label for="runner-jobs">Jobs</label>
374 <p class="hint">Leave empty for every job. Name jobs, comma-separated, to have this runner claim only those here, for instance <code>gitbay-security</code> on a runner with the code scanning image.</p>
375 <input type="text" id="runner-jobs" name="jobs" value="{{index .Submitted "jobs"}}">
376 <span class="btngroup"><button type="submit">Attach runner</button></span>
377 </form>
378</details>
371379</section>
372380
373<section id="lifecycle"><h2>Lifecycle</h2>
381<section id="lifecycle" class="setcard setcard-danger"><h2>Lifecycle</h2>
374382<form method="post" action="{{$base}}" class="setform">
375383 <input type="hidden" name="field" value="archive">
376384 <div><label for="archive">Archived</label><p class="hint">Read-only for everyone. Issues and requests close to new activity. Reversible.</p></div>
internal/web/templates/tree.html +7 −1
@@ -8,6 +8,8 @@
88<div class="pathbar">
99 {{template "refmenu" .}}
1010 <span class="crumbs"><a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}">{{.Repo.Name}}</a>/{{range .Crumbs}}<a href="{{.URL}}">{{.Name}}</a>/{{end}}</span>
11 <span class="spacer"></span>
12 {{if .Entries}}<input type="search" class="treefilter" placeholder="Filter files…" aria-label="Filter files" data-filter-table="repo-tree">{{end}}
1113 <div class="acts">
1214 <a class="button btn" href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/search">Search code</a>
1315 <a class="button btn" href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/log/{{.Ref}}">History</a>
@@ -15,9 +17,12 @@
1517 </div>
1618</div>
1719<div class="tablewrap">
18<table class="tree">
20<table class="tree" id="repo-tree">
21<thead>
1922{{with .Tip}}{{if .SHA}}<tr class="tipbar"><td colspan="3"><div class="tip"><span class="who">{{template "authorname" dict "Name" .Author "User" .User "Email" .Email}}</span> <a class="subject" href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/commit/{{.SHA}}">{{.Subject}}</a><span class="spacer"></span><a class="sha" href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/commit/{{.SHA}}"><code>{{short .SHA}}</code></a> <span class="age"{{if not .When.IsZero}} title="{{whenT .When}}"{{end}}>{{ago .When}}</span></div></td></tr>{{end}}{{end}}
2023<tr class="cols"><th scope="col">name</th><th scope="col" class="lastcommit">last commit</th><th scope="col" class="age">updated</th></tr>
24</thead>
25<tbody>
2126{{range .Entries}}{{$c := index $.LastCommits .Name}}<tr>
2227 {{/* the glyph is decorative: the trailing slash is what says directory
2328 to anything reading the text, and the icon repeats it in shape so
@@ -28,6 +33,7 @@
2833 <td class="age"{{if not $c.When.IsZero}} title="{{whenT $c.When}}"{{end}}>{{ago $c.When}}</td>
2934</tr>
3035{{else}}<tr><td class="name empty" colspan="3">this repository is empty — push something:<br><code>git remote add origin {{.CloneURL}}</code></td></tr>{{end}}
36</tbody>
3137</table>
3238</div>
3339{{if .ReadmeHTML}}<section class="readme">