Add clear filters button, display tx statuses on active page.

This commit is contained in:
tecnovert
2019-07-31 10:41:35 +02:00
parent ef77a9e012
commit 1baf13c5a8
5 changed files with 31 additions and 23 deletions

View File

@@ -2126,7 +2126,6 @@ class BasicSwap():
self.swaps_in_progress[bid_id] = (bid, offer)
def processMsg(self, msg):
self.log.debug('processMsg %s', msg['hex'])
self.mxDB.acquire()
try:
msg_type = int(msg['hex'][:2], 16)
@@ -2294,6 +2293,13 @@ class BasicSwap():
q = q.filter(Offer.coin_to == int(filter_coin_to))
q = q.order_by(Offer.created_at.desc())
limit = filters.get('limit', None)
if limit is not None:
q = q.limit(limit)
offset = filters.get('offset', None)
if offset is not None:
q = q.offset(offset)
for row in q:
rv.append(row)
return rv
@@ -2334,7 +2340,7 @@ class BasicSwap():
try:
rv = []
for k, v in self.swaps_in_progress.items():
rv.append((k, v[0].offer_id.hex(), v[0].state))
rv.append((k, v[0].offer_id.hex(), v[0].state, v[0].getITxState(), v[0].getPTxState()))
return rv
finally:
self.mxDB.release()

View File

@@ -182,7 +182,7 @@ class HttpHandler(BaseHTTPRequestHandler):
title=self.server.title,
refresh=30,
h2=self.server.title,
active_swaps=[(s[0].hex(), s[1], strBidState(s[2])) for s in active_swaps],
active_swaps=[(s[0].hex(), s[1], strBidState(s[2]), strTxState(s[3]), strTxState(s[4])) for s in active_swaps],
), 'UTF-8')
def page_wallets(self, url_split, post_string):
@@ -357,7 +357,7 @@ class HttpHandler(BaseHTTPRequestHandler):
}
messages = []
form_data = self.checkForm(post_string, 'offers', messages)
if form_data:
if form_data and b'applyfilters' in form_data:
coin_from = int(form_data[b'coin_from'][0])
if coin_from > -1:
try:

View File

@@ -6,9 +6,9 @@
{% endif %}
<table>
<tr><th>Bid ID</th><th>Offer ID</th><th>Bid Status</th></tr>
<tr><th>Bid ID</th><th>Offer ID</th><th>Bid Status</th><th>ITX Status</th><th>PTX Status</th></tr>
{% for s in active_swaps %}
<tr><td><a href=/bid/{{ s[0] }}>{{ s[0] }}</a></td><td><a href=/offer/{{ s[1] }}>{{ s[1] }}</a></td><td>{{ s[2] }}</td></tr>
<tr><td><a href=/bid/{{ s[0] }}>{{ s[0] }}</a></td><td><a href=/offer/{{ s[1] }}>{{ s[1] }}</a></td><td>{{ s[2] }}</td><td>{{ s[3] }}</td><td>{{ s[4] }}</td></tr>
{% endfor %}
</table>

View File

@@ -25,7 +25,7 @@
</select>
</td></tr>
<tr><td><input type="submit" value="Apply Filters"></td></tr>
<tr><td><input type="submit" name='applyfilters' value="Apply Filters"></td><td><input type="submit" name='clearfilters' value="Clear Filters"></td></tr>
</table>
<input type="hidden" name="formid" value="{{ form_id }}">
</form>