Add clear filters button, display tx statuses on active page.
This commit is contained in:
parent
ef77a9e012
commit
1baf13c5a8
@ -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()
|
||||
|
@ -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:
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
@ -58,24 +58,26 @@ class Test(unittest.TestCase):
|
||||
assert(decoded == blocks_val)
|
||||
|
||||
def test_makeInt(self):
|
||||
def test_case(v):
|
||||
sv = format8(makeInt(v))
|
||||
def test_case(vs, vf, expect_int):
|
||||
assert(makeInt(vs) == expect_int)
|
||||
assert(makeInt(vf) == expect_int)
|
||||
vs_out = format8(makeInt(vs))
|
||||
# Strip
|
||||
for i in range(7):
|
||||
if sv[-1] == '0':
|
||||
sv = sv[:-1]
|
||||
assert(sv == v)
|
||||
test_case('0.00899999')
|
||||
test_case('899999.0')
|
||||
test_case('899999.00899999')
|
||||
test_case('1.0')
|
||||
test_case('1.1')
|
||||
test_case('1.2')
|
||||
test_case('0.00899991')
|
||||
test_case('0.0089999')
|
||||
test_case('0.0089991')
|
||||
test_case('0.123')
|
||||
test_case('123000.000123')
|
||||
if vs_out[-1] == '0':
|
||||
vs_out = vs_out[:-1]
|
||||
assert(vs_out == vs)
|
||||
test_case('0.00899999', 0.00899999, 899999)
|
||||
test_case('899999.0', 899999.0, 89999900000000)
|
||||
test_case('899999.00899999', 899999.00899999, 89999900899999)
|
||||
test_case('1.0', 1.0, 100000000)
|
||||
test_case('1.1', 1.1, 110000000)
|
||||
test_case('1.2', 1.2, 120000000)
|
||||
test_case('0.00899991', 0.00899991, 899991)
|
||||
test_case('0.0089999', 0.0089999, 899990)
|
||||
test_case('0.0089991', 0.0089991, 899910)
|
||||
test_case('0.123', 0.123, 12300000)
|
||||
test_case('123000.000123', 123000.000123, 12300000012300)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user