internal/web/templates/settings.html

185f434bf23123c61a922129270c2db4cfebd493
gitbay/internal/web/templates/settings.html history · blame · raw

187 lines · 12364 bytes

  1{{define "width"}}bounded{{end}}
  2{{define "title"}}settings · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
  3{{define "content"}}
  4{{$base := printf "/%s/%s/settings" .Repo.OwnerName .Repo.Name}}
  5<h1>Settings</h1>
  6{{if .Notice}}{{if .Saved}}<p class="notice" role="status">{{.Notice}}</p>{{else}}<p class="error" role="alert">{{.Notice}}</p>{{end}}{{end}}
  7<nav class="sections" aria-label="Sections"><a href="#identity">Identity</a><a href="#access">Access</a><a href="#gates">Merge gates</a><a href="#branches">Protected branches</a><a href="#tags">Protected tags</a>{{if .DepsEnabled}}<a href="#deps">Dependencies</a>{{end}}<a href="#runners">Runners</a><a href="#lifecycle">Lifecycle</a></nav>
  8
  9<section id="identity"><h2>Identity</h2>
 10<form method="post" action="{{$base}}" class="setform">
 11  <input type="hidden" name="field" value="description">
 12  <div><label for="description">Description</label></div>
 13  <div><input type="text" id="description" name="description" value="{{or (index .Submitted "description") .Desc}}" placeholder="one line, shown in listings"></div>
 14  <div><button type="submit">Save</button></div>
 15</form>
 16<form method="post" action="{{$base}}" class="setform">
 17  <input type="hidden" name="field" value="website">
 18  <div><label for="website">Website</label></div>
 19  <div><input type="text" id="website" name="website" value="{{or (index .Submitted "website") .Repo.Settings.Website}}" placeholder="https://example.org"></div>
 20  <div><button type="submit" class="btn">Save</button></div>
 21</form>
 22<form method="post" action="{{$base}}" class="setform">
 23  <input type="hidden" name="field" value="topics">
 24  <div><label for="topics">Topics</label><p class="hint">Comma separated, lower case.</p></div>
 25  <div><input type="text" id="topics" name="topics" value="{{or (index .Submitted "topics") (join .Topics ", ")}}"></div>
 26  <div><button type="submit" class="btn">Save</button></div>
 27</form>
 28{{if .Branches}}<form method="post" action="{{$base}}" class="setform">
 29  <input type="hidden" name="field" value="default-branch">
 30  <div><label for="default-branch">Default branch</label><p class="hint">What a clone checks out and what CI builds on trigger.</p></div>
 31  <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>
 32  <div><button type="submit" class="btn">Save</button></div>
 33</form>{{end}}
 34</section>
 35
 36<section id="access"><h2>Access</h2>
 37<form method="post" action="{{$base}}" class="setform">
 38  <input type="hidden" name="field" value="visibility">
 39  <div><label>Visibility</label><p class="hint">Private repositories answer not found to everyone without access, including in search and on your profile.</p></div>
 40  <div class="check">
 41    <label><input type="radio" name="visibility" value="public"{{if eq .Repo.Visibility "public"}} checked{{end}}> Public</label>
 42    <label><input type="radio" name="visibility" value="private"{{if eq .Repo.Visibility "private"}} checked{{end}}> Private</label>
 43  </div>
 44  <div><button type="submit" class="btn">Save</button></div>
 45</form>
 46<form method="post" action="{{$base}}" class="setform">
 47  <input type="hidden" name="field" value="git-daemon">
 48  <div><label for="git-daemon">Serve over git://</label><p class="hint">Unauthenticated, unencrypted read access on port 9418. Public repositories only.</p></div>
 49  <div class="check"><input type="checkbox" id="git-daemon" name="git-daemon" value="on"{{if .Repo.Settings.GitDaemon}} checked{{end}}></div>
 50  <div><button type="submit" class="btn">Save</button></div>
 51</form>
 52</section>
 53
 54<section id="gates"><h2>Merge gates</h2>
 55<p class="meta">Checked before a merge, in this order: checks, approvals, resolved threads, signatures.</p>
 56<form method="post" action="{{$base}}" class="setform">
 57  <input type="hidden" name="field" value="require-checks">
 58  <div><label for="require-checks">Required checks</label><p class="hint">A request waits until every CI job that would report on its head has succeeded.</p></div>
 59  <div class="check"><input type="checkbox" id="require-checks" name="require-checks" value="on"{{if .Repo.Settings.RequireChecks}} checked{{end}}></div>
 60  <div><button type="submit" class="btn">Save</button></div>
 61</form>
 62<form method="post" action="{{$base}}" class="setform">
 63  <input type="hidden" name="field" value="require-approvals">
 64  <div><label for="approvals">Approvals</label><p class="hint">Approvals from people with write access. Zero means none required.</p></div>
 65  <div><input type="number" id="approvals" name="approvals" min="0" max="10" value="{{.Repo.Settings.RequireApprovals}}"></div>
 66  <div><button type="submit" class="btn">Save</button></div>
 67</form>
 68<form method="post" action="{{$base}}" class="setform">
 69  <input type="hidden" name="field" value="require-resolved">
 70  <div><label for="require-resolved">Review threads</label><p class="hint">Every thread on the diff must be resolved before merging.</p></div>
 71  <div class="check"><input type="checkbox" id="require-resolved" name="require-resolved" value="on"{{if .Repo.Settings.RequireResolved}} checked{{end}}></div>
 72  <div><button type="submit" class="btn">Save</button></div>
 73</form>
 74<form method="post" action="{{$base}}" class="setform">
 75  <input type="hidden" name="field" value="require-codeowners">
 76  <div><label for="require-codeowners">CODEOWNERS</label><p class="hint">Owners of every touched path must approve.</p></div>
 77  <div class="check"><input type="checkbox" id="require-codeowners" name="require-codeowners" value="on"{{if .Repo.Settings.RequireCodeowners}} checked{{end}}></div>
 78  <div><button type="submit" class="btn">Save</button></div>
 79</form>
 80<form method="post" action="{{$base}}" class="setform">
 81  <input type="hidden" name="field" value="require-signed">
 82  <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>
 83  <div class="check"><input type="checkbox" id="require-signed" name="require-signed" value="on"{{if .Repo.Settings.RequireSignedCommits}} checked{{end}}></div>
 84  <div><button type="submit" class="btn">Save</button></div>
 85</form>
 86</section>
 87
 88<section id="branches"><h2>Protected branches</h2>
 89{{if .Repo.Settings.ProtectedBranches}}
 90<ul class="protlist">
 91{{$mr := .Repo.Settings.RequireMR}}{{range .Repo.Settings.ProtectedBranches}}<li><code>{{.}}</code>{{if $mr}} <span class="hint">Direct pushes refused, merge requests only.</span>{{end}}
 92  <form method="post" action="{{$base}}" class="inline">
 93    <input type="hidden" name="field" value="unprotect">
 94    <input type="hidden" name="branch" value="{{.}}">
 95    <button type="submit" class="danger">Unprotect</button>
 96  </form></li>
 97{{end}}
 98</ul>
 99{{else}}<p class="meta">No protected branches. A protected branch refuses deletion and force-pushes.</p>{{end}}
100<form method="post" action="{{$base}}" class="setform">
101  <input type="hidden" name="field" value="protect">
102  <div><label for="branch">Protect a branch</label></div>
103  <div><select id="branch" name="branch">{{range .Branches}}<option value="{{.Name}}">{{.Name}}</option>{{end}}</select></div>
104  <div><button type="submit" class="btn">Protect</button></div>
105</form>
106<form method="post" action="{{$base}}" class="setform">
107  <input type="hidden" name="field" value="require-mr">
108  <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>
109  <div class="check"><input type="checkbox" id="require-mr" name="require-mr" value="on"{{if .Repo.Settings.RequireMR}} checked{{end}}></div>
110  <div><button type="submit" class="btn">Save</button></div>
111</form>
112</section>
113
114<section id="tags"><h2>Protected tags</h2>
115{{if .Repo.Settings.ProtectedTags}}
116<ul class="protlist">
117{{range .Repo.Settings.ProtectedTags}}<li><code>{{.}}</code>
118  <form method="post" action="{{$base}}" class="inline">
119    <input type="hidden" name="field" value="unprotect-tag">
120    <input type="hidden" name="glob" value="{{.}}">
121    <button type="submit" class="danger">Unprotect</button>
122  </form></li>
123{{end}}
124</ul>
125{{else}}<p class="meta">No protected tags. A tag matching a protected glob is created once and refuses moves and deletion. A tag a release is anchored to refuses both regardless.</p>{{end}}
126<form method="post" action="{{$base}}" class="setform">
127  <input type="hidden" name="field" value="protect-tag">
128  <div><label for="glob">Protect tags matching</label></div>
129  <div><input type="text" id="glob" name="glob" placeholder="v*"></div>
130  <div><button type="submit" class="btn">Protect</button></div>
131</form>
132</section>
133
134<section id="deps"><h2>Dependencies</h2>
135<form method="post" action="{{$base}}" class="setform">
136  <input type="hidden" name="field" value="deps">
137  <div><label for="deps">Check for updates</label><p class="hint">Compares the manifests on <code>{{.Repo.DefaultBranch}}</code> against proxy.golang.org, npm, crates.io, and PyPI once a day, and tracks what is behind in an issue. Checking a private repository tells those registries what it depends on.</p></div>
138  <div class="check"><input type="checkbox" id="deps" name="deps" value="on"{{if .DepsEnabled}} checked{{end}}></div>
139  <div><button type="submit" class="btn">Save</button></div>
140</form>
141{{if .DepsEnabled}}
142<p class="meta">Last checked {{if .Deps.LastCheck}}{{when .Deps.LastCheck}}{{else}}never{{end}}{{if .Deps.IssueNumber}} · tracked in <a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/issues/{{.Deps.IssueNumber}}">#{{.Deps.IssueNumber}}</a>{{end}}</p>
143{{if .Deps.LastError}}<p class="error" role="alert">{{.Deps.LastError}}</p>{{end}}
144{{if .Deps.Behind}}<div class="tablewrap"><table class="keys">
145<tr class="cols"><th scope="col">dependency</th><th scope="col">pinned</th><th scope="col">latest</th></tr>
146{{range .Deps.Behind}}<tr>
147  <td class="mono">{{.Ecosystem}} {{.Name}}</td>
148  <td class="mono">{{.Current}}</td>
149  <td class="mono">{{.Latest}}</td>
150</tr>
151{{end}}</table></div>
152{{else}}<p class="none">Nothing behind{{if not .Deps.LastCheck}} — the first check has not run yet{{end}}.</p>{{end}}
153{{end}}
154</section>
155
156<section id="runners"><h2>Runners</h2>
157{{if .Runners}}
158<ul class="protlist">
159{{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}}</span>
160  <form method="post" action="{{$base}}" class="inline">
161    <input type="hidden" name="field" value="runner-remove">
162    <input type="hidden" name="fingerprint" value="{{.Fingerprint}}">
163    <button type="submit" class="danger">Detach</button>
164  </form></li>
165{{end}}
166</ul>
167{{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}}
168<form method="post" action="{{$base}}" class="setform stack">
169  <input type="hidden" name="field" value="runner-add">
170  <label for="runner-key">Attach a runner</label>
171  <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>
172  <textarea id="runner-key" name="key" rows="3" placeholder="ssh-ed25519 AAAA… (from gitbay-runner init)"></textarea>
173  <button type="submit" class="btn">Attach</button>
174</form>
175</section>
176
177<section id="lifecycle"><h2>Lifecycle</h2>
178<form method="post" action="{{$base}}" class="setform">
179  <input type="hidden" name="field" value="archive">
180  <div><label for="archive">Archived</label><p class="hint">Read-only for everyone. Issues and requests close to new activity. Reversible.</p></div>
181  <div class="check"><input type="checkbox" id="archive" name="archive" value="on"{{if .Repo.Settings.Archived}} checked{{end}}></div>
182  <div><button type="submit" class="danger">Save</button></div>
183</form>
184<p class="meta">Deleting or transferring a repository is a CLI operation:
185<code>gitbay repo delete {{.Repo.OwnerName}}/{{.Repo.Name}} --yes</code></p>
186</section>
187{{end}}