internal/web/templates/dashboard.html
88 lines · 5230 bytes
1{{define "width"}}wide{{end}}
2{{define "title"}}dashboard · {{.Site}}{{end}}
3{{define "itemlist"}}
4<ul class="issuelist rows">
5{{range .Items}}<li>
6 <div class="issuemain">
7 <p class="title"><a href="/{{.RepoPath}}/{{$.Kind}}/{{.Number}}">{{.Title}}</a></p>
8 <p class="meta"><span class="repo">{{.RepoPath}}{{if eq $.Kind "mrs"}}!{{else}}#{{end}}{{.Number}}</span> · <a href="/{{.Author}}">{{.Author}}</a> · {{when .UpdatedAt}}{{if eq .State "source_gone"}} · <span class="chip chip-source_gone">source gone</span>{{end}}</p>
9 </div>
10</li>
11{{else}}<li class="empty">{{$.Empty}}</li>{{end}}
12</ul>
13{{end}}
14{{define "queue"}}
15<section class="dashsec">
16<h2 id="{{$.ID}}">{{$.Title}} <span class="count">{{len $.Items}}</span></h2>
17{{if $.Hint}}<p class="hint">{{$.Hint}}</p>{{end}}
18{{template "itemlist" dict "Items" $.Items "Kind" $.Kind "Empty" $.Empty}}
19</section>
20{{end}}
21{{define "tile"}}{{if $.N}}<a class="tile wants" href="#{{$.ID}}"><b>{{$.N}}</b><span>{{$.Label}}</span></a>{{else}}<div class="tile"><b>0</b><span>{{$.Label}}</span></div>{{end}}{{end}}
22{{define "content"}}
23<div class="pagehead">
24 <h1>Dashboard</h1>
25 <span class="grow"></span>
26 <button type="button" class="btn" data-refresh="/" data-refresh-target="dash-root">Refresh</button>
27 <a class="button" href="/new">New repository</a>
28</div>
29
30<div id="dash-root">
31<div class="dashgrid">
32
33<aside class="dashpins" aria-label="Pinned repositories">
34 <div class="dashcard-head">
35 <h2 class="colhead">Pinned</h2>
36 <a class="meta" href="/{{.Viewer}}/-/repositories">All →</a>
37 </div>
38 {{if .Pins}}<input type="search" class="dashfilter" aria-label="Filter pinned repositories" placeholder="Filter pinned…" data-filter-list="dash-pins-list">
39 <p class="meta">issues · MRs · last build</p>
40 <ul id="dash-pins-list" class="pins">
41 {{range .Pins}}<li><a href="/{{.Owner}}/{{.Name}}"><span class="owner">{{.Owner}}/</span>{{.Name}}</a><span class="n" title="{{.Issues}} open issue{{if ne .Issues 1}}s{{end}}, {{.MRs}} open merge request{{if ne .MRs 1}}s{{end}}{{with .Build}}, last build {{.}}{{end}}"><b{{if .Issues}} class="wants"{{end}}>{{.Issues}} <span class="vh">open issues</span></b> <b{{if .MRs}} class="wants"{{end}}>{{.MRs}} <span class="vh">open merge requests</span></b> <span class="dot{{if eq .Build "success"}} ok{{else if or (eq .Build "failure") (eq .Build "error")}} bad{{else if or (eq .Build "pending") (eq .Build "running")}} pend{{end}}"><span class="vh">{{with .Build}}last build {{.}}{{else}}no builds{{end}}</span></span></span></li>
42 {{end}}</ul>
43 {{else}}<p class="none">Nothing pinned — press Pin on a repository you visit.</p>{{end}}
44</aside>
45
46<section class="dashmain">
47<div class="tiles">
48 {{template "tile" dict "N" (len .Reviews) "ID" "reviews" "Label" "waiting on your review"}}
49 {{template "tile" dict "N" (len .Assigned) "ID" "assigned" "Label" "assigned to you"}}
50 {{template "tile" dict "N" (len .MRs) "ID" "mrs" "Label" "open merge requests"}}
51 {{template "tile" dict "N" (len .Issues) "ID" "issues" "Label" "open issues"}}
52</div>
53{{if .Reviews}}{{template "queue" dict "ID" "reviews" "Title" "Waiting on your review" "Items" .Reviews "Kind" "mrs" "Empty" "Nothing waiting on you"}}{{end}}
54{{if .Assigned}}{{template "queue" dict "ID" "assigned" "Title" "Assigned to you" "Items" .Assigned "Kind" "issues" "Empty" "Nothing assigned to you"}}{{end}}
55{{if .MRs}}{{template "queue" dict "ID" "mrs" "Title" "Open merge requests" "Items" .MRs "Kind" "mrs" "Empty" "No open merge requests" "Hint" "Your MRs across all repos."}}{{end}}
56{{if .Issues}}{{template "queue" dict "ID" "issues" "Title" "Open issues" "Items" .Issues "Kind" "issues" "Empty" "No open issues" "Hint" "Your issues across all repos."}}{{end}}
57{{if not (or .Reviews .Assigned .MRs .Issues)}}<div class="setcard"><p class="none">All clear — nothing open or waiting on you.</p></div>{{end}}
58{{range .Queries}}
59<section class="dashsec">
60<h2 id="query-{{.Name}}"><a href="/{{$.Viewer}}/-/queries/{{.Name}}">{{.Name}}</a> <span class="count">{{.Count}}</span></h2>
61<p class="hint"><code>{{.Query}}</code></p>
62{{if .Error}}<p class="none">{{.Error}}</p>{{else}}
63<ul class="issuelist rows">
64{{range .Items}}<li>
65 <div class="issuemain">
66 <p class="title"><a href="/{{.Repo}}/{{if eq .Kind "mr"}}mrs{{else}}issues{{end}}/{{.Number}}">{{.Title}}</a></p>
67 <p class="meta"><span class="repo">{{.Ref}}</span> · <a href="/{{.Author}}">{{.Author}}</a> · {{when .UpdatedAt}}</p>
68 </div>
69</li>
70{{else}}<li class="empty">Nothing matches</li>{{end}}
71</ul>
72{{if gt .Count (len .Items)}}<p class="pager"><a href="/{{$.Viewer}}/-/queries/{{.Name}}">all {{.Count}} →</a></p>{{end}}
73{{end}}
74</section>
75{{end}}
76</section>
77
78<aside class="feedcol" aria-label="Recent activity">
79 <div class="dashcard-head">
80 <h2 class="colhead">Recent activity</h2>
81 </div>
82 {{range .Feed}}<p class="feedline"><a href="/{{.Actor}}">{{.Actor}}</a> {{.Verb}} <a href="{{.URL}}"{{if .Jobs}} title="{{join .Jobs ", "}}"{{end}}>{{.Ref}}</a>{{if .Extra}} {{.Extra}}{{end}}<br><span class="none">{{.Repo}} · <span title="{{whenT .WhenT}}">{{ago .WhenT}}</span></span></p>
83 {{else}}<p class="none">No activity yet</p>{{end}}
84</aside>
85
86</div>
87</div>
88{{end}}