mirror of
https://github.com/basicswap/basicswap.git
synced 2025-01-09 20:30:28 +00:00
html: Template for watched outputs page.
This commit is contained in:
parent
b920f926c1
commit
8623d291f1
4 changed files with 45 additions and 18 deletions
|
@ -2413,6 +2413,7 @@ class BasicSwap():
|
||||||
rv = []
|
rv = []
|
||||||
rv_heights = []
|
rv_heights = []
|
||||||
for c, v in self.coin_clients.items():
|
for c, v in self.coin_clients.items():
|
||||||
|
if self.coin_clients[c]['connection_type'] == 'rpc':
|
||||||
rv_heights.append((c, v['last_height_checked']))
|
rv_heights.append((c, v['last_height_checked']))
|
||||||
for o in v['watched_outputs']:
|
for o in v['watched_outputs']:
|
||||||
rv.append((c, o[0], o[1], o[2], o[3]))
|
rv.append((c, o[0], o[1], o[2], o[3]))
|
||||||
|
|
|
@ -469,21 +469,20 @@ class HttpHandler(BaseHTTPRequestHandler):
|
||||||
def page_watched(self, url_split, post_string):
|
def page_watched(self, url_split, post_string):
|
||||||
swap_client = self.server.swap_client
|
swap_client = self.server.swap_client
|
||||||
watched_outputs, last_scanned = swap_client.listWatchedOutputs()
|
watched_outputs, last_scanned = swap_client.listWatchedOutputs()
|
||||||
|
ls_formatted = []
|
||||||
content = html_content_start(self.server.title, self.server.title) \
|
for ls in last_scanned:
|
||||||
+ '<h3>Watched Outputs</h3>'
|
ls_formatted.append((getCoinName(ls[0]), ls[1]))
|
||||||
|
wo_formatted = []
|
||||||
for c in last_scanned:
|
for wo in watched_outputs:
|
||||||
content += '<p>' + getCoinName(c[0]) + ' Scanned Height: ' + str(c[1]) + '</p>'
|
wo_formatted.append((wo[1].hex(), getCoinName(wo[0]), wo[2], wo[3], int(wo[4])))
|
||||||
|
template = env.get_template('watched.html')
|
||||||
content += '<table>'
|
return bytes(template.render(
|
||||||
content += '<tr><th>Bid ID</th><th>Chain</th><th>Txid</th><th>Index</th><th>Type</th></tr>'
|
title=self.server.title,
|
||||||
for o in watched_outputs:
|
refresh=30,
|
||||||
content += '<tr><td><a href=/bid/{0}>{0}</a></td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td></tr>'.format(o[1].hex(), getCoinName(o[0]), o[2], o[3], int(o[4]))
|
h2=self.server.title,
|
||||||
content += '</table>'
|
last_scanned=last_scanned,
|
||||||
|
watched_outputs=wo_formatted,
|
||||||
content += '<p><a href="/">home</a></p></body></html>'
|
), 'UTF-8')
|
||||||
return bytes(content, 'UTF-8')
|
|
||||||
|
|
||||||
def page_index(self, url_split):
|
def page_index(self, url_split):
|
||||||
swap_client = self.server.swap_client
|
swap_client = self.server.swap_client
|
||||||
|
@ -491,7 +490,7 @@ class HttpHandler(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
template = env.get_template('index.html')
|
template = env.get_template('index.html')
|
||||||
return bytes(template.render(
|
return bytes(template.render(
|
||||||
titil=self.server.title,
|
title=self.server.title,
|
||||||
refresh=30,
|
refresh=30,
|
||||||
h2=self.server.title,
|
h2=self.server.title,
|
||||||
summary=summary
|
summary=summary
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
<p><a href="/wallets">View Wallets</a></p>
|
<p><a href="/wallets">View Wallets</a></p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Page Refresh: 30 seconds<br/>
|
{% if refresh %}
|
||||||
|
Page Refresh: {{ refresh }} seconds<br/>
|
||||||
|
{% endif %}
|
||||||
<a href="/active">Swaps in progress: {{ summary.num_swapping }}</a><br/>
|
<a href="/active">Swaps in progress: {{ summary.num_swapping }}</a><br/>
|
||||||
<a href="/offers">Network Offers: {{ summary.num_network_offers }}</a><br/>
|
<a href="/offers">Network Offers: {{ summary.num_network_offers }}</a><br/>
|
||||||
<a href="/sentoffers">Sent Offers: {{ summary.num_sent_offers }}</a><br/>
|
<a href="/sentoffers">Sent Offers: {{ summary.num_sent_offers }}</a><br/>
|
||||||
|
|
25
templates/watched.html
Normal file
25
templates/watched.html
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{% include 'header.html' %}
|
||||||
|
|
||||||
|
<h3>Watched Outputs</h3>
|
||||||
|
{% if refresh %}
|
||||||
|
<p>Page Refresh: {{ refresh }} seconds</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<p>Last Scanned</p>
|
||||||
|
<table>
|
||||||
|
<tr><th>Coin</th><th>height</th></tr>
|
||||||
|
{% for ls in last_scanned %}
|
||||||
|
<tr><td>{{ ls[0] }}</td><td>{{ ls[1] }}</td></tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr><th>Bid ID</th><th>Chain</th><th>Txid</th><th>Index</th><th>Type</th></tr>
|
||||||
|
{% for wo in watched_outputs %}
|
||||||
|
<tr><td><a href=/bid/{{ wo[0] }}>{{ wo[0] }}</a></td><td>{{ wo[1] }}</td><td>{{ wo[2] }}</td><td>{{ wo[3] }}</td><td>{{ wo[4] }}</td></tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<p><a href="/">home</a></p>
|
||||||
|
</body></html>
|
Loading…
Reference in a new issue