Jamie Holdstock a254e943f7
webapi: Add missed tickets to admin page.
A new tab on the admin page displays a list of all tickets which were
registered with the VSP but missed their votes. Clicking on the ticket
hash redirects to the Ticket Search tab with the details of the missed
ticket displayed.
2023-09-26 17:18:32 +01:00

246 lines
12 KiB
HTML

{{ template "header" . }}
<div class="vsp-overview pt-4 pb-3 mb-3">
<div class="container">
<div class="d-flex flex-wrap">
<h1>Admin Panel</h1>
</div>
{{ template "vsp-stats" . }}
</div>
</div>
<div class="container">
<div class="row">
<div class="col-12 pt-2 pb-4">
<div class="block__content">
<div class="tabset">
<input
type="radio"
name="tabset_1"
id="tabset_1_1"
hidden
{{ with .SearchResult }}{{ else }}checked{{ end }}
>
<input
type="radio"
name="tabset_1"
id="tabset_1_2"
hidden
{{ with .SearchResult }}checked{{ end }}
>
<input
type="radio"
name="tabset_1"
id="tabset_1_3"
hidden
>
<input
type="radio"
name="tabset_1"
id="tabset_1_4"
hidden
>
<input
type="radio"
name="tabset_1"
id="tabset_1_5"
hidden
>
<ul>
<li><label for="tabset_1_1">VSP Status</label></li>
<li><label for="tabset_1_2">Ticket Search</label></li>
<li><label for="tabset_1_3">Missed Tickets</label></li>
<li><label for="tabset_1_4">Database</label></li>
<li><label for="tabset_1_5">Logout</label></li>
</ul>
<div>
<section class="d-flex row justify-content-center">
<div class="vsp-status">
<h1>Local dcrd</h1>
<table class="vsp-status">
<thead>
<th>URL</th>
<th>Height</th>
</thead>
<tbody>
<tr>
<td>{{ stripWss .DcrdStatus.Host }}</td>
{{ if .DcrdStatus.Connected }}
{{ if .DcrdStatus.BestBlockError }}
<td>
<div class="center">
<div class="status bad center with-text">
Error
</div>
</div>
</td>
{{ else }}
<td>{{ .DcrdStatus.BestBlockHeight }}</td>
{{ end }}
{{else}}
<td>
<div class="center">
<div class="status bad center with-text">
Cannot connect
</div>
</div>
</td>
{{end}}
</tr>
</tbody>
</table>
</div>
<div class="vsp-status">
<h1>Voting Wallets</h1>
<table class="vsp-status">
<thead>
<th>URL</th>
<th>Height</th>
<th>Connected<br />to dcrd</th>
<th>Unlocked</th>
<th>Voting</th>
<th>Vote<br />Version</th>
</thead>
<tbody>
{{ range $host, $status := .WalletStatus }}
<tr>
<td>{{ stripWss $host }}</td>
{{ if $status.Connected }}
{{ if $status.BestBlockError }}
<td>
<div class="center">
<div class="status bad center with-text">
Error
</div>
</div>
</td>
{{ else }}
<td>{{ $status.BestBlockHeight }}</td>
{{ end }}
{{ if $status.InfoError }}
<td colspan="4">
<div class="center">
<div class="status bad center with-text">
Error getting wallet info
</div>
</div>
</td>
{{ else }}
<td>
<div class="center">
<div class="status {{ if $status.DaemonConnected }}good{{else}}bad{{end}}"></div>
</div>
</td>
<td>
<div class="center">
<div class="status {{ if $status.Unlocked }}good{{else}}bad{{end}}"></div>
</div>
</td>
<td>
<div class="center">
<div class="status {{ if $status.Voting }}good{{else}}bad{{end}}"></div>
</div>
</td>
<td>{{ $status.VoteVersion }}</td>
{{ end }}
{{else}}
<td colspan="5">
<div class="center">
<div class="status bad center with-text">
Cannot connect to wallet
</div>
</div>
</td>
{{end}}
</tr>
{{end}}
</tbody>
</table>
</div>
</section>
<section>
<form class="mt-2 mb-4" action="/admin/ticket" method="post">
<input type="search" name="hash" size="64" minlength="64" maxlength="64" spellcheck="false" required placeholder="Ticket hash" autocomplete="off"
{{ with .SearchResult }}
value="{{ .Ticket.Hash }}"
{{ end }}>
<button class="btn btn-primary d-block my-2" type="submit">Search</button>
</form>
{{ with .SearchResult }}
{{ template "ticket-search-result" . }}
{{ end }}
</section>
<section>
<h1>{{ pluralize (len .MissedTickets) "Missed Ticket" }}</h1>
{{ with .MissedTickets }}
<table class="missed-tickets mx-auto">
<thead>
<th>Purchase Height</th>
<th>Ticket Hash</th>
</thead>
<tbody>
{{ range . }}
<tr>
<td>{{ .PurchaseHeight }}</td>
<td>
<form action="/admin/ticket" method="post">
<input type="hidden" name="hash" value="{{ .Hash }}">
<button class="btn btn-link p-0 code" type="submit">{{ .Hash }}</button>
</form>
</td>
</tr>
{{ end }}
</tbody>
</table>
{{ end}}
</section>
<section>
<p>Database size: {{ .WebApiCache.DatabaseSize }}</p>
<a class="btn btn-primary" href="/admin/backup" download>Download Backup</a>
</section>
<section>
<form action="/admin/logout" method="post">
<button type="submit" class="btn btn-primary">Logout</button>
</form>
</section>
</div>
</div>
</div>
</div>
</div>
</div>
{{ template "footer" . }}