internal/web/templates/dashboard.html

ac8d910ff31c2fadc452928e1d56c64b4af25495
gitbay/internal/web/templates/dashboard.html

89 lines · 5302 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  <a class="button btn" href="/{{.Viewer}}/-/queries">Saved queries</a>
27  <button type="button" class="btn" data-refresh="/" data-refresh-target="dash-root">Refresh</button>
28  <a class="button" href="/new">New repository</a>
29</div>
30
31<div id="dash-root">
32<div class="dashgrid">
33
34<aside class="dashpins" aria-label="Pinned repositories">
35  <div class="dashcard-head">
36    <h2 class="colhead">Pinned</h2>
37    <a class="meta" href="/{{.Viewer}}/-/repositories">All →</a>
38  </div>
39  {{if .Pins}}<input type="search" class="dashfilter" aria-label="Filter pinned repositories" placeholder="Filter pinned…" data-filter-list="dash-pins-list">
40  <p class="meta">issues · MRs · last build</p>
41  <ul id="dash-pins-list" class="pins">
42  {{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>
43  {{end}}</ul>
44  {{else}}<p class="none">Nothing pinned — press Pin on a repository you visit.</p>{{end}}
45</aside>
46
47<section class="dashmain">
48<div class="tiles">
49  {{template "tile" dict "N" (len .Reviews) "ID" "reviews" "Label" "waiting on your review"}}
50  {{template "tile" dict "N" (len .Assigned) "ID" "assigned" "Label" "assigned to you"}}
51  {{template "tile" dict "N" (len .MRs) "ID" "mrs" "Label" "open merge requests"}}
52  {{template "tile" dict "N" (len .Issues) "ID" "issues" "Label" "open issues"}}
53</div>
54{{if .Reviews}}{{template "queue" dict "ID" "reviews" "Title" "Waiting on your review" "Items" .Reviews "Kind" "mrs" "Empty" "Nothing waiting on you"}}{{end}}
55{{if .Assigned}}{{template "queue" dict "ID" "assigned" "Title" "Assigned to you" "Items" .Assigned "Kind" "issues" "Empty" "Nothing assigned to you"}}{{end}}
56{{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}}
57{{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}}
58{{if not (or .Reviews .Assigned .MRs .Issues)}}<div class="setcard"><p class="none">All clear — nothing open or waiting on you.</p></div>{{end}}
59{{range .Queries}}
60<section class="dashsec">
61<h2 id="query-{{.Name}}"><a href="/{{$.Viewer}}/-/queries/{{.Name}}">{{.Name}}</a> <span class="count">{{.Count}}</span></h2>
62<p class="hint"><code>{{.Query}}</code></p>
63{{if .Error}}<p class="none">{{.Error}}</p>{{else}}
64<ul class="issuelist rows">
65{{range .Items}}<li>
66  <div class="issuemain">
67    <p class="title"><a href="/{{.Repo}}/{{if eq .Kind "mr"}}mrs{{else}}issues{{end}}/{{.Number}}">{{.Title}}</a></p>
68    <p class="meta"><span class="repo">{{.Ref}}</span> · <a href="/{{.Author}}">{{.Author}}</a> · {{when .UpdatedAt}}</p>
69  </div>
70</li>
71{{else}}<li class="empty">Nothing matches</li>{{end}}
72</ul>
73{{if gt .Count (len .Items)}}<p class="pager"><a href="/{{$.Viewer}}/-/queries/{{.Name}}">all {{.Count}} →</a></p>{{end}}
74{{end}}
75</section>
76{{end}}
77</section>
78
79<aside class="feedcol" aria-label="Recent activity">
80  <div class="dashcard-head">
81    <h2 class="colhead">Recent activity</h2>
82  </div>
83  {{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>
84  {{else}}<p class="none">No activity yet</p>{{end}}
85</aside>
86
87</div>
88</div>
89{{end}}
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form