internal/web/templates/admin.html

545ba0bcdea3b534903bd78c918c0c025a97eda7
gitbay/internal/web/templates/admin.html

106 lines · 6688 bytes

  1{{define "width"}}wide{{end}}
  2{{define "title"}}admin · {{.Site}}{{end}}
  3{{define "content"}}
  4<div class="adminhead">
  5  <div>
  6    <h1>Admin</h1>
  7    <p class="meta">Server build <code>{{.Commit}}</code> · background worker queues</p>
  8  </div>
  9  <span class="grow"></span>
 10  <button type="button" class="btn" data-refresh="/admin">Refresh</button>
 11</div>
 12
 13<nav class="tabs admintabs" aria-label="Admin">
 14  <a aria-current="page" href="/admin">Queues</a>
 15  <a href="/admin/users">Accounts</a>
 16</nav>
 17
 18<div id="admin-queues">
 19<div class="tiles">
 20  {{with .Queues.Webhooks}}<a class="tile{{if or .Pending .Failed}} wants{{end}}" href="#webhooks"><b>{{.Pending}}</b><span>webhooks pending{{if .Failed}} · {{.Failed}} failed{{end}}</span></a>{{end}}
 21  {{with .Queues.Mail}}<a class="tile{{if or .Pending .Failed}} wants{{end}}" href="#mail"><b>{{.Pending}}</b><span>mail pending{{if .Failed}} · {{.Failed}} failed{{end}}</span></a>{{end}}
 22  {{with .Queues.Push}}<a class="tile{{if or .Pending .Failed}} wants{{end}}" href="#push"><b>{{.Pending}}</b><span>push pending{{if .Failed}} · {{.Failed}} failed{{end}}</span></a>{{end}}
 23  {{with .Queues.Mirrors}}<a class="tile{{if .Errors}} wants{{end}}" href="#mirrors"><b>{{.Errors}}</b><span>mirror errors · {{.Dirty}} dirty</span></a>{{end}}
 24  {{with .Queues.Builds}}<a class="tile{{if or .Pending .Running}} wants{{end}}" href="#builds"><b>{{.Running}}</b><span>builds running · {{.Pending}} queued</span></a>{{end}}
 25  {{with .Queues.Deps}}<a class="tile{{if .Errors}} wants{{end}}" href="#deps"><b>{{.Errors}}</b><span>dependency check errors</span></a>{{end}}
 26</div>
 27
 28<div class="withcol">
 29<nav class="sidecol sticky" aria-label="Sections" data-scrollspy="1">
 30<details class="sidedrop">
 31<summary><span class="sideword">Sections</span></summary>
 32  <div class="grp"><h2 class="colhead">Queues</h2>
 33  <ul>
 34    <li><a href="#webhooks">Webhook deliveries</a></li>
 35    <li><a href="#mail">Mail</a></li>
 36    <li><a href="#push">Push</a></li>
 37    <li><a href="#mirrors">Mirrors</a></li>
 38    <li><a href="#builds">Builds</a></li>
 39    <li><a href="#deps">Dependency checks</a></li>
 40  </ul></div>
 41</details>
 42</nav>
 43<div class="colmain">
 44
 45{{with .Queues.Webhooks}}
 46<section id="webhooks" class="setcard">
 47<h2>Webhook deliveries <span class="count">{{.Pending}}</span></h2>
 48<p class="meta">{{.Pending}} pending · {{.Retrying}} retrying · {{.Failed}} dead-lettered{{if .OldestPending}} · oldest pending {{when .OldestPending}}{{end}}</p>
 49{{if .Items}}<div class="tablewrap"><table class="keys"><thead><tr class="cols"><th>Repository</th><th>URL</th><th>Attempts</th><th>State</th><th>Last error</th></tr></thead><tbody>
 50{{range .Items}}<tr><td><a href="/{{.Repo}}">{{.Repo}}</a></td><td>{{.URL}}</td><td>{{.Attempts}}</td><td>{{if .FailedAt}}dead-lettered {{when .FailedAt}}{{else}}retrying{{end}}</td><td>{{if .Status}}{{.Status}} {{end}}{{.LastError}}</td></tr>
 51{{end}}</tbody></table></div>{{else}}<p class="none">Nothing retrying or dead-lettered</p>{{end}}
 52</section>
 53{{end}}
 54
 55{{with .Queues.Mail}}
 56<section id="mail" class="setcard">
 57<h2>Mail <span class="count">{{.Pending}}</span></h2>
 58<p class="meta">{{.Pending}} pending · {{.Retrying}} retrying · {{.Failed}} failed{{if .OldestPending}} · oldest pending {{when .OldestPending}}{{end}}</p>
 59{{if .Items}}<div class="tablewrap"><table class="keys"><thead><tr class="cols"><th>Mail</th><th>Recipient</th><th>Subject</th><th>Attempts</th><th>State</th><th>Last error</th></tr></thead><tbody>
 60{{range .Items}}<tr><td class="mono">{{.ID}}</td><td>{{.Recipient}}</td><td>{{.Subject}}</td><td>{{.Attempts}}</td><td>{{if .FailedAt}}failed {{when .FailedAt}}{{else}}retrying{{end}}</td><td>{{.LastError}}</td></tr>
 61{{end}}</tbody></table></div>{{else}}<p class="none">Nothing retrying or failed</p>{{end}}
 62</section>
 63{{end}}
 64
 65{{with .Queues.Push}}
 66<section id="push" class="setcard">
 67<h2>Push <span class="count">{{.Pending}}</span></h2>
 68<p class="meta">{{.Pending}} pending · {{.Retrying}} retrying · {{.Failed}} failed{{if .OldestPending}} · oldest pending {{when .OldestPending}}{{end}}</p>
 69{{if .Items}}<div class="tablewrap"><table class="keys"><thead><tr class="cols"><th>Push</th><th>Device</th><th>Title</th><th>Attempts</th><th>State</th><th>Last error</th></tr></thead><tbody>
 70{{range .Items}}<tr><td class="mono">{{.ID}}</td><td class="mono">device {{.DeviceID}}</td><td>{{.Title}}</td><td>{{.Attempts}}</td><td>{{if .FailedAt}}failed {{when .FailedAt}}{{else}}retrying{{end}}</td><td>{{.LastError}}</td></tr>
 71{{end}}</tbody></table></div>{{else}}<p class="none">Nothing retrying or failed</p>{{end}}
 72</section>
 73{{end}}
 74
 75{{with .Queues.Mirrors}}
 76<section id="mirrors" class="setcard">
 77<h2>Mirrors <span class="count">{{.Errors}}</span></h2>
 78<p class="meta">{{.Dirty}} waiting for a sync · {{.Errors}} with a failed last sync</p>
 79{{if .Items}}<div class="tablewrap"><table class="keys"><thead><tr class="cols"><th>Repository</th><th>Direction</th><th>URL</th><th>Last sync</th><th>Error</th></tr></thead><tbody>
 80{{range .Items}}<tr><td><a href="/{{.Repo}}">{{.Repo}}</a></td><td>{{.Direction}}</td><td>{{.URL}}</td><td>{{if .LastSync}}{{when .LastSync}}{{else}}never{{end}}</td><td>{{.LastError}}</td></tr>
 81{{end}}</tbody></table></div>{{else}}<p class="none">Every mirror's last sync succeeded</p>{{end}}
 82</section>
 83{{end}}
 84
 85{{with .Queues.Builds}}
 86<section id="builds" class="setcard">
 87<h2>Builds <span class="count">{{.Pending}}</span></h2>
 88<p class="meta">{{.Pending}} pending · {{.Running}} running{{if .OldestPending}} · oldest pending {{when .OldestPending}}{{end}}</p>
 89{{if .Items}}<div class="tablewrap"><table class="keys"><thead><tr class="cols"><th>Repository</th><th>Build</th><th>Job</th><th>Status</th><th>Since</th></tr></thead><tbody>
 90{{range .Items}}<tr><td><a href="/{{.Repo}}">{{.Repo}}</a></td><td><a href="/{{.Repo}}/builds/{{.Number}}">#{{.Number}}</a></td><td>{{.Job}}</td><td>{{.Status}}</td><td>{{if .StartedAt}}{{when .StartedAt}}{{else}}{{when .CreatedAt}}{{end}}</td></tr>
 91{{end}}</tbody></table></div>{{else}}<p class="none">No build running or pending</p>{{end}}
 92</section>
 93{{end}}
 94
 95{{with .Queues.Deps}}
 96<section id="deps" class="setcard">
 97<h2>Dependency checks <span class="count">{{.Errors}}</span></h2>
 98{{if .Items}}<div class="tablewrap"><table class="keys"><thead><tr class="cols"><th>Repository</th><th>Last check</th><th>Error</th></tr></thead><tbody>
 99{{range .Items}}<tr><td><a href="/{{.Repo}}">{{.Repo}}</a></td><td>{{if .LastCheck}}{{when .LastCheck}}{{else}}never{{end}}</td><td>{{.LastError}}</td></tr>
100{{end}}</tbody></table></div>{{else}}<p class="none">No check has failed</p>{{end}}
101</section>
102{{end}}
103</div>
104</div>
105</div>
106{{end}}