BlueGit

timfa bluegit

Files

bluegit / internal / server / templates / pages.html

pages.html

pages.html 35.4 KiB Download Raw
1{{define "setup"}}
2{{template "layout-start" .}}
3<header class="pagehead"><h1>{{if .StorageUnset}}{{t "setup.choose"}}{{else}}{{t "setup.pathTitle"}}{{end}}</h1></header>
4{{if not .StorageUnset}}
5<p class="flash bad">{{t "setup.changeWarn"}}</p>
6{{end}}
7<section class="panel">
8 {{if .StorageTotal}}
9 <div class="diskuse">
10 {{if .StorageBlueGit}}<p>{{t "setup.usedDir" .StorageBlueGit}}{{if .StoragePartial}} <span class="muted">{{t "setup.usedDirPartial"}}</span>{{end}}</p>{{else if .StoragePartial}}<p class="muted">{{t "setup.usedDirCounting"}}</p>{{end}}
11 {{if .HasReserved}}<p>{{t "setup.diskStatReserved" .StorageTotal .StorageUsed .StorageReserved .StorageFree}}</p>{{else}}<p>{{t "setup.diskStat" .StorageTotal .StorageUsed .StorageFree}}</p>{{end}}
12 <div class="diskbar">
13 <svg class="diskbar-svg" viewBox="0 0 100 8" preserveAspectRatio="none" role="img" aria-label="{{t "setup.diskMeter"}}">
14 <rect class="track" width="100" height="8"></rect>
15 <rect class="fill" width="{{.StoragePercent}}" height="8"></rect>
16 </svg>
17 <span>{{.StoragePercent}}%</span>
18 </div>
19 </div>
20 {{end}}
21 <form method="post" action="/setup">
22 <input type="hidden" name="csrf" value="{{.CSRF}}">
23 <label>{{t "setup.disk"}}
24 <input name="path" value="{{.StoragePath}}" required placeholder="/absolute/path">
25 </label>
26 <button type="submit">{{t "action.save"}}</button>
27 </form>
28 <p class="muted">{{t "setup.rules" .MinFree}}</p>
29</section>
30{{with .Cache}}
31<section class="panel" id="cache">
32 <h2>{{t "setup.cacheTitle"}}</h2>
33 <p class="muted">{{t "setup.cacheLead"}}</p>
34 {{if .enabled}}<p>{{t "setup.cacheUse" .bytes_h .max_h .entries .hits .misses}}</p>{{else}}<p class="muted">{{t "setup.cacheOff"}}</p>{{end}}
35 <form method="post" action="/setup/cache">
36 <input type="hidden" name="csrf" value="{{$.CSRF}}">
37 <label>{{t "setup.cachePath"}} <input name="cache_path" value="{{.path}}" placeholder="/var/cache/bluegit"></label>
38 <label>{{t "setup.cacheMax"}} <input name="max_mb" type="number" min="0" value="{{.max_mb}}" placeholder="512"></label>
39 <button type="submit">{{t "action.save"}}</button>
40 </form>
41 {{if .enabled}}<form method="post" action="/setup/cache/clear"><input type="hidden" name="csrf" value="{{$.CSRF}}"><button type="submit" class="btn-ghost">{{t "setup.cacheClear"}}</button></form>{{end}}
42 <h3>{{t "setup.locTitle"}}</h3>
43 <table class="kv">{{range .locations}}<tr><th>{{index . "what"}}</th><td><code>{{index . "path"}}</code></td><td>{{with index . "disk"}}{{.}}{{else}}?{{end}}</td></tr>{{end}}</table>
44</section>
45{{end}}
46{{if .ShowUpdate}}{{template "updatestatus" .}}{{end}}
47{{template "layout-end" .}}
48{{end}}
49
50{{define "home"}}
51{{template "layout-start" .}}
52<section class="hero">
53 <img src="/assets/logo.svg" alt="BlueGit">
54 <div>
55 <h1>BlueGit</h1>
56 <p>{{t "home.lead"}}</p>
57 {{if .StorageUnset}}<p class="flash bad">{{t "home.storage"}}</p>{{end}}
58 <p><a class="btn" href="/login">{{t "nav.signin"}}</a></p>
59 </div>
60</section>
61{{if .Repos}}
62<section class="panel">
63 <h2>{{t "home.public"}}</h2>
64 <ul class="repolist">
65 {{range .Repos}}<li>{{template "namemark" .}}<div class="grown"><a class="reponame" href="/{{.FullPath}}">{{.FullPath}}</a>{{if .Description}} <span class="muted">{{.Description}}</span>{{end}}</div></li>{{end}}
66 </ul>
67</section>
68{{end}}
69{{template "layout-end" .}}
70{{end}}
71
72{{define "dashboard"}}
73{{template "layout-start" .}}
74<header class="pagehead">
75 <h1>{{t "nav.dashboard"}}</h1>
76 <div class="pageacts"><a class="btn" href="/new">{{t "nav.new"}}</a></div>
77</header>
78{{if .StorageUnset}}<p class="flash bad">{{t "home.storage"}}</p>{{end}}
79{{if .Card}}{{template "usercard" .Card}}{{end}}
80{{if .Heat}}{{template "heatmap" .Heat}}{{end}}
81<div class="grid-2">
82 <section class="panel">
83 <h2>{{t "dash.repos"}}</h2>
84 {{if not .Repos}}<p class="muted">{{t "dash.noRepos"}}</p>{{end}}
85 <ul class="repolist">
86 {{range .Repos}}<li>{{template "namemark" .}}<div class="grown"><a class="reponame" href="/{{.FullPath}}">{{.FullPath}}</a> <span class="pill">{{visName .Visibility}}</span>{{if .Description}}<div class="muted">{{.Description}}</div>{{end}}</div></li>{{end}}
87 </ul>
88 </section>
89 <section class="panel">
90 <h2>{{t "dash.groups"}}</h2>
91 {{if not .Groups}}<p class="muted">{{t "dash.noGroups"}}</p>{{end}}
92 <ul class="repolist">
93 {{range .Groups}}<li>{{template "namemark" .}}<div class="grown"><a class="reponame" href="/groups/{{.Path}}">{{.Name}}</a> <span class="muted">{{.Path}}</span></div></li>{{end}}
94 </ul>
95 </section>
96</div>
97{{template "layout-end" .}}
98{{end}}
99
100{{define "profile"}}
101{{template "layout-start" .}}
102{{if .Card}}{{template "usercard" .Card}}{{end}}
103{{if .Heat}}{{template "heatmap" .Heat}}{{end}}
104<div class="grid-2">
105 <section>
106 <h2>{{t "dash.repos"}}</h2>
107 <ul class="repolist">
108 {{range .Repos}}
109 <li>
110 {{template "namemark" .}}
111 <a class="reponame" href="/{{.FullPath}}">{{.Name}}</a>
112 {{template "visicon" .Visibility}}
113 <span class="muted grown">{{.Description}}</span>
114 </li>
115 {{else}}<li class="muted">{{t "dash.noRepos"}}</li>{{end}}
116 </ul>
117 </section>
118 <section>
119 <h2>{{t "dash.groups"}}</h2>
120 <ul class="repolist">
121 {{range .Groups}}
122 <li>
123 {{template "namemark" .}}
124 <a class="reponame" href="/groups/{{.Path}}">{{.Name}}</a>
125 {{template "visicon" .Visibility}}
126 <span class="muted grown">{{.Path}}</span>
127 </li>
128 {{else}}<li class="muted">{{t "dash.noGroups"}}</li>{{end}}
129 </ul>
130 </section>
131</div>
132{{template "layout-end" .}}
133{{end}}
134
135{{define "usercard"}}
136<section class="usercard panel">
137 {{if .User.AvatarURL}}<img class="avatar xl" src="{{.User.AvatarURL}}" alt="">{{else}}<span class="avatar xl">{{initial .User.Username}}</span>{{end}}
138 <div>
139 {{if eq .Heading "h1"}}<h1>{{.Name}}</h1>{{else}}<h2>{{.Name}}</h2>{{end}}
140 <p class="handle">@{{.User.Username}}</p>
141 {{if .Bio}}<p class="bio">{{.Bio}}</p>{{end}}
142 {{if .Since}}<p class="muted">{{t "profile.since" .Since}}</p>{{end}}
143 <ul class="usercounts">
144 <li><strong>{{.Repos}}</strong> <span>{{t "dash.repos"}}</span></li>
145 <li><strong>{{.Groups}}</strong> <span>{{t "dash.groups"}}</span></li>
146 <li><strong>{{.Contrib}}</strong> <span>{{t "profile.contrib"}}</span></li>
147 </ul>
148 </div>
149 <div class="usercard-actions">
150 <button type="button" class="ghost" data-copy="{{.URL}}">{{t "profile.copy"}}</button>
151 {{if .Own}}<a class="btn" href="/settings">{{t "profile.edit"}}</a>{{end}}
152 </div>
153</section>
154{{end}}
155
156{{define "heatmap"}}
157<section class="heat" aria-label="{{t "heat.title"}}">
158 <h2>{{t "heat.title"}}</h2>
159 <div class="heat-scroll">
160 <div class="heat-months">
161 {{range .Weeks}}<span>{{.Label}}</span>{{end}}
162 </div>
163 <div class="heat-body">
164 <div class="heat-dow" aria-hidden="true"><span></span><span>{{t "heat.mon"}}</span><span></span><span>{{t "heat.wed"}}</span><span></span><span>{{t "heat.fri"}}</span><span></span></div>
165 <div class="heat-cols">
166 {{range .Weeks}}
167 <div class="heat-col">
168 {{range .Days}}{{if .Off}}<span class="sq off"></span>{{else}}<span class="sq lv{{.Level}}" title="{{.Tip}}" aria-label="{{.Tip}}" tabindex="0"></span>{{end}}{{end}}
169 </div>
170 {{end}}
171 </div>
172 </div>
173 </div>
174 <div class="heat-foot">
175 <p class="heat-total">{{.TotalText}}</p>
176 <div>
177 <p class="heat-legend"><span>{{t "heat.less"}}</span><span class="sq lv0"></span><span class="sq lv1"></span><span class="sq lv2"></span><span class="sq lv3"></span><span class="sq lv4"></span><span>{{t "heat.more"}}</span></p>
178 <p class="muted">{{t "heat.note"}}</p>
179 </div>
180 </div>
181</section>
182{{end}}
183
184{{define "new"}}
185{{template "layout-start" .}}
186<header class="pagehead"><h1>{{t "title.new"}}</h1></header>
187<div class="chooser" data-chooser>
188 <button type="button" class="pick" data-open="repo">{{t "new.repo"}}</button>
189 <button type="button" class="pick" data-open="group">{{t "new.group"}}</button>
190</div>
191<div class="sheet" data-sheet hidden>
192 <p><button type="button" class="ghost" data-close>{{t "action.close"}}</button></p>
193 <form class="panel" method="post" action="/new/repo" data-kind="repo" data-free="{{t "slug.free"}}" data-taken="{{t "slug.taken"}}" data-bad="{{t "slug.bad"}}" hidden>
194 <h2>{{t "new.repo"}}</h2>
195 <input type="hidden" name="csrf" value="{{.CSRF}}">
196 <label>{{t "new.name"}} <input name="name" required autocomplete="off"></label>
197 <p class="preview"><span data-slug-text></span> <span data-slug-flag></span></p>
198 <label>{{t "new.description"}} <input name="description"></label>
199 <fieldset class="picklist">
200 <legend>{{t "new.owner"}}</legend>
201 <label>
202 <input type="radio" name="group" value="" checked>
203 {{if .User.AvatarURL}}<img class="avatar" src="{{.User.AvatarURL}}" alt="">{{else}}<span class="avatar {{tileHue .User.Username}}">{{initial .User.Username}}</span>{{end}}
204 <span>{{t "new.me"}}</span>
205 </label>
206 {{range .Groups}}<label>
207 <input type="radio" name="group" value="{{.Path}}">
208 {{template "namemark" .}}
209 <span>{{.Name}}</span>
210 </label>{{end}}
211 </fieldset>
212 <label>{{t "new.visibility"}}
213 <select name="visibility"><option value="private">{{t "vis.private"}}</option><option value="public">{{t "vis.public"}}</option></select>
214 </label>
215 <p class="form-err" data-form-err></p>
216 <button type="submit">{{t "action.save"}}</button>
217 </form>
218 <form class="panel" method="post" action="/new/group" data-kind="group" data-free="{{t "slug.free"}}" data-taken="{{t "slug.taken"}}" data-bad="{{t "slug.bad"}}" hidden>
219 <h2>{{t "new.group"}}</h2>
220 <input type="hidden" name="csrf" value="{{.CSRF}}">
221 <label>{{t "new.name"}} <input name="name" required autocomplete="off"></label>
222 <p class="preview"><span data-slug-text></span> <span data-slug-flag></span></p>
223 <label>{{t "new.description"}} <input name="description"></label>
224 <label>{{t "new.role"}}
225 <select name="default_role">
226 <option value="readonly">{{t "role.readonly"}}</option>
227 <option value="reporter">{{t "role.reporter"}}</option>
228 <option value="developer" selected>{{t "role.developer"}}</option>
229 <option value="maintainer">{{t "role.maintainer"}}</option>
230 </select>
231 </label>
232 <p class="muted">{{t "new.roleHint"}}</p>
233 <p class="form-err" data-form-err></p>
234 <button type="submit">{{t "action.save"}}</button>
235 </form>
236</div>
237<script src="/assets/slug.js"></script>
238<script src="/assets/new.js"></script>
239{{template "layout-end" .}}
240{{end}}
241
242{{define "account"}}
243{{template "layout-start" .}}
244<header class="pagehead"><h1>{{t "title.account"}}</h1></header>
245<p class="muted">{{t "acct.hint"}}</p>
246<section class="panel">
247 <h2>{{t "profile.edit"}}</h2>
248 <form method="post" action="/settings/profile">
249 <input type="hidden" name="csrf" value="{{.CSRF}}">
250 <label>{{t "acct.name"}} <input name="name" value="{{.User.DisplayName}}" maxlength="80"></label>
251 <label>{{t "acct.bio"}} <textarea name="bio" maxlength="280" rows="3">{{.User.Bio}}</textarea></label>
252 <p class="muted">{{t "acct.bioHint"}}</p>
253 <button type="submit">{{t "action.save"}}</button>
254 </form>
255</section>
256<section class="panel">
257 <h2>{{t "acct.language"}}</h2>
258 <form method="post" action="/settings/language">
259 <input type="hidden" name="csrf" value="{{.CSRF}}">
260 <div class="formline">
261 <select name="language">
262 {{range .Langs}}<option value="{{.Code}}" {{if eq .Code $.Lang}}selected{{end}}>{{.Label}}</option>{{end}}
263 </select>
264 <button type="submit">{{t "action.save"}}</button>
265 </div>
266 </form>
267</section>
268{{if .NewToken}}<p class="code">{{.NewToken}}</p>{{end}}
269<section class="panel">
270 <h2>{{t "acct.tokens"}}</h2>
271 <form method="post" action="/settings/tokens">
272 <input type="hidden" name="csrf" value="{{.CSRF}}">
273 <div class="formline"><input name="name" placeholder="{{t "acct.tokenName"}}" aria-label="{{t "acct.tokenName"}}" required><button type="submit">{{t "acct.newToken"}}</button></div>
274 </form>
275 {{if .Tokens}}
276 <div class="hscroll">
277 <table class="acct">
278 <thead><tr>
279 <th>{{t "acct.col.name"}}</th>
280 <th>{{t "acct.col.prefix"}}</th>
281 <th>{{t "acct.col.created"}}</th>
282 <th>{{t "acct.col.used"}}</th>
283 {{if .ShowExpiry}}<th>{{t "acct.col.expires"}}</th>{{end}}
284 <th></th>
285 </tr></thead>
286 <tbody>
287 {{range .Tokens}}<tr>
288 <td>{{.Name}}</td>
289 <td><code>{{.Prefix}}</code></td>
290 <td>{{date .CreatedAt}}</td>
291 <td>{{with date .LastUsedAt}}{{.}}{{else}}{{t "acct.never"}}{{end}}</td>
292 {{if $.ShowExpiry}}<td>{{date .ExpiresAt}}</td>{{end}}
293 <td class="act">
294 <form method="post" action="/settings/tokens/delete" data-confirm="{{t "acct.revokeAsk"}}">
295 <input type="hidden" name="csrf" value="{{$.CSRF}}"><input type="hidden" name="id" value="{{.ID}}">
296 <button class="danger" type="submit">{{t "acct.revoke"}}</button>
297 </form>
298 </td>
299 </tr>{{end}}
300 </tbody>
301 </table>
302 </div>
303 {{end}}
304</section>
305<section class="panel" id="runners">
306 <h2>{{t "runner.title"}}</h2>
307 <p class="muted">{{t "runner.userLead"}}</p>
308 <form method="post" action="/settings/runners/pref">
309 <input type="hidden" name="csrf" value="{{.CSRF}}">
310 <label><input type="radio" name="pref" value="builtin_first" {{if ne .RunnerPref "own_first"}}checked{{end}}> {{t "runner.prefBuiltin"}}</label>
311 <label><input type="radio" name="pref" value="own_first" {{if eq .RunnerPref "own_first"}}checked{{end}}> {{t "runner.prefOwn"}}</label>
312 <button type="submit">{{t "action.save"}}</button>
313 </form>
314 {{template "runnerlist" (dict "Runners" .RunnerList "CSRF" .CSRF "Delete" "/settings/runners/delete" "Token" .NewRunnerToken "New" "/settings/runners/token" "Base" .BaseURL)}}
315</section>
316<section class="panel">
317 <h2>{{t "acct.ssh"}}</h2>
318 <form method="post" action="/settings/ssh">
319 <input type="hidden" name="csrf" value="{{.CSRF}}">
320 <label>{{t "acct.keyName"}} <input name="name" placeholder="laptop"></label>
321 <label>{{t "acct.pubkey"}} <textarea name="key" placeholder="ssh-ed25519 AAAA... " required></textarea></label>
322 <button type="submit">{{t "acct.add"}}</button>
323 </form>
324 {{if .Keys}}
325 <div class="hscroll">
326 <table class="acct">
327 <thead><tr>
328 <th>{{t "acct.col.name"}}</th>
329 <th>{{t "acct.col.fingerprint"}}</th>
330 <th>{{t "acct.col.created"}}</th>
331 <th></th>
332 </tr></thead>
333 <tbody>
334 {{range .Keys}}<tr>
335 <td>{{.Name}}</td>
336 <td><code>{{.Fingerprint}}</code></td>
337 <td>{{date .CreatedAt}}</td>
338 <td class="act">
339 <form method="post" action="/settings/ssh/delete" data-confirm="{{t "acct.removeAsk"}}">
340 <input type="hidden" name="csrf" value="{{$.CSRF}}"><input type="hidden" name="id" value="{{.ID}}">
341 <button class="danger" type="submit">{{t "acct.remove"}}</button>
342 </form>
343 </td>
344 </tr>{{end}}
345 </tbody>
346 </table>
347 </div>
348 {{end}}
349</section>
350<p><a href="/settings/export">{{t "acct.export"}}</a></p>
351{{template "layout-end" .}}
352{{end}}
353
354{{define "ficon"}}
355{{if eq . "dir"}}<svg class="ficon" viewBox="0 0 16 16" aria-hidden="true"><path fill="#8aa0b8" d="M1.5 3.5A1.5 1.5 0 0 1 3 2h3l1.2 1.5H13A1.5 1.5 0 0 1 14.5 5v7.2a1.3 1.3 0 0 1-1.3 1.3H2.8A1.3 1.3 0 0 1 1.5 12.2z"/></svg>
356{{else if eq . "md"}}<svg class="ficon" viewBox="0 0 16 16" aria-hidden="true"><path fill="#1f6feb" d="M2 3h12v10H2z"/><path fill="#fff" d="M4 10V6h1.2l1.3 2 1.3-2H9v4H7.8V8L6.5 10 5.2 8v2zm6.2 0V8.2H9l1.8-2.2h1.4L10.6 8.2H12V10z"/></svg>
357{{else if eq . "code"}}<svg class="ficon" viewBox="0 0 16 16" aria-hidden="true"><path fill="#cf222e" d="M6.2 4.2 2.4 8l3.8 3.8-1.1 1.1L.2 8l4.9-4.9zm3.6 0 1.1-1.1L15.8 8l-4.9 4.9-1.1-1.1L13.6 8z"/></svg>
358{{else if eq . "cfg"}}<svg class="ficon" viewBox="0 0 16 16" aria-hidden="true"><path fill="#9a6700" d="M8 1.5 14 5v6l-6 3.5L2 11V5z"/></svg>
359{{else if eq . "lic"}}<svg class="ficon" viewBox="0 0 16 16" aria-hidden="true"><path fill="#8250df" d="M4 1.5h8v13l-4-2.2-4 2.2z"/></svg>
360{{else if eq . "img"}}<svg class="ficon" viewBox="0 0 16 16" aria-hidden="true"><path fill="#1a7f37" d="M2 3h12v10H2z"/><circle cx="6" cy="6.5" r="1.2" fill="#fff"/><path fill="#fff" d="m3.5 11 3-3 2 2 1.5-1.5 2.5 2.5z"/></svg>
361{{else}}<svg class="ficon" viewBox="0 0 16 16" aria-hidden="true"><path fill="#6e7781" d="M4 1.5h5l3 3V14H4z"/><path fill="#fff" d="M9 1.5v3h3"/></svg>
362{{end}}
363{{end}}
364
365{{define "visicon"}}
366{{if eq . "public"}}<svg class="vis" viewBox="0 0 16 16" aria-label="{{t "vis.public"}}"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="1.4"/><path fill="none" stroke="currentColor" stroke-width="1.2" d="M2 8h12M8 2c1.8 1.8 1.8 10.2 0 12M8 2c-1.8 1.8-1.8 10.2 0 12"/></svg>
367{{else}}<svg class="vis" viewBox="0 0 16 16" aria-label="{{t "vis.private"}}"><rect x="3.5" y="7" width="9" height="6.5" rx="1" fill="none" stroke="currentColor" stroke-width="1.4"/><path fill="none" stroke="currentColor" stroke-width="1.4" d="M5.5 7V5a2.5 2.5 0 0 1 5 0v2"/></svg>
368{{end}}
369{{end}}
370
371{{define "branchpick"}}
372<label class="branch">
373 <select data-rev>
374 {{range .Branches}}<option value="{{.Name}}" {{if eq .Name $.Rev}}selected{{end}}>{{.Name}}</option>{{end}}
375 </select>
376</label>
377{{if .RevProtected}}<svg class="vis" viewBox="0 0 16 16" aria-label="{{t "vis.protected"}}"><rect x="3.5" y="7" width="9" height="6.5" rx="1" fill="none" stroke="currentColor" stroke-width="1.4"/><path fill="none" stroke="currentColor" stroke-width="1.4" d="M5.5 7V5a2.5 2.5 0 0 1 5 0v2"/></svg>{{end}}
378{{end}}
379
380{{define "avatar"}}
381{{if .UserURL}}<a class="avatarlink" href="{{.UserURL}}">{{end}}
382{{if .Avatar}}<img class="avatar" src="{{.Avatar}}" alt="">{{else}}<span class="avatar">{{if .Initial}}{{.Initial}}{{else}}{{initial .Author}}{{end}}</span>{{end}}
383{{if .UserURL}}</a>{{end}}
384{{end}}
385
386{{define "commitwho"}}<span class="commitwho">{{if .UserURL}}<a href="{{.UserURL}}">{{.Author}}</a>{{else}}{{.Author}}{{end}}{{if .RawName}} {{.RawName}}{{end}}{{if .PushedBy}} · <a href="/users/{{.PushedBy}}">{{t "commit.pushedBy" .PushedBy}}</a>{{end}}</span>{{end}}
387
388{{define "commitbar"}}
389{{if .Head}}
390<div class="commitbar">
391 {{template "avatar" .Head}}
392 <div class="grow">
393 <a class="subject" href="/{{.Repo.FullPath}}/-/commit/{{.Head.SHA}}">{{.Head.Subject}}</a>
394 <div class="muted">{{template "commitwho" .Head}} · {{.Head.When}}</div>
395 </div>
396 {{if and .Head.PipeStatus (eq .Page "overview")}}
397 <span class="headpipe" data-head-pipe data-pipe="{{.Head.PipeID}}"{{if .Head.PipeLive}} data-live="/{{.Repo.FullPath}}/-/pipelines/{{.Head.PipeID}}" data-live-on="1"{{end}}>
398 <a class="status {{.Head.PipeStatus}}" data-pipe-status href="/{{.Repo.FullPath}}/-/pipelines/{{.Head.PipeID}}"><span class="mark"></span><span data-pipe-label>{{.Head.PipeLabel}}</span></a>
399 <span class="muted" data-pipe-duration>{{.Head.PipeDuration}}</span>
400 {{template "stage-dots" .}}
401 </span>
402 {{template "pipe-retry" (dict "Can" .CanWrite "CSRF" .CSRF "Path" .Repo.FullPath "ID" .Head.PipeID "Failed" .Head.PipeFailed "Back" (printf "/%s" .Repo.FullPath))}}
403 {{else if .Head.PipeStatus}}<a class="status {{.Head.PipeStatus}}" href="/{{.Repo.FullPath}}/-/pipelines/{{.Head.PipeID}}"><span class="mark"></span>{{.Head.PipeLabel}}</a>{{end}}
404 <code class="sha">{{slice .Head.SHA 0 8}}</code>
405 <button type="button" class="iconbtn" data-copy="{{.Head.SHA}}" aria-label="{{t "action.copy"}}">{{t "action.copy"}}</button>
406 <a class="btn ghost" href="/{{.Repo.FullPath}}/-/commits?rev={{.Rev}}">{{t "repo.history"}}</a>
407</div>
408{{end}}
409{{end}}
410
411{{define "stage-dots"}}
412{{with .Head}}
413<div class="stages">
414 {{range .PipeStages}}
415 <span class="stage">
416 <button type="button" class="stage-dot {{.Status}}" data-stage="{{.Name}}" data-tip="{{.Tip}}" aria-label="{{.Tip}}"><span class="mark"></span></button>
417 <div class="stage-pop" popover="manual">
418 <strong>{{t "pipe.stage"}}: {{.Name}}</strong>
419 <ul>
420 {{range .Jobs}}<li data-job="{{.ID}}"><a href="/{{$.Repo.FullPath}}/-/pipelines/{{$.Head.PipeID}}/jobs/{{.ID}}"><span class="stage-dot sm {{.Status}}"><span class="mark"></span></span>{{.Name}}{{if .Queue}} <span class="queue" data-queue>{{.Queue}}</span>{{end}}</a></li>{{end}}
421 </ul>
422 </div>
423 </span>
424 {{end}}
425</div>
426{{end}}
427{{end}}
428
429{{define "codemenu"}}
430<details class="menu" data-clone>
431 <summary class="btn">{{t "repo.code"}}</summary>
432 <div class="menu-panel" popover="manual">
433 {{if .CloneSSH}}
434 <p class="muted">{{t "repo.ssh"}}</p>
435 <div class="copyline"><input readonly value="{{.CloneSSH}}" aria-label="{{t "repo.ssh"}}"><button type="button" data-copy="{{.CloneSSH}}">{{t "action.copy"}}</button></div>
436 {{end}}
437 <p class="muted">{{t "repo.https"}}</p>
438 <div class="copyline"><input readonly value="{{.CloneHTTP}}" aria-label="{{t "repo.https"}}"><button type="button" data-copy="{{.CloneHTTP}}">{{t "action.copy"}}</button></div>
439 <p class="muted">{{t "repo.cloneHint"}}</p>
440 </div>
441</details>
442{{end}}
443
444{{define "filetable"}}
445{{if .Files}}
446<div class="hscroll">
447<table class="files">
448 <thead><tr><th>{{t "repo.name"}}</th><th>{{t "repo.lastCommit"}}</th><th>{{t "repo.lastChange"}}</th></tr></thead>
449 <tbody>
450 {{range .Files}}
451 <tr>
452 <td>{{template "ficon" .Icon}} {{if .Dir}}<a href="/{{$.Repo.FullPath}}/-/tree/{{.Path}}?rev={{$.Rev}}">{{.Name}}</a>{{else}}<a href="/{{$.Repo.FullPath}}/-/blob/{{.Path}}?rev={{$.Rev}}">{{.Name}}</a>{{end}}</td>
453 <td class="msg">{{if .SHA}}<a href="/{{$.Repo.FullPath}}/-/commit/{{.SHA}}">{{.Subject}}</a>{{end}}</td>
454 <td class="muted">{{.When}}</td>
455 </tr>
456 {{end}}
457 </tbody>
458</table>
459</div>
460{{else if eq .Page "files"}}<p class="muted">{{t "repo.emptyDir"}}</p>{{else if not .Head}}<p class="panel">{{t "repo.noCommits"}}</p>{{end}}
461{{end}}
462
463{{define "repo"}}
464{{template "layout-start" .}}
465<header class="pagehead">
466 <h1>{{t "tab.overview"}}</h1>
467 <div class="pageacts">
468 <a class="btn ghost" href="/{{.Repo.FullPath}}/-/tree?rev={{.Rev}}&amp;focus=1">{{t "repo.searchFile"}}</a>
469 </div>
470</header>
471{{if .Heat}}{{template "heatmap" .Heat}}{{end}}
472<div class="proj">
473 <div>
474 <div class="toolbar">
475 <div class="left">{{template "branchpick" .}} <span class="pathnow">{{.Repo.Name}}</span></div>
476 <div class="right">{{template "codemenu" .}}</div>
477 </div>
478 {{template "commitbar" .}}
479 {{template "filetable" .}}
480 {{if .ReadmeName}}
481 <article class="readme">
482 <header>{{template "ficon" "md"}} {{.ReadmeName}}</header>
483 <div class="mdbody">{{.Readme}}</div>
484 </article>
485 {{end}}
486 </div>
487 <aside class="side">
488 <h2>{{t "repo.project"}}</h2>
489 {{if .Repo.Description}}<p>{{.Repo.Description}}</p>{{end}}
490 <ul class="counts">
491 <li><a href="/{{.Repo.FullPath}}/-/commits?rev={{.Rev}}">{{tn .NCommits "count.commit.one" "count.commit.many"}}</a></li>
492 <li><a href="/{{.Repo.FullPath}}/-/branches">{{tn .NBranches "count.branch.one" "count.branch.many"}}</a></li>
493 <li><a href="/{{.Repo.FullPath}}/-/tags">{{tn .NTags "count.tag.one" "count.tag.many"}}</a></li>
494 <li><a href="/{{.Repo.FullPath}}/-/releases">{{tn .NReleases "count.release.one" "count.release.many"}}</a></li>
495 </ul>
496 {{if .ReadmeName}}<p><a href="/{{.Repo.FullPath}}/-/blob/{{.ReadmeName}}?rev={{.Rev}}">README</a></p>{{end}}
497 {{if .LicensePath}}<p><a href="/{{.Repo.FullPath}}/-/blob/{{.LicensePath}}?rev={{.Rev}}">LICENSE</a></p>{{end}}
498 {{if .Created}}<p class="muted">{{t "repo.created" .Created}}</p>{{end}}
499 </aside>
500</div>
501<script src="/assets/repo.js"></script>
502{{if and .Head .Head.PipeLive}}<script src="/assets/pipeline.js"></script>{{end}}
503{{template "layout-end" .}}
504{{end}}
505
506{{define "files"}}
507{{template "layout-start" .}}
508<header class="pagehead"><h1>{{t "tab.files"}}</h1></header>
509<div class="fileview">
510 <aside class="treebox">
511 <h2>{{t "repo.files"}}</h2>
512 <input type="search" placeholder="{{t "group.search"}}" aria-label="{{t "group.search"}}" data-tree-filter>
513 <ul class="treelist" data-repo="{{.Repo.FullPath}}">
514 {{range .Tree}}
515 <li class="depth-{{.Depth}}{{if .Dir}} dir{{end}}{{if .Open}} open{{end}}{{if .Active}} active{{end}}" data-path="{{.Path}}"{{if .Dir}} data-dir="1"{{end}}>
516 {{if .Dir}}<button type="button" class="twist" aria-expanded="{{if .Open}}true{{else}}false{{end}}" aria-label="{{t "repo.fold"}}"><svg class="chevron" viewBox="0 0 16 16" aria-hidden="true"><path d="M6 3.5 11 8 6 12.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg></button>{{else}}<span class="twistpad" aria-hidden="true"></span>{{end}}
517 {{template "ficon" .Icon}}
518 {{if .Dir}}<a href="/{{$.Repo.FullPath}}/-/tree/{{.Path}}?rev={{$.Rev}}">{{.Name}}</a>{{else}}<a href="/{{$.Repo.FullPath}}/-/blob/{{.Path}}?rev={{$.Rev}}">{{.Name}}</a>{{end}}
519 </li>
520 {{end}}
521 </ul>
522 </aside>
523 <div class="filecol">
524 <div class="toolbar">
525 <div class="left">
526 {{template "branchpick" .}}
527 <span class="pathnow">
528 <a href="/{{.Repo.FullPath}}/-/tree?rev={{.Rev}}">{{.Repo.Name}}</a>
529 {{if .BlobPath}}{{range splitPath .BlobPath}} / <span>{{.}}</span>{{end}}{{else if .TreePath}}{{range splitPath .TreePath}} / <span>{{.}}</span>{{end}}{{end}}
530 </span>
531 {{if or .BlobPath .TreePath}}<button type="button" class="iconbtn" data-copy="{{if .BlobPath}}{{.BlobPath}}{{else}}{{.TreePath}}{{end}}" aria-label="{{t "action.copy"}}">{{t "action.copy"}}</button>{{end}}
532 </div>
533 <div class="right">{{template "codemenu" .}}</div>
534 </div>
535 <div class="filepane">
536 {{if .BlobPath}}
537 <h2 class="filename">{{template "ficon" (iconOf .FileName)}} {{.FileName}}</h2>
538 {{template "commitbar" .}}
539 <article class="codebox">
540 <header>{{template "ficon" (iconOf .FileName)}} {{.FileName}} <span class="muted">{{.BlobSize}}</span></header>
541 {{if .Binary}}<p>{{t "repo.binary"}}</p>{{else}}
542 <table class="code">
543 {{range .Lines}}<tr><td class="ln">{{.N}}</td><td class="src">{{.HTML}}</td></tr>{{end}}
544 </table>
545 {{end}}
546 </article>
547 {{else}}
548 {{template "filetable" .}}
549 {{end}}
550 </div>
551 </div>
552</div>
553<script src="/assets/repo.js"></script>
554{{template "layout-end" .}}
555{{end}}
556
557{{define "tags"}}
558{{template "layout-start" .}}
559<div class="refhead">
560 <h1>{{t "title.tags"}}</h1>
561 {{if .CanWrite}}<button type="button" data-tag-create>{{t "tag.create"}}</button>{{end}}
562</div>
563<form class="refsearch" method="get" action="/{{.Repo.FullPath}}/-/tags">
564 <input type="search" name="q" value="{{.Query}}" placeholder="{{t "tag.search"}}" aria-label="{{t "tag.search"}}">
565 <button class="refgo" type="submit" aria-label="{{t "tag.search"}}"><svg class="ico" viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M11.5 7a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0zm-.9 4.3 3.4 3.4a.75.75 0 1 0 1.1-1.1l-3.4-3.4a6 6 0 1 0-1.1 1.1z"/></svg></button>
566</form>
567{{if .Tags}}
568<section class="refgroup">
569 {{range .Tags}}
570 <article class="refrow">
571 <div class="refmain">
572 <div class="refname">
573 <code>{{.Name}}</code>
574 <button type="button" class="iconbtn refcopy" data-copy="{{.Name}}" aria-label="{{t "action.copy"}}"><svg class="ico" viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M5.5 1A1.5 1.5 0 0 0 4 2.5V10a1.5 1.5 0 0 0 1.5 1.5h6A1.5 1.5 0 0 0 13 10V2.5A1.5 1.5 0 0 0 11.5 1h-6zM2 5.5A1.5 1.5 0 0 1 3.5 4H4v6.5A2.5 2.5 0 0 0 6.5 13H11v.5A1.5 1.5 0 0 1 9.5 15h-6A1.5 1.5 0 0 1 2 13.5v-8z"/></svg></button>
575 {{if .Protected}}<span class="pill refbadge">{{t "vis.protected"}}</span>{{end}}
576 </div>
577 <p class="refmeta">
578 {{if .SHA}}<a href="/{{$.Repo.FullPath}}/-/commit/{{.SHA}}"><code>{{.Short}}</code></a>{{end}}
579 {{if .Subject}}{{if .SHA}}<span class="refdot" aria-hidden="true">·</span>{{end}}<span class="refsubject" title="{{.Subject}}">{{.Subject}}</span>{{end}}
580 {{if .When}}{{if or .SHA .Subject}}<span class="refdot" aria-hidden="true">·</span>{{end}}<span class="muted when-short" title="{{.Date}}">{{.When}}</span>{{end}}
581 </p>
582 {{if .Annotated}}<p class="refnote"><span class="pill">{{t "tag.annotated"}}</span> {{.Message}}</p>{{else}}<p class="muted refnote">{{t "tag.lightweight"}}</p>{{end}}
583 {{if .HasRelease}}<p class="refnote"><a href="/{{$.Repo.FullPath}}/-/releases#{{.Name}}">{{t "tag.release"}}</a></p>{{end}}
584 </div>
585 <div class="refacts">
586 <details class="rowmenu">
587 <summary class="refdlbtn" aria-label="{{t "branch.download"}}"><svg class="ico" viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M7.25 2.25a.75.75 0 0 1 1.5 0v6.19l1.72-1.72a.75.75 0 1 1 1.06 1.06l-3 3a.75.75 0 0 1-1.06 0l-3-3a.75.75 0 1 1 1.06-1.06l1.72 1.72V2.25zM3.75 12.5a.75.75 0 0 0 0 1.5h8.5a.75.75 0 0 0 0-1.5h-8.5z"/></svg></summary>
588 <div class="menu-panel refdl">
589 <a href="{{.ZipURL}}">{{t "tag.zip"}}</a>
590 <a href="{{.TarURL}}">{{t "tag.tgz"}}</a>
591 </div>
592 </details>
593 {{if .CanDelete}}<button type="button" class="ghost tiny" data-tag-open data-tag="{{.Name}}">{{t "tag.delete"}}</button>{{end}}
594 </div>
595 </article>
596 {{end}}
597</section>
598{{else if .Query}}<p class="muted">{{t "tag.noMatch"}}</p>{{else}}<p class="muted">{{t "repo.noTags"}}</p>{{end}}
599{{if .CanWrite}}
600<dialog class="branch-dialog" data-tag-form>
601 <form method="post" action="/{{.Repo.FullPath}}/-/tags">
602 <h2>{{t "tag.create"}}</h2>
603 <input type="hidden" name="csrf" value="{{.CSRF}}">
604 <label>{{t "tag.name"}} <input name="name" required autocomplete="off"></label>
605 <label>{{t "tag.target"}} <input name="target" list="tag-targets" value="{{.Rev}}" required></label>
606 <datalist id="tag-targets">{{range .Branches}}<option value="{{.Name}}"></option>{{end}}</datalist>
607 <label>{{t "tag.message"}} <input name="message" autocomplete="off"></label>
608 <div class="row">
609 <button type="submit">{{t "tag.create"}}</button>
610 <button type="button" class="ghost" data-tag-form-close>{{t "action.cancel"}}</button>
611 </div>
612 </form>
613</dialog>
614<dialog class="danger-modal" data-tag-dialog>
615 <form method="post" action="/{{.Repo.FullPath}}/-/tags/delete">
616 <input type="hidden" name="csrf" value="{{.CSRF}}">
617 <input type="hidden" name="name" value="" data-tag-name>
618 <p data-tag-copy data-pattern="{{t "tag.confirm" "%s"}}"></p>
619 <div class="row">
620 <button type="submit" data-tag-submit>{{t "tag.delete"}}</button>
621 <button type="button" class="ghost" data-tag-cancel>{{t "action.close"}}</button>
622 </div>
623 </form>
624</dialog>
625<script src="/assets/tags.js"></script>
626{{end}}
627{{template "layout-end" .}}
628{{end}}
629
630{{define "commits"}}
631{{template "layout-start" .}}
632<form class="clog" method="get" action="/{{.Repo.FullPath}}/-/commits">
633 <div class="clogref">
634 <label class="clogpick">
635 <svg class="ico" viewBox="0 0 16 16" aria-hidden="true"><circle cx="4" cy="3.2" r="1.5" fill="currentColor"/><circle cx="4" cy="12.8" r="1.5" fill="currentColor"/><circle cx="12" cy="6.4" r="1.5" fill="currentColor"/><path d="M4 4.7v6.6M4 6.4c2.4 0 4.2.2 6 .2 1.2 0 2 1 2 1.8" fill="none" stroke="currentColor" stroke-width="1.3"/></svg>
636 <select name="rev" data-rev aria-label="{{t "tab.branches"}}">
637 {{range .Branches}}<option value="{{.Name}}"{{if eq .Name $.Rev}} selected{{end}}>{{.Name}}</option>{{end}}
638 </select>
639 </label>
640 <a class="clogrepo" href="/{{.Repo.FullPath}}{{if .Rev}}?rev={{urlquery .Rev}}{{end}}">{{.Repo.Name}}</a>
641 </div>
642 <h1>{{t "title.commits"}}</h1>
643 <label class="clogsearch">
644 <input type="search" name="q" value="{{.Query}}" placeholder="{{t "commit.search"}}" aria-label="{{t "commit.search"}}" autocomplete="off">
645 <button type="submit" aria-label="{{t "commit.search"}}"><svg class="ico" viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M11.5 7a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0zm-.9 4.3 3.4 3.4a.75.75 0 1 0 1.1-1.1l-3.4-3.4a6 6 0 1 0-1.1 1.1z"/></svg></button>
646 </label>
647</form>
648{{if .CommitDays}}
649 {{range .CommitDays}}
650 <section class="cday">
651 <h2>{{.Label}}</h2>
652 {{range .Items}}
653 <article class="ccard" data-commit>
654 {{if .WhoURL}}<a class="avatarlink" href="{{.WhoURL}}">{{end}}
655 {{if .Ident}}{{.Ident}}{{else if .Avatar}}<img class="avatar" src="{{.Avatar}}" alt="">{{else}}<span class="avatar">{{if .Initial}}{{.Initial}}{{else}}{{initial .Author}}{{end}}</span>{{end}}
656 {{if .WhoURL}}</a>{{end}}
657 <div class="cmain">
658 <a class="csubject" href="/{{$.Repo.FullPath}}/-/commit/{{.SHA}}">{{.Subject}}</a>
659 <p class="cby">{{if .WhoURL}}<a href="{{.WhoURL}}">{{.Who}}</a>{{else}}{{.Who}}{{end}} {{t "commit.authoredWhen" .When}}</p>
660 </div>
661 <div class="cacts">
662 {{if .PipeStatus}}<a class="status {{.PipeStatus}} markonly" href="/{{$.Repo.FullPath}}/-/pipelines/{{.PipeID}}" aria-label="{{.PipeLabel}}"><span class="mark"></span></a>{{end}}
663 <code>{{if gt (len .SHA) 8}}{{slice .SHA 0 8}}{{else}}{{.SHA}}{{end}}</code>
664 <button type="button" class="iconbtn" data-copy="{{.SHA}}" aria-label="{{t "action.copy"}}"><svg class="ico" viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M5.5 1A1.5 1.5 0 0 0 4 2.5V10a1.5 1.5 0 0 0 1.5 1.5h6A1.5 1.5 0 0 0 13 10V2.5A1.5 1.5 0 0 0 11.5 1h-6zM2 5.5A1.5 1.5 0 0 1 3.5 4H4v6.5A2.5 2.5 0 0 0 6.5 13H11v.5A1.5 1.5 0 0 1 9.5 15h-6A1.5 1.5 0 0 1 2 13.5v-8z"/></svg></button>
665 <a class="iconbtn" href="/{{$.Repo.FullPath}}/-/tree?rev={{urlquery .SHA}}" aria-label="{{t "commit.files"}}"><svg class="ico" viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M1.5 3.25C1.5 2.56 2.06 2 2.75 2h3.19c.46 0 .9.18 1.23.51l.91.91h5.17c.69 0 1.25.56 1.25 1.25v7.08c0 .69-.56 1.25-1.25 1.25H2.75c-.69 0-1.25-.56-1.25-1.25V3.25z"/></svg></a>
666 <button type="button" class="iconbtn cchev" data-commit-toggle aria-expanded="false" aria-label="{{t "commit.expand"}}"></button>
667 </div>
668 <div class="cmsg" hidden>{{.Body}}</div>
669 </article>
670 {{end}}
671 </section>
672 {{end}}
673 {{if or .CommitPrev .CommitNext}}
674 <nav class="clogmore">
675 {{if .CommitPrev}}<a href="{{.CommitPrev}}">{{t "commit.prev"}}</a>{{end}}
676 {{if .CommitNext}}<a href="{{.CommitNext}}">{{t "commit.more"}}</a>{{end}}
677 </nav>
678 {{end}}
679{{else if .Query}}
680<p class="muted">{{t "commit.none"}}</p>
681{{else}}
682<p class="muted">{{t "repo.noCommits"}}</p>
683{{end}}
684<script src="/assets/commits.js"></script>
685<script src="/assets/repo.js"></script>
686{{template "layout-end" .}}
687{{end}}
688
689
690{{define "runnerlist"}}
691{{if .Token}}<p>{{t "runner.tokenOnce"}}</p><p class="code">{{.Token}}</p>
692<pre class="code">sudo bluegit-runner register --url {{.Base}} --token {{.Token}}</pre>{{end}}
693<form method="post" action="{{.New}}">
694 <input type="hidden" name="csrf" value="{{.CSRF}}">
695 <button type="submit">{{t "runner.new"}}</button>
696</form>
697{{if .Runners}}
698<div class="hscroll">
699<table class="acct">
700 <thead><tr><th>{{t "acct.col.name"}}</th><th>{{t "runner.status"}}</th><th>{{t "runner.seen"}}</th><th>{{t "runner.version"}}</th><th></th></tr></thead>
701 <tbody>
702 {{range .Runners}}<tr>
703 <td>{{.Name}}</td>
704 <td>{{if .Online}}<span class="pill">{{t "runner.online"}}</span>{{else}}<span class="muted">{{t "runner.offline"}}</span>{{end}}</td>
705 <td>{{date .LastSeen}}</td>
706 <td>{{.Version}}</td>
707 <td class="act">
708 <form method="post" action="{{$.Delete}}" data-confirm="{{t "runner.revokeAsk"}}">
709 <input type="hidden" name="csrf" value="{{$.CSRF}}"><input type="hidden" name="id" value="{{.ID}}">
710 <button class="danger" type="submit">{{t "acct.revoke"}}</button>
711 </form>
712 </td>
713 </tr>{{end}}
714 </tbody>
715</table>
716</div>
717{{else}}<p class="muted">{{t "runner.none"}}</p>{{end}}
718{{end}}