Fix Order Entry connect + back arrows
Browse files- frontend.py: /book was calling /book on matcher (404); fixed to
/orderbook/<symbol> with ?symbol= query param
- Order Entry: pass selected symbol to /book, reload on symbol change
- Order Entry: add ← Dashboard link via onclick (not href)
- FIX UI: ← Dashboard href="/" was rewritten by nginx sub_filter to
/fix/; fixed by switching to onclick so sub_filter can't touch it
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix-ui-client/templates/index.html
CHANGED
|
@@ -132,7 +132,7 @@
|
|
| 132 |
<span class="dot"></span>
|
| 133 |
<span id="status-text">Connecting...</span>
|
| 134 |
</span>
|
| 135 |
-
<a
|
| 136 |
</h1>
|
| 137 |
|
| 138 |
<div class="container">
|
|
|
|
| 132 |
<span class="dot"></span>
|
| 133 |
<span id="status-text">Connecting...</span>
|
| 134 |
</span>
|
| 135 |
+
<a onclick="window.location.href='/'" style="margin-left:auto; padding:4px 14px; background:#6c757d; color:#fff; border-radius:20px; font-size:12px; font-weight:bold; text-decoration:none; cursor:pointer;">← Dashboard</a>
|
| 136 |
</h1>
|
| 137 |
|
| 138 |
<div class="container">
|
frontend/frontend.py
CHANGED
|
@@ -77,7 +77,10 @@ def securities():
|
|
| 77 |
@app.route('/book')
|
| 78 |
def book():
|
| 79 |
import requests
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
| 81 |
return (r.text, r.status_code, {'Content-Type': 'application/json'})
|
| 82 |
|
| 83 |
@app.route('/trades')
|
|
|
|
| 77 |
@app.route('/book')
|
| 78 |
def book():
|
| 79 |
import requests
|
| 80 |
+
symbol = request.args.get('symbol', '')
|
| 81 |
+
if not symbol:
|
| 82 |
+
return jsonify({"bids": [], "asks": []})
|
| 83 |
+
r = requests.get(f"{Config.MATCHER_URL}/orderbook/{symbol}", timeout=3)
|
| 84 |
return (r.text, r.status_code, {'Content-Type': 'application/json'})
|
| 85 |
|
| 86 |
@app.route('/trades')
|
frontend/templates/index.html
CHANGED
|
@@ -124,6 +124,7 @@
|
|
| 124 |
<span id="status-text">Connecting...</span>
|
| 125 |
</span>
|
| 126 |
<button id="reconnect-btn" class="btn-reconnect" onclick="reconnect()">Reconnect</button>
|
|
|
|
| 127 |
</h1>
|
| 128 |
|
| 129 |
<!-- Order Entry -->
|
|
@@ -137,7 +138,7 @@
|
|
| 137 |
</div>
|
| 138 |
<div class="form-group">
|
| 139 |
<label>Symbol</label>
|
| 140 |
-
<select id="symbol-select" name="symbol">
|
| 141 |
<option value="">Loading...</option>
|
| 142 |
</select>
|
| 143 |
</div>
|
|
@@ -326,8 +327,9 @@
|
|
| 326 |
|
| 327 |
async function loadBook() {
|
| 328 |
const now = new Date().toLocaleTimeString();
|
|
|
|
| 329 |
try {
|
| 330 |
-
const r = await fetch(BASE + '/book');
|
| 331 |
const b = await r.json();
|
| 332 |
renderBook(b);
|
| 333 |
document.getElementById('book-updated').textContent = 'Updated: ' + now;
|
|
|
|
| 124 |
<span id="status-text">Connecting...</span>
|
| 125 |
</span>
|
| 126 |
<button id="reconnect-btn" class="btn-reconnect" onclick="reconnect()">Reconnect</button>
|
| 127 |
+
<a onclick="window.location.href='/'" style="margin-left:auto; padding:4px 14px; background:#6c757d; color:#fff; border-radius:20px; font-size:12px; font-weight:bold; text-decoration:none; cursor:pointer;">← Dashboard</a>
|
| 128 |
</h1>
|
| 129 |
|
| 130 |
<!-- Order Entry -->
|
|
|
|
| 138 |
</div>
|
| 139 |
<div class="form-group">
|
| 140 |
<label>Symbol</label>
|
| 141 |
+
<select id="symbol-select" name="symbol" onchange="loadBook()">
|
| 142 |
<option value="">Loading...</option>
|
| 143 |
</select>
|
| 144 |
</div>
|
|
|
|
| 327 |
|
| 328 |
async function loadBook() {
|
| 329 |
const now = new Date().toLocaleTimeString();
|
| 330 |
+
const symbol = document.getElementById('symbol-select')?.value || '';
|
| 331 |
try {
|
| 332 |
+
const r = await fetch(BASE + '/book?symbol=' + encodeURIComponent(symbol));
|
| 333 |
const b = await r.json();
|
| 334 |
renderBook(b);
|
| 335 |
document.getElementById('book-updated').textContent = 'Updated: ' + now;
|