vspd/webapi/templates/admin.html

216 lines
9.1 KiB
HTML

{{ template "header" . }}
<div class="vsp-overview pt-4 pb-3 mb-3">
<div class="container">
<div class="d-flex flex-wrap">
<h1 class="mr-auto text-nowrap">Admin Panel</h1>
<div class="row">
<a class="m-2 btn btn-primary btn-small" href="/admin/backup" download>Backup</a>
<form class="p-2" action="/admin/logout" method="post">
<button type="submit" class="btn btn-primary btn-small">Logout</button>
</form>
</div>
</div>
{{ template "vsp-stats" .VspStats }}
</div>
</div>
<div class="container">
<div class="row">
<div class="col-12 p-3">
<div class="block__content">
<h1>Voting Wallet Status</h1>
<table class="table status-table mb-0" width="100%">
<tr>
<th>URL</th>
<th>Best Block Height</th>
<th>Daemon Connected</th>
<th>Unlocked</th>
<th>Voting</th>
<th>Vote Version</th>
</tr>
{{ range $host, $status := .WalletStatus }}
<tr>
<td>{{ $host }}</td>
{{ if $status.Connected }}
{{ if $status.BestBlockError }}
<td class="status-bad">Error</td>
{{ else }}
<td>{{ $status.BestBlockHeight }}</td>
{{ end }}
{{ if $status.InfoError }}
<td class="status-bad" colspan="4">Error getting wallet info</td>
{{ else }}
<td class="{{ if $status.DaemonConnected }}status-good{{else}}status-bad{{end}}"
>{{ $status.DaemonConnected }}</td>
<td class="{{ if $status.Unlocked }}status-good{{else}}status-bad{{end}}"
>{{ $status.Unlocked }}</td>
<td class="{{ if $status.Voting }}status-good{{else}}status-bad{{end}}"
>{{ $status.Voting }}</td>
<td>{{ $status.VoteVersion }}</td>
{{ end }}
{{else}}
<td class="status-bad" colspan="5">Cannot connect to wallet</td>
{{end}}
</tr>
{{end}}
</table>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-12 p-3">
<div class="block__content">
<h1>Ticket Search</h1>
<form class="mt-2 mb-4" action="/admin/ticket" method="post">
<input type="text" name="hash" size="64" minlength="64" maxlength="64" required placeholder="Ticket hash" autocomplete="off">
<button class="ml-3 btn btn-primary" type="submit">Search</button>
</form>
{{ with .SearchResult }}
{{ if .Found }}
<h1>Search Result</h1>
<table class="table ticket-table mt-2 mb-4">
<tr>
<th>Hash</th>
<td>
<a href="{{ txURL .Ticket.Hash }}">
{{ .Ticket.Hash }}
</a>
</td>
</tr>
<tr>
<th>Commitment Address</th>
<td>{{ .Ticket.CommitmentAddress }}</td>
</tr>
<tr>
<th>Fee Address Index</th>
<td>{{ .Ticket.FeeAddressIndex }}</td>
</tr>
<tr>
<th>Fee Address</th>
<td>
<a href="{{ addressURL .Ticket.FeeAddress }}">
{{ .Ticket.FeeAddress }}
</a>
</td>
</tr>
<tr>
<th>Fee Amount</th>
<td>{{ .Ticket.FeeAmount }} atoms</td>
</tr>
<tr>
<th>Fee Expiration</th>
<td>{{ .Ticket.FeeExpiration }}</td>
</tr>
<tr>
<th>Confirmed</th>
<td>{{ .Ticket.Confirmed }}</td>
</tr>
<tr>
<th>Current Vote Choices</th>
<td>
{{ range $key, $value := .Ticket.VoteChoices }}
{{ $key }}: {{ $value }} <br />
{{ end }}
</td>
</tr>
<tr>
<th>
Vote Choice Changes<br />
<em>({{ .MaxVoteChanges }} most recent)</em>
</th>
<td>
{{ range $key, $value := .VoteChanges }}
<details>
<summary>
{{ if eq $key 0}}
Initial choices
{{ else }}
Change {{ $key }}
{{ end }}
</summary>
<table class="table ticket-table my-2">
<tr>
<th>Request</th>
<td>{{ $value.Request }}</td>
</tr>
<tr>
<th>Request<br />Signature</th>
<td>{{ $value.RequestSignature }}</td>
</tr>
<tr>
<th>Response</th>
<td>{{ $value.Response }}</td>
</tr>
<tr>
<th>Response<br />Signature</th>
<td>{{ $value.ResponseSignature }}</td>
</tr>
</table>
</details>
{{end}}
</td>
</tr>
<tr>
<th>Voting WIF</th>
<td>{{ .Ticket.VotingWIF }}</td>
</tr>
<tr>
<th>Fee Tx Hash</th>
<td>
<a href="{{ txURL .Ticket.FeeTxHash }}">
{{ .Ticket.FeeTxHash }}
</a>
</td>
</tr>
<tr>
<th>Fee Tx</th>
<td>{{ .Ticket.FeeTxHex }}</td>
</tr>
<tr>
<th>Fee Tx Status</th>
<td>{{ .Ticket.FeeTxStatus }}</td>
</tr>
<tr>
<th>Ticket Outcome</th>
<td>{{ .Ticket.Outcome }}</td>
</tr>
</table>
{{ else }}
<p>No ticket found with hash <span class="code">{{ .Hash }}</span></p>
{{ end }}
{{ end }}
</div>
</div>
</div>
</div>
{{ template "footer" . }}