vspd/webapi/templates/admin.html
jholdstock 4ea25ec327 Extract search results to own template.
Reducing the size and nesting of admin.html.
2021-11-14 11:00:39 +00:00

168 lines
7.6 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
>
<ul>
<li><label for="tabset_1_1">Wallet Status</label></li>
<li><label for="tabset_1_2">Ticket Search</label></li>
<li><label for="tabset_1_3">Database</label></li>
<li><label for="tabset_1_4">Logout</label></li>
</ul>
<div>
<section>
<table id="status-table" class="w-100 mb-0">
<thead>
<th>URL</th>
<th>Height</th>
<th>Connected</th>
<th>Unlocked</th>
<th>Voting</th>
<th>Vote 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>
</section>
<section>
<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"
{{ 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>
<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" . }}