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 @@
374 } 374 }
375 }); 375 });
376 376
377 // ---- 8. Live client-side table & list filters ---- 377 // ---- 8. Live client-side table, list & link filters ----
378 document.addEventListener('input', (e) => { 378 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]');
380 if (!inp) return; 380 if (!inp) return;
381 const q = inp.value.trim().toLowerCase(); 381 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 }
382 if (inp.dataset.filterTable) { 390 if (inp.dataset.filterTable) {
383 const table = document.getElementById(inp.dataset.filterTable); 391 const table = document.getElementById(inp.dataset.filterTable);
384 if (!table) return; 392 if (!table) return;
@@ -397,11 +405,11 @@
397 } 405 }
398 }); 406 });
399 407
400 // ---- 9. In-place Refresh (/admin, /) ---- 408 // ---- 9. In-place Refresh (/admin, /, /builds, /notifications) ----
401 document.addEventListener('click', async (e) => { 409 document.addEventListener('click', async (e) => {
402 const btn = e.target.closest('button[data-refresh]'); 410 const btn = e.target.closest('button[data-refresh]');
403 if (!btn) return; 411 if (!btn) return;
404 const url = btn.dataset.refresh; 412 const url = btn.dataset.refresh === 'self' ? location.href : btn.dataset.refresh;
405 const targetId = btn.dataset.refreshTarget || 'admin-queues'; 413 const targetId = btn.dataset.refreshTarget || 'admin-queues';
406 btn.disabled = true; 414 btn.disabled = true;
407 try { 415 try {
@@ -413,6 +421,7 @@
413 const cur = document.getElementById(targetId); 421 const cur = document.getElementById(targetId);
414 if (next && cur) { 422 if (next && cur) {
415 cur.replaceWith(next); 423 cur.replaceWith(next);
424 initCopyButtons(next);
416 initScrollSpy(); 425 initScrollSpy();
417 showToast('Refreshed'); 426 showToast('Refreshed');
418 } 427 }
internal/web/static/style.css +44
@@ -2403,3 +2403,47 @@ nav.newtabs {
2403ul.issuelist li.unread { 2403ul.issuelist li.unread {
2404 box-shadow: inset 3px 0 0 var(--mark); 2404 box-shadow: inset 3px 0 0 var(--mark);
2405} 2405}
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 @@
1{{define "width"}}wide{{end}} 1{{define "width"}}wide{{end}}
2{{define "title"}}build {{.Build.Number}} · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}} 2{{define "title"}}build {{.Build.Number}} · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
3{{define "content"}} 3{{define "content"}}
4<div id="build-root">
4{{if .Notice}}<p class="error" role="alert">{{.Notice}}</p>{{end}} 5{{if .Notice}}<p class="error" role="alert">{{.Notice}}</p>{{end}}
5<div class="headrow"> 6<div class="headrow">
6<h1>Build {{.Build.Number}} <span class="chip check-{{.Build.Status}}">{{.Build.Status}}</span></h1> 7<h1>Build {{.Build.Number}} <span class="chip check-{{.Build.Status}}">{{.Build.Status}}</span></h1>
7<span class="spacer"></span> 8<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}}
8{{if and .CanWrite (or (eq .Build.Status "pending") (eq .Build.Status "running"))}} 11{{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"> 12<form method="post" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/builds/{{.Build.Number}}/cancel" class="inline">
10 <button type="submit" class="btn">{{if eq .Build.Status "running"}}Cancel (stops at the runner's next check){{else}}Cancel{{end}}</button> 13 <button type="submit" class="danger">{{if eq .Build.Status "running"}}Cancel (stops at the runner's next check){{else}}Cancel{{end}}</button>
11</form> 14</form>
12{{end}} 15{{end}}
13</div> 16</div>
17</div>
14<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> 18<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>
15{{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> 19{{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>
16<pre class="code buildlog" tabindex="0">{{.Log}}</pre> 20<pre class="code buildlog" tabindex="0">{{.Log}}</pre>
@@ -20,4 +24,5 @@
20 <pre class="code buildlog" tabindex="0">{{.Text}}</pre> 24 <pre class="code buildlog" tabindex="0">{{.Text}}</pre>
21</details>{{end}} 25</details>{{end}}
22{{else if .Log}}<pre class="code buildlog" tabindex="0">{{.Log}}</pre>{{else}}<p class="empty-note">no log yet</p>{{end}} 26{{else if .Log}}<pre class="code buildlog" tabindex="0">{{.Log}}</pre>{{else}}<p class="empty-note">no log yet</p>{{end}}
27</div>
23{{end}} 28{{end}}
internal/web/templates/builds.html +20 −13
@@ -1,8 +1,8 @@
1{{define "width"}}wide{{end}} 1{{define "width"}}wide{{end}}
2{{define "title"}}builds · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}} 2{{define "title"}}builds · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
3{{define "content"}} 3{{define "content"}}
4<div class="withcol"> 4<div class="withcol" id="builds-root">
5<nav class="sidecol" aria-label="Filters"> 5<nav class="sidecol" aria-label="Filters" data-tab-swap="builds-root">
6<details class="sidedrop"> 6<details class="sidedrop">
7<summary><span class="sideword">Filters</span>{{range .Facets}}{{range .Items}}{{if .Active}} <span class="sideon">{{.Label}}</span>{{end}}{{end}}{{end}}</summary> 7<summary><span class="sideword">Filters</span>{{range .Facets}}{{range .Items}}{{if .Active}} <span class="sideon">{{.Label}}</span>{{end}}{{end}}{{end}}</summary>
8 {{range .Facets}}{{if .Items}}<div class="grp"> 8 {{range .Facets}}{{if .Items}}<div class="grp">
@@ -22,22 +22,29 @@
22<div class="colmain"> 22<div class="colmain">
23<div class="listhead"> 23<div class="listhead">
24 <h1>Builds</h1> 24 <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>
25</div> 41</div>
26{{if .Notice}}<p class="error" role="alert">{{.Notice}}</p>{{end}} 42{{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}}
36<details class="editbox"><summary>Status badge</summary> 43<details class="editbox"><summary>Status badge</summary>
37<p class="meta">Paste into a README; it shows the newest build's state. Markdown:</p> 44<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>
39<p class="meta">Org:</p> 46<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>
41<p class="meta">Add <code>?job=name</code> for one job.</p> 48<p class="meta">Add <code>?job=name</code> for one job.</p>
42</details> 49</details>
43<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> 50<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 @@
1{{define "width"}}wide{{end}} 1{{define "width"}}wide{{end}}
2{{define "title"}}issues · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}} 2{{define "title"}}issues · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
3{{define "content"}} 3{{define "content"}}
4<div class="withcol"> 4<div class="withcol" id="issues-root">
5{{template "sidecol" .Facets}} 5{{template "sidecol" .Facets}}
6<div class="colmain"> 6<div class="colmain">
7<div class="listhead"> 7<div class="listhead">
@@ -13,9 +13,13 @@
13 </form> 13 </form>
14 {{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}} 14 {{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> 15 <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>
17</div> 21</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}}
19<ul class="issuelist rows"> 23<ul class="issuelist rows">
20{{range .Issues}}<li> 24{{range .Issues}}<li>
21 <div class="issuemain"> 25 <div class="issuemain">
internal/web/templates/layout.html +1
@@ -145,6 +145,7 @@
145{{define "refmenu"}}{{if .Branches}}<details class="refmenu"> 145{{define "refmenu"}}{{if .Branches}}<details class="refmenu">
146 <summary class="refchip">{{template "branchicon"}} {{.Ref}}</summary> 146 <summary class="refchip">{{template "branchicon"}} {{.Ref}}</summary>
147 <div class="refdrop"> 147 <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}}
148 {{range .Branches}}<a href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/{{$.RefKind}}/{{.Name}}/{{$.DirPath}}">{{.Name}}</a> 149 {{range .Branches}}<a href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/{{$.RefKind}}/{{.Name}}/{{$.DirPath}}">{{.Name}}</a>
149 {{end}}<a class="allrefs" href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/refs">All refs →</a> 150 {{end}}<a class="allrefs" href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/refs">All refs →</a>
150 </div> 151 </div>
internal/web/templates/mrs.html +6 −5
@@ -1,7 +1,7 @@
1{{define "width"}}wide{{end}} 1{{define "width"}}wide{{end}}
2{{define "title"}}merge requests · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}} 2{{define "title"}}merge requests · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
3{{define "content"}} 3{{define "content"}}
4<div class="withcol"> 4<div class="withcol" id="mrs-root">
5{{template "sidecol" .Facets}} 5{{template "sidecol" .Facets}}
6<div class="colmain"> 6<div class="colmain">
7<div class="listhead"> 7<div class="listhead">
@@ -12,11 +12,12 @@
12 <input type="hidden" name="state" value="{{.State}}"> 12 <input type="hidden" name="state" value="{{.State}}">
13 </form> 13 </form>
14 {{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}} 14 {{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}}
15</div> 19</div>
16{{if .CanOpenMR}}<p class="meta"><a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/mrs/new">New merge request</a></p> 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}}
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<ul class="issuelist rows"> 21<ul class="issuelist rows">
21{{range .MRs}}{{$n := .Number}}<li> 22{{range .MRs}}{{$n := .Number}}<li>
22 <div class="issuemain"> 23 <div class="issuemain">
internal/web/templates/releases.html +38 −24
@@ -1,6 +1,10 @@
1{{define "title"}}releases · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}} 1{{define "title"}}releases · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
2{{define "content"}} 2{{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>
4{{if .Notice}}<p class="error" role="alert">{{.Notice}}</p>{{end}} 8{{if .Notice}}<p class="error" role="alert">{{.Notice}}</p>{{end}}
5{{if and .CanWrite .FreeTags}} 9{{if and .CanWrite .FreeTags}}
6{{$want := .Draft.Or "release" "tag" ""}} 10{{$want := .Draft.Or "release" "tag" ""}}
@@ -15,48 +19,58 @@
15 </p> 19 </p>
16 <p><input type="text" name="title" aria-label="Title" placeholder="title (defaults to the tag)" value="{{.Draft.Or "release" "title" ""}}"></p> 20 <p><input type="text" name="title" aria-label="Title" placeholder="title (defaults to the tag)" value="{{.Draft.Or "release" "title" ""}}"></p>
17 <p><textarea name="notes" aria-label="Notes" rows="6" placeholder="what changed">{{.Draft.Or "release" "notes" ""}}</textarea></p> 21 <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>
19</form> 23</form>
20</details> 24</details>
21{{else if .CanWrite}}<p class="meta">Push a tag to create a release from it.</p>{{end}} 25{{else if .CanWrite}}<p class="meta">Push a tag to create a release from it.</p>{{end}}
22{{range $rel := .Releases}} 26{{range $rel := .Releases}}
23<article class="release"> 27<article class="release setcard">
24 <header class="releasehead"> 28 <header class="releasehead">
25 <h2>{{$rel.Title}}</h2> 29 <div class="releasehead-top">
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> 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>
27 </header> 44 </header>
28 {{if $rel.NotesHTML}}<div class="rendered">{{$rel.NotesHTML}}</div>{{end}} 45 {{if $rel.NotesHTML}}<div class="rendered">{{$rel.NotesHTML}}</div>{{end}}
29 {{$form := printf "release:%s" $rel.Tag}} 46 {{$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>
31 {{if $.Draft.Is $form}}{{template "previewblock" $.Draft.HTML}}{{end}} 48 {{if $.Draft.Is $form}}{{template "previewblock" $.Draft.HTML}}{{end}}
32 <form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases" class="commentform"> 49 <form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases" class="commentform">
33 <input type="hidden" name="action" value="edit"> 50 <input type="hidden" name="action" value="edit">
34 <input type="hidden" name="tag" value="{{$rel.Tag}}"> 51 <input type="hidden" name="tag" value="{{$rel.Tag}}">
35 <p><input type="text" name="title" aria-label="Title" value="{{$.Draft.Or $form "title" $rel.Title}}"></p> 52 <p><input type="text" name="title" aria-label="Title" value="{{$.Draft.Or $form "title" $rel.Title}}"></p>
36 <p><textarea name="notes" aria-label="Notes" rows="6">{{$.Draft.Or $form "notes" $rel.Notes}}</textarea></p> 53 <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>
38 </form> 55 </form>
39 {{if $.CanAdmin}}<form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases" class="commentform"> 56 </details>{{end}}
40 <input type="hidden" name="action" value="delete"> 57 {{if $rel.Assets}}<div class="tablewrap"><table class="assets">
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">
46 <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> 58 <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>
48 <td class="name"><a href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases/download/{{$rel.Tag}}/{{.Name}}">{{.Name}}</a></td> 60 <td class="name"><a href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases/download/{{$rel.Tag}}/{{.Name}}">{{.Name}}</a></td>
49 <td class="size">{{.Size}}</td> 61 <td class="size">{{.Size}}</td>
50 <td class="sha"><code title="{{.SHA256}}">{{short .SHA256}}</code></td> 62 <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"> 63 {{if $.CanWrite}}<td class="act"><details class="popover"><summary class="popbtn popbtn-danger">Remove</summary><div class="popmenu">
52 <input type="hidden" name="action" value="remove"> 64 <form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases/assets" class="popform popform-stack">
53 <input type="hidden" name="tag" value="{{$rel.Tag}}"> 65 <input type="hidden" name="action" value="remove">
54 <input type="hidden" name="name" value="{{.Name}}"> 66 <input type="hidden" name="tag" value="{{$rel.Tag}}">
55 {{template "confirmfield" .Name}} 67 <input type="hidden" name="name" value="{{.Name}}">
56 <button type="submit" class="danger">Remove</button> 68 {{template "confirmfield" .Name}}
57 </form></td>{{end}} 69 <button type="submit" class="danger">Remove</button>
58 </tr>{{end}} 70 </form>
59 </table>{{end}} 71 </div></details></td>{{end}}
72 </tr>{{end}}</tbody>
73 </table></div>{{end}}
60 {{if $.CanWrite}}<details class="editbox"><summary>Add asset</summary> 74 {{if $.CanWrite}}<details class="editbox"><summary>Add asset</summary>
61 <form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases/assets" enctype="multipart/form-data" class="commentform"> 75 <form method="post" action="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/releases/assets" enctype="multipart/form-data" class="commentform">
62 <input type="hidden" name="tag" value="{{$rel.Tag}}"> 76 <input type="hidden" name="tag" value="{{$rel.Tag}}">
internal/web/templates/settings.html +52 −44
@@ -2,10 +2,12 @@
2{{define "title"}}settings · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}} 2{{define "title"}}settings · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
3{{define "content"}} 3{{define "content"}}
4{{$base := printf "/%s/%s/settings" .Repo.OwnerName .Repo.Name}} 4{{$base := printf "/%s/%s/settings" .Repo.OwnerName .Repo.Name}}
5<h1>Settings</h1> 5<div class="pagehead">
6 <h1>Settings</h1>
7</div>
6{{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}} 8{{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}}
7<div class="withcol narrow"> 9<div class="withcol narrow">
8<nav class="sidecol" aria-label="Sections"> 10<nav class="sidecol sticky" aria-label="Sections" data-scrollspy="1">
9<details class="sidedrop"> 11<details class="sidedrop">
10<summary><span class="sideword">Sections</span></summary> 12<summary><span class="sideword">Sections</span></summary>
11 <div class="grp"><h2 class="colhead">Sections</h2> 13 <div class="grp"><h2 class="colhead">Sections</h2>
@@ -26,7 +28,7 @@
26</nav> 28</nav>
27<div class="colmain"> 29<div class="colmain">
28 30
29<section id="identity"><h2>Identity</h2> 31<section id="identity" class="setcard"><h2>Identity</h2>
30<form method="post" action="{{$base}}" class="setform"> 32<form method="post" action="{{$base}}" class="setform">
31 <input type="hidden" name="field" value="description"> 33 <input type="hidden" name="field" value="description">
32 <div><label for="description">Description</label></div> 34 <div><label for="description">Description</label></div>
@@ -45,7 +47,7 @@
45 <div><input type="text" id="topics" name="topics" value="{{or (index .Submitted "topics") (join .Topics ", ")}}"></div> 47 <div><input type="text" id="topics" name="topics" value="{{or (index .Submitted "topics") (join .Topics ", ")}}"></div>
46 <div><button type="submit" class="btn">Save</button></div> 48 <div><button type="submit" class="btn">Save</button></div>
47</form> 49</form>
48{{if .Branches}}<form method="post" action="{{$base}}" class="setform"> 50{{if .Branches}}<form method="post" action="{{$base}}" class="setform" data-autosave="1">
49 <input type="hidden" name="field" value="default-branch"> 51 <input type="hidden" name="field" value="default-branch">
50 <div><label for="default-branch">Default branch</label></div> 52 <div><label for="default-branch">Default branch</label></div>
51 <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 <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 @@
53</form>{{end}} 55</form>{{end}}
54</section> 56</section>
55 57
56<section id="access"><h2>Access</h2> 58<section id="access" class="setcard"><h2>Access</h2>
57<form method="post" action="{{$base}}" class="setform"> 59<form method="post" action="{{$base}}" class="setform">
58 <input type="hidden" name="field" value="visibility"> 60 <input type="hidden" name="field" value="visibility">
59 <div><span class="fieldname">Visibility</span></div> 61 <div><span class="fieldname">Visibility</span></div>
@@ -63,7 +65,7 @@
63 </div> 65 </div>
64 <div><button type="submit" class="btn">Save</button></div> 66 <div><button type="submit" class="btn">Save</button></div>
65</form> 67</form>
66<form method="post" action="{{$base}}" class="setform"> 68<form method="post" action="{{$base}}" class="setform" data-autosave="1">
67 <input type="hidden" name="field" value="git-daemon"> 69 <input type="hidden" name="field" value="git-daemon">
68 <div><label for="git-daemon">Serve over git://</label><p class="hint">Public repositories only.</p></div> 70 <div><label for="git-daemon">Serve over git://</label><p class="hint">Public repositories only.</p></div>
69 <div class="check"><input type="checkbox" id="git-daemon" name="git-daemon" value="on"{{if .Repo.Settings.GitDaemon}} checked{{end}}></div> 71 <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 @@
92</form> 94</form>
93</section> 95</section>
94 96
95<section id="webhooks"><h2>Webhooks</h2> 97<section id="webhooks" class="setcard"><h2>Webhooks</h2>
96{{if .Hooks}} 98{{if .Hooks}}
97<ul class="protlist"> 99<ul class="protlist">
98{{range .Hooks}}<li><span class="mono">#{{.ID}}</span> <code>{{.URL}}</code> <span class="meta">{{.Events}}{{if .Secret}}, signed{{end}}</span> 100{{range .Hooks}}<li><span class="mono">#{{.ID}}</span> <code>{{.URL}}</code> <span class="meta">{{.Events}}{{if .Secret}}, signed{{end}}</span>
@@ -104,18 +106,21 @@
104{{end}} 106{{end}}
105</ul> 107</ul>
106{{else}}<p class="meta">No webhooks.</p>{{end}} 108{{else}}<p class="meta">No webhooks.</p>{{end}}
107<form method="post" action="{{$base}}" class="setform stack" autocomplete="off"> 109<details class="editbox"{{if or (index .Submitted "url") (index .Submitted "events")}} open{{end}}>
108 <input type="hidden" name="field" value="webhook-add"> 110 <summary>Add a webhook</summary>
109 <label for="hook-url">Add a webhook</label> 111 <form method="post" action="{{$base}}" class="setform stack" autocomplete="off">
110 <input type="text" id="hook-url" name="url" value="{{index .Submitted "url"}}" placeholder="https://ci.example.org/hook" spellcheck="false"> 112 <input type="hidden" name="field" value="webhook-add">
111 <label for="hook-events">Events</label> 113 <label for="hook-url">Payload URL</label>
112 <p class="hint">Comma separated, or <code>*</code> for all.</p> 114 <input type="text" id="hook-url" name="url" value="{{index .Submitted "url"}}" placeholder="https://ci.example.org/hook" spellcheck="false">
113 <input type="text" id="hook-events" name="events" value="{{or (index .Submitted "events") "*"}}" spellcheck="false"> 115 <label for="hook-events">Events</label>
114 <label for="hook-secret">Secret</label> 116 <p class="hint">Comma separated, or <code>*</code> for all.</p>
115 <p class="hint">Optional. Signs each delivery; it is not shown again.</p> 117 <input type="text" id="hook-events" name="events" value="{{or (index .Submitted "events") "*"}}" spellcheck="false">
116 <input type="password" id="hook-secret" name="secret" value="" autocomplete="new-password"> 118 <label for="hook-secret">Secret</label>
117 <button type="submit" class="btn">Add</button> 119 <p class="hint">Optional. Signs each delivery; it is not shown again.</p>
118</form> 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>
119<h3>Recent deliveries</h3> 124<h3>Recent deliveries</h3>
120{{if .Deliveries}}<div class="tablewrap"><table class="keys"> 125{{if .Deliveries}}<div class="tablewrap"><table class="keys">
121<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> 126<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 @@
133{{else}}<p class="meta">Nothing delivered yet.</p>{{end}} 138{{else}}<p class="meta">Nothing delivered yet.</p>{{end}}
134</section> 139</section>
135 140
136<section id="gates"><h2>Merge gates</h2> 141<section id="gates" class="setcard"><h2>Merge gates</h2>
137<p class="meta">Checked before a merge, in this order: checks, approvals, resolved threads, signatures.</p> 142<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">
139 <input type="hidden" name="field" value="require-checks"> 144 <input type="hidden" name="field" value="require-checks">
140 <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> 145 <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>
141 <div class="check"><input type="checkbox" id="require-checks" name="require-checks" value="on"{{if .Repo.Settings.RequireChecks}} checked{{end}}></div> 146 <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 @@
153 <div class="num"><input type="number" id="approvals" name="approvals" min="0" max="10" value="{{.Repo.Settings.RequireApprovals}}"></div> 158 <div class="num"><input type="number" id="approvals" name="approvals" min="0" max="10" value="{{.Repo.Settings.RequireApprovals}}"></div>
154 <div><button type="submit" class="btn">Save</button></div> 159 <div><button type="submit" class="btn">Save</button></div>
155</form> 160</form>
156<form method="post" action="{{$base}}" class="setform"> 161<form method="post" action="{{$base}}" class="setform" data-autosave="1">
157 <input type="hidden" name="field" value="require-resolved"> 162 <input type="hidden" name="field" value="require-resolved">
158 <div><label for="require-resolved">Review threads</label><p class="hint">Every thread on the diff must be resolved before merging.</p></div> 163 <div><label for="require-resolved">Review threads</label><p class="hint">Every thread on the diff must be resolved before merging.</p></div>
159 <div class="check"><input type="checkbox" id="require-resolved" name="require-resolved" value="on"{{if .Repo.Settings.RequireResolved}} checked{{end}}></div> 164 <div class="check"><input type="checkbox" id="require-resolved" name="require-resolved" value="on"{{if .Repo.Settings.RequireResolved}} checked{{end}}></div>
160 <div><button type="submit" class="btn">Save</button></div> 165 <div><button type="submit" class="btn">Save</button></div>
161</form> 166</form>
162<form method="post" action="{{$base}}" class="setform"> 167<form method="post" action="{{$base}}" class="setform" data-autosave="1">
163 <input type="hidden" name="field" value="require-codeowners"> 168 <input type="hidden" name="field" value="require-codeowners">
164 <div><label for="require-codeowners">CODEOWNERS</label><p class="hint">Code owners must approve.</p></div> 169 <div><label for="require-codeowners">CODEOWNERS</label><p class="hint">Code owners must approve.</p></div>
165 <div class="check"><input type="checkbox" id="require-codeowners" name="require-codeowners" value="on"{{if .Repo.Settings.RequireCodeowners}} checked{{end}}></div> 170 <div class="check"><input type="checkbox" id="require-codeowners" name="require-codeowners" value="on"{{if .Repo.Settings.RequireCodeowners}} checked{{end}}></div>
166 <div><button type="submit" class="btn">Save</button></div> 171 <div><button type="submit" class="btn">Save</button></div>
167</form> 172</form>
168<form method="post" action="{{$base}}" class="setform"> 173<form method="post" action="{{$base}}" class="setform" data-autosave="1">
169 <input type="hidden" name="field" value="require-signed"> 174 <input type="hidden" name="field" value="require-signed">
170 <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> 175 <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>
171 <div class="check"><input type="checkbox" id="require-signed" name="require-signed" value="on"{{if .Repo.Settings.RequireSignedCommits}} checked{{end}}></div> 176 <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 @@
173</form> 178</form>
174</section> 179</section>
175 180
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>
177<form method="post" action="{{$base}}" class="setform"> 182<form method="post" action="{{$base}}" class="setform">
178 <input type="hidden" name="field" value="security"> 183 <input type="hidden" name="field" value="security">
179 <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> 184 <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>
180 <div class="check"><input type="checkbox" id="security-enabled" name="security" value="on"{{if .Security.Enabled}} checked{{end}}></div> 185 <div class="check"><input type="checkbox" id="security-enabled" name="security" value="on"{{if .Security.Enabled}} checked{{end}}></div>
181 <div><button type="submit" class="btn">Save</button></div> 186 <div><button type="submit" class="btn">Save</button></div>
182</form> 187</form>
183{{if .ScanAvailable}}<form method="post" action="{{$base}}" class="setform"> 188{{if .ScanAvailable}}<form method="post" action="{{$base}}" class="setform" data-autosave="1">
184 <input type="hidden" name="field" value="security-frequency"> 189 <input type="hidden" name="field" value="security-frequency">
185 <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> 190 <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>
186 <div><select id="security-frequency" name="security-frequency">{{$freq := .ScanFrequency}}{{range .ScanFrequencies}}<option value="{{.}}"{{if eq . $freq}} selected{{end}}>{{.}}</option>{{end}}</select></div> 191 <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 @@
233</section> 238</section>
234{{end}} 239{{end}}
235 240
236<section id="secrets"><h2>Secret scan</h2> 241<section id="secrets" class="setcard"><h2>Secret scan</h2>
237<form method="post" action="{{$base}}" class="setform"> 242<form method="post" action="{{$base}}" class="setform" data-autosave="1">
238 <input type="hidden" name="field" value="secret-scan"> 243 <input type="hidden" name="field" value="secret-scan">
239 <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> 244 <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>
240 <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> 245 <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 @@
248</form> 253</form>
249</section> 254</section>
250 255
251<section id="branches"><h2>Protected branches</h2> 256<section id="branches" class="setcard"><h2>Protected branches</h2>
252{{if .Repo.Settings.ProtectedBranches}} 257{{if .Repo.Settings.ProtectedBranches}}
253<ul class="protlist"> 258<ul class="protlist">
254{{$mr := .Repo.Settings.RequireMR}}{{range .Repo.Settings.ProtectedBranches}}<li><code>{{.}}</code>{{if $mr}} <span class="hint">Direct pushes refused, merge requests only.</span>{{end}} 259{{$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 @@
266 <div><select id="branch" name="branch">{{range .Branches}}<option value="{{.Name}}">{{.Name}}</option>{{end}}</select></div> 271 <div><select id="branch" name="branch">{{range .Branches}}<option value="{{.Name}}">{{.Name}}</option>{{end}}</select></div>
267 <div><button type="submit" class="btn">Protect</button></div> 272 <div><button type="submit" class="btn">Protect</button></div>
268</form> 273</form>
269<form method="post" action="{{$base}}" class="setform"> 274<form method="post" action="{{$base}}" class="setform" data-autosave="1">
270 <input type="hidden" name="field" value="require-mr"> 275 <input type="hidden" name="field" value="require-mr">
271 <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> 276 <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>
272 <div class="check"><input type="checkbox" id="require-mr" name="require-mr" value="on"{{if .Repo.Settings.RequireMR}} checked{{end}}></div> 277 <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 @@
274</form> 279</form>
275</section> 280</section>
276 281
277<section id="tags"><h2>Protected tags</h2> 282<section id="tags" class="setcard"><h2>Protected tags</h2>
278{{if .Repo.Settings.ProtectedTags}} 283{{if .Repo.Settings.ProtectedTags}}
279<ul class="protlist"> 284<ul class="protlist">
280{{range .Repo.Settings.ProtectedTags}}<li><code>{{.}}</code> 285{{range .Repo.Settings.ProtectedTags}}<li><code>{{.}}</code>
@@ -294,7 +299,7 @@
294</form> 299</form>
295</section> 300</section>
296 301
297<section id="deps"><h2>Dependencies</h2> 302<section id="deps" class="setcard"><h2>Dependencies</h2>
298<form method="post" action="{{$base}}" class="setform"> 303<form method="post" action="{{$base}}" class="setform">
299 <input type="hidden" name="field" value="deps"> 304 <input type="hidden" name="field" value="deps">
300 <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> 305 <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 @@
346{{end}} 351{{end}}
347</section> 352</section>
348 353
349<section id="runners"><h2>Runners</h2> 354<section id="runners" class="setcard"><h2>Runners</h2>
350{{if .Runners}} 355{{if .Runners}}
351<ul class="protlist"> 356<ul class="protlist">
352{{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> 357{{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 @@
358{{end}} 363{{end}}
359</ul> 364</ul>
360{{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}} 365{{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"> 366<details class="editbox"{{if or (index .Submitted "key") (index .Submitted "jobs")}} open{{end}}>
362 <input type="hidden" name="field" value="runner-add"> 367 <summary>Attach a runner</summary>
363 <label for="runner-key">Attach a runner</label> 368 <form method="post" action="{{$base}}" class="setform stack">
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> 369 <input type="hidden" name="field" value="runner-add">
365 <textarea id="runner-key" name="key" rows="3" spellcheck="false" placeholder="ssh-ed25519 AAAA… (from gitbay-runner init)">{{index .Submitted "key"}}</textarea> 370 <label for="runner-key">Runner public key</label>
366 <label for="runner-jobs">Jobs</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>
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> 372 <textarea id="runner-key" name="key" rows="3" spellcheck="false" placeholder="ssh-ed25519 AAAA… (from gitbay-runner init)">{{index .Submitted "key"}}</textarea>
368 <input type="text" id="runner-jobs" name="jobs" value="{{index .Submitted "jobs"}}"> 373 <label for="runner-jobs">Jobs</label>
369 <button type="submit" class="btn">Attach</button> 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>
370</form> 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>
371</section> 379</section>
372 380
373<section id="lifecycle"><h2>Lifecycle</h2> 381<section id="lifecycle" class="setcard setcard-danger"><h2>Lifecycle</h2>
374<form method="post" action="{{$base}}" class="setform"> 382<form method="post" action="{{$base}}" class="setform">
375 <input type="hidden" name="field" value="archive"> 383 <input type="hidden" name="field" value="archive">
376 <div><label for="archive">Archived</label><p class="hint">Read-only for everyone. Issues and requests close to new activity. Reversible.</p></div> 384 <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 @@
8<div class="pathbar"> 8<div class="pathbar">
9 {{template "refmenu" .}} 9 {{template "refmenu" .}}
10 <span class="crumbs"><a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}">{{.Repo.Name}}</a>/{{range .Crumbs}}<a href="{{.URL}}">{{.Name}}</a>/{{end}}</span> 10 <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}}
11 <div class="acts"> 13 <div class="acts">
12 <a class="button btn" href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/search">Search code</a> 14 <a class="button btn" href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/search">Search code</a>
13 <a class="button btn" href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/log/{{.Ref}}">History</a> 15 <a class="button btn" href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/log/{{.Ref}}">History</a>
@@ -15,9 +17,12 @@
15 </div> 17 </div>
16</div> 18</div>
17<div class="tablewrap"> 19<div class="tablewrap">
18<table class="tree"> 20<table class="tree" id="repo-tree">
21<thead>
19{{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}} 22{{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}}
20<tr class="cols"><th scope="col">name</th><th scope="col" class="lastcommit">last commit</th><th scope="col" class="age">updated</th></tr> 23<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>
21{{range .Entries}}{{$c := index $.LastCommits .Name}}<tr> 26{{range .Entries}}{{$c := index $.LastCommits .Name}}<tr>
22 {{/* the glyph is decorative: the trailing slash is what says directory 27 {{/* the glyph is decorative: the trailing slash is what says directory
23 to anything reading the text, and the icon repeats it in shape so 28 to anything reading the text, and the icon repeats it in shape so
@@ -28,6 +33,7 @@
28 <td class="age"{{if not $c.When.IsZero}} title="{{whenT $c.When}}"{{end}}>{{ago $c.When}}</td> 33 <td class="age"{{if not $c.When.IsZero}} title="{{whenT $c.When}}"{{end}}>{{ago $c.When}}</td>
29</tr> 34</tr>
30{{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}} 35{{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>
31</table> 37</table>
32</div> 38</div>
33{{if .ReadmeHTML}}<section class="readme"> 39{{if .ReadmeHTML}}<section class="readme">