Commit 3e09135e authored by Vitaly Lipatov's avatar Vitaly Lipatov

route-web-api: show SLOW badge on dgw when throttling detected

Override dgw gateway status from OK to SLOW in the badge when TSPU throttling is detected. Tooltip shows asset name, size and time. Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 29506e04
...@@ -601,6 +601,7 @@ HTML_PAGE = """\ ...@@ -601,6 +601,7 @@ HTML_PAGE = """\
.check-gw { padding: 4px 10px; border-radius: 4px; font-family: monospace; .check-gw { padding: 4px 10px; border-radius: 4px; font-family: monospace;
font-size: 0.85em; } font-size: 0.85em; }
.check-gw.ok { background: #d4edda; color: #155724; } .check-gw.ok { background: #d4edda; color: #155724; }
.check-gw.slow { background: #f8d7da; color: #721c24; }
.check-gw.block { background: #f8d7da; color: #721c24; } .check-gw.block { background: #f8d7da; color: #721c24; }
.check-gw.proxy { background: #d1d5db; color: #6b7280; } .check-gw.proxy { background: #d1d5db; color: #6b7280; }
.check-gw.other { background: #fff3cd; color: #856404; } .check-gw.other { background: #fff3cd; color: #856404; }
...@@ -906,6 +907,7 @@ function renderCheck(data) { ...@@ -906,6 +907,7 @@ function renderCheck(data) {
container.appendChild(rsec); container.appendChild(rsec);
// Gateways (IPv4 + IPv6) // Gateways (IPv4 + IPv6)
const throttled = data.throttle && data.throttle.throttled;
const gsec = mkDiv('check-section'); const gsec = mkDiv('check-section');
gsec.appendChild(mkDiv('check-section-title', '\\u0414\\u043e\\u0441\\u0442\\u0443\\u043f\\u043d\\u043e\\u0441\\u0442\\u044c \\u0447\\u0435\\u0440\\u0435\\u0437 \\u0448\\u043b\\u044e\\u0437\\u044b')); gsec.appendChild(mkDiv('check-section-title', '\\u0414\\u043e\\u0441\\u0442\\u0443\\u043f\\u043d\\u043e\\u0441\\u0442\\u044c \\u0447\\u0435\\u0440\\u0435\\u0437 \\u0448\\u043b\\u044e\\u0437\\u044b'));
const gwrap = document.createElement('div'); const gwrap = document.createElement('div');
...@@ -913,10 +915,14 @@ function renderCheck(data) { ...@@ -913,10 +915,14 @@ function renderCheck(data) {
for (const name of order) { for (const name of order) {
const info = data.checks[name]; const info = data.checks[name];
if (!info) continue; if (!info) continue;
const cls4 = info.status === 'OK' ? 'ok' : info.status === 'BLOCK' ? 'block' : info.status === 'PROXY?' ? 'proxy' : 'other'; let st4 = info.status;
// Override dgw status to SLOW when throttling detected
if (name === 'dgw' && throttled && st4 === 'OK') st4 = 'SLOW';
const cls4 = st4 === 'OK' ? 'ok' : st4 === 'SLOW' ? 'slow' : st4 === 'BLOCK' ? 'block' : st4 === 'PROXY?' ? 'proxy' : 'other';
const el4 = document.createElement('span'); const el4 = document.createElement('span');
el4.className = 'check-gw ' + cls4; el4.className = 'check-gw ' + cls4;
el4.textContent = name + ': ' + info.status; el4.textContent = name + ': ' + st4;
if (name === 'dgw' && throttled) el4.title = data.throttle.asset + ': ' + data.throttle.size + ' \\u0431\\u0430\\u0439\\u0442 \\u0437\\u0430 ' + data.throttle.time + '\\u0441';
gwrap.appendChild(el4); gwrap.appendChild(el4);
if (info.status_v6 && info.status_v6 !== 'PROXY?') { if (info.status_v6 && info.status_v6 !== 'PROXY?') {
const cls6 = info.status_v6 === 'OK' ? 'ok' : info.status_v6 === 'BLOCK' ? 'block' : 'other'; const cls6 = info.status_v6 === 'OK' ? 'ok' : info.status_v6 === 'BLOCK' ? 'block' : 'other';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment