Update app.py
Browse files
app.py
CHANGED
|
@@ -769,9 +769,14 @@ a {
|
|
| 769 |
|
| 770 |
/* ══════════════ SEARCH LOADER ══════════════ */
|
| 771 |
.search-loader {
|
| 772 |
-
display: flex; flex-direction: column; align-items: center;
|
| 773 |
-
padding:
|
| 774 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 775 |
}
|
| 776 |
.loader-spinner {
|
| 777 |
width: 42px; height: 42px;
|
|
@@ -781,31 +786,30 @@ a {
|
|
| 781 |
box-shadow: 0 0 20px -2px rgba(99,102,241,.35);
|
| 782 |
}
|
| 783 |
.loader-label {
|
| 784 |
-
font-size:
|
| 785 |
-
|
|
|
|
| 786 |
}
|
| 787 |
.loader-query-box {
|
| 788 |
display: inline-block;
|
| 789 |
-
margin-top:
|
| 790 |
-
padding:
|
| 791 |
-
border-radius:
|
| 792 |
-
border: 1px solid rgba(99,102,241,.
|
| 793 |
-
background: rgba(99,102,241,.
|
| 794 |
-
font-size:
|
| 795 |
-
color: #
|
| 796 |
letter-spacing: .01em;
|
|
|
|
| 797 |
}
|
| 798 |
.loader-sub {
|
| 799 |
-
font-size: 13px; color: #
|
| 800 |
text-align: center; line-height: 1.5;
|
| 801 |
}
|
| 802 |
.loader-elapsed {
|
| 803 |
-
font-size:
|
| 804 |
-
font-variant-numeric: tabular-nums; letter-spacing: .
|
| 805 |
-
|
| 806 |
-
@keyframes loaderPulse {
|
| 807 |
-
0%, 100% { opacity: .55; }
|
| 808 |
-
50% { opacity: 1; }
|
| 809 |
}
|
| 810 |
.retry-btn {
|
| 811 |
margin-top: 10px; padding: 6px 16px;
|
|
@@ -821,32 +825,32 @@ a {
|
|
| 821 |
/* ══════════════ PROMINENT SEARCH LOADER ══════════════ */
|
| 822 |
.loader-ring-wrap {
|
| 823 |
position: relative;
|
| 824 |
-
width:
|
| 825 |
display: flex; align-items: center; justify-content: center;
|
| 826 |
}
|
| 827 |
.loader-ring {
|
| 828 |
position: absolute;
|
| 829 |
-
width:
|
| 830 |
-
border: 3px solid rgba(99,102,241,.
|
| 831 |
-
border-top-color: #
|
| 832 |
-
border-right-color: #
|
| 833 |
border-radius: 50%;
|
| 834 |
animation: spin .8s linear infinite;
|
| 835 |
-
box-shadow: 0 0
|
| 836 |
}
|
| 837 |
.loader-ring-inner {
|
| 838 |
position: absolute;
|
| 839 |
-
width:
|
| 840 |
-
border: 2px solid rgba(99,102,241,.
|
| 841 |
-
border-bottom-color: #
|
| 842 |
-
border-left-color: #
|
| 843 |
border-radius: 50%;
|
| 844 |
animation: spin 1.2s linear infinite reverse;
|
| 845 |
}
|
| 846 |
.loader-hint {
|
| 847 |
-
font-size:
|
| 848 |
-
|
| 849 |
-
|
| 850 |
}
|
| 851 |
|
| 852 |
/* ══════════════ RESULTS ══════════════ */
|
|
@@ -1443,41 +1447,64 @@ _HEAD_JS = """
|
|
| 1443 |
}
|
| 1444 |
|
| 1445 |
/* ── auto-retry: watch status bar for "ready" then re-trigger search ── */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1446 |
function _setupAutoRetry() {
|
| 1447 |
var statusBar = document.getElementById('status-bar');
|
| 1448 |
if (!statusBar) return;
|
| 1449 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1450 |
var observer = new MutationObserver(function() {
|
| 1451 |
if (_autoTriggered) { observer.disconnect(); return; }
|
| 1452 |
-
|
| 1453 |
-
|
| 1454 |
-
|
| 1455 |
-
var customInput = document.getElementById('search-input');
|
| 1456 |
-
var q = customInput ? (customInput.value || '').trim() : null;
|
| 1457 |
-
if (!q || q.length < 3) { observer.disconnect(); return; }
|
| 1458 |
-
|
| 1459 |
-
/* Don't re-trigger if results are already shown */
|
| 1460 |
-
var res = document.getElementById('res');
|
| 1461 |
-
if (res && res.querySelector('.card')) { observer.disconnect(); return; }
|
| 1462 |
-
if (res && res.textContent.indexOf('\\u041d\\u0456\\u0447\\u043e\\u0433\\u043e') >= 0) {
|
| 1463 |
-
observer.disconnect(); return;
|
| 1464 |
-
}
|
| 1465 |
-
|
| 1466 |
-
_autoTriggered = true;
|
| 1467 |
-
observer.disconnect();
|
| 1468 |
-
|
| 1469 |
-
var fields = [];
|
| 1470 |
-
document.querySelectorAll('.fpill.active').forEach(function(p) {
|
| 1471 |
-
fields.push(p.dataset.field);
|
| 1472 |
-
});
|
| 1473 |
-
if (!fields.length) fields = ['DEBTOR_NAME', 'CREDITOR_NAME'];
|
| 1474 |
-
_syncFieldsToGradio(fields.join(','));
|
| 1475 |
-
_updateUrl(q, fields);
|
| 1476 |
-
|
| 1477 |
-
enterLoading(q);
|
| 1478 |
-
_triggerGradioSearch();
|
| 1479 |
});
|
| 1480 |
|
|
|
|
| 1481 |
observer.observe(statusBar, { childList: true, subtree: true, characterData: true });
|
| 1482 |
setTimeout(function() { observer.disconnect(); }, 300000);
|
| 1483 |
}
|
|
|
|
| 769 |
|
| 770 |
/* ══════════════ SEARCH LOADER ══════════════ */
|
| 771 |
.search-loader {
|
| 772 |
+
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
| 773 |
+
padding: 80px 20px 72px; gap: 16px;
|
| 774 |
+
min-height: 320px;
|
| 775 |
+
animation: loaderFadeIn .3s ease;
|
| 776 |
+
}
|
| 777 |
+
@keyframes loaderFadeIn {
|
| 778 |
+
from { opacity: 0; transform: translateY(8px); }
|
| 779 |
+
to { opacity: 1; transform: translateY(0); }
|
| 780 |
}
|
| 781 |
.loader-spinner {
|
| 782 |
width: 42px; height: 42px;
|
|
|
|
| 786 |
box-shadow: 0 0 20px -2px rgba(99,102,241,.35);
|
| 787 |
}
|
| 788 |
.loader-label {
|
| 789 |
+
font-size: 16px; font-weight: 600; color: #a5b4fc;
|
| 790 |
+
text-align: center;
|
| 791 |
+
letter-spacing: .02em;
|
| 792 |
}
|
| 793 |
.loader-query-box {
|
| 794 |
display: inline-block;
|
| 795 |
+
margin-top: 4px;
|
| 796 |
+
padding: 8px 20px;
|
| 797 |
+
border-radius: 10px;
|
| 798 |
+
border: 1px solid rgba(99,102,241,.2);
|
| 799 |
+
background: rgba(99,102,241,.06);
|
| 800 |
+
font-size: 15px;
|
| 801 |
+
color: #e0e7ff;
|
| 802 |
letter-spacing: .01em;
|
| 803 |
+
text-align: center;
|
| 804 |
}
|
| 805 |
.loader-sub {
|
| 806 |
+
font-size: 13px; color: #71717a; max-width: 320px;
|
| 807 |
text-align: center; line-height: 1.5;
|
| 808 |
}
|
| 809 |
.loader-elapsed {
|
| 810 |
+
font-size: 13px; color: #818cf8; margin-top: 2px;
|
| 811 |
+
font-variant-numeric: tabular-nums; letter-spacing: .04em;
|
| 812 |
+
font-weight: 500;
|
|
|
|
|
|
|
|
|
|
| 813 |
}
|
| 814 |
.retry-btn {
|
| 815 |
margin-top: 10px; padding: 6px 16px;
|
|
|
|
| 825 |
/* ══════════════ PROMINENT SEARCH LOADER ══════════════ */
|
| 826 |
.loader-ring-wrap {
|
| 827 |
position: relative;
|
| 828 |
+
width: 88px; height: 88px;
|
| 829 |
display: flex; align-items: center; justify-content: center;
|
| 830 |
}
|
| 831 |
.loader-ring {
|
| 832 |
position: absolute;
|
| 833 |
+
width: 88px; height: 88px;
|
| 834 |
+
border: 3px solid rgba(99,102,241,.15);
|
| 835 |
+
border-top-color: #818cf8;
|
| 836 |
+
border-right-color: #6366f1;
|
| 837 |
border-radius: 50%;
|
| 838 |
animation: spin .8s linear infinite;
|
| 839 |
+
box-shadow: 0 0 40px -2px rgba(99,102,241,.5), inset 0 0 24px -2px rgba(99,102,241,.2);
|
| 840 |
}
|
| 841 |
.loader-ring-inner {
|
| 842 |
position: absolute;
|
| 843 |
+
width: 60px; height: 60px;
|
| 844 |
+
border: 2px solid rgba(99,102,241,.1);
|
| 845 |
+
border-bottom-color: #a5b4fc;
|
| 846 |
+
border-left-color: #818cf8;
|
| 847 |
border-radius: 50%;
|
| 848 |
animation: spin 1.2s linear infinite reverse;
|
| 849 |
}
|
| 850 |
.loader-hint {
|
| 851 |
+
font-size: 13px; color: #6366f1;
|
| 852 |
+
letter-spacing: .04em;
|
| 853 |
+
text-align: center;
|
| 854 |
}
|
| 855 |
|
| 856 |
/* ══════════════ RESULTS ══════════════ */
|
|
|
|
| 1447 |
}
|
| 1448 |
|
| 1449 |
/* ── auto-retry: watch status bar for "ready" then re-trigger search ── */
|
| 1450 |
+
function _tryAutoSearch() {
|
| 1451 |
+
if (_autoTriggered) return;
|
| 1452 |
+
|
| 1453 |
+
var customInput = document.getElementById('search-input');
|
| 1454 |
+
var q = customInput ? (customInput.value || '').trim() : null;
|
| 1455 |
+
if (!q || q.length < 3) return;
|
| 1456 |
+
|
| 1457 |
+
/* Don't re-trigger if results are already shown */
|
| 1458 |
+
var res = document.getElementById('res');
|
| 1459 |
+
if (res && res.querySelector('.card')) return;
|
| 1460 |
+
if (res && res.textContent.indexOf('\\u041d\\u0456\\u0447\\u043e\\u0433\\u043e') >= 0) return;
|
| 1461 |
+
|
| 1462 |
+
_autoTriggered = true;
|
| 1463 |
+
var observer = document.getElementById('status-bar');
|
| 1464 |
+
if (observer && observer._retryObserver) { observer._retryObserver.disconnect(); }
|
| 1465 |
+
|
| 1466 |
+
var fields = [];
|
| 1467 |
+
document.querySelectorAll('.fpill.active').forEach(function(p) {
|
| 1468 |
+
fields.push(p.dataset.field);
|
| 1469 |
+
});
|
| 1470 |
+
if (!fields.length) fields = ['DEBTOR_NAME', 'CREDITOR_NAME'];
|
| 1471 |
+
_syncFieldsToGradio(fields.join(','));
|
| 1472 |
+
_updateUrl(q, fields);
|
| 1473 |
+
|
| 1474 |
+
enterLoading(q);
|
| 1475 |
+
_triggerGradioSearch();
|
| 1476 |
+
}
|
| 1477 |
+
|
| 1478 |
+
function _isStatusReady() {
|
| 1479 |
+
var statusBar = document.getElementById('status-bar');
|
| 1480 |
+
if (!statusBar) return false;
|
| 1481 |
+
var text = statusBar.textContent || '';
|
| 1482 |
+
return text.indexOf('\\u0437\\u0430\\u043f\\u0438\\u0441\\u0456\\u0432') >= 0;
|
| 1483 |
+
}
|
| 1484 |
+
|
| 1485 |
function _setupAutoRetry() {
|
| 1486 |
var statusBar = document.getElementById('status-bar');
|
| 1487 |
if (!statusBar) return;
|
| 1488 |
|
| 1489 |
+
/*
|
| 1490 |
+
* CRITICAL: check current status IMMEDIATELY.
|
| 1491 |
+
* If DB is already ready when we set up the observer (e.g. server was
|
| 1492 |
+
* warm or demo.load already returned "ready"), no future mutation will
|
| 1493 |
+
* occur and the observer would never fire. By checking now we catch
|
| 1494 |
+
* the "already ready" case.
|
| 1495 |
+
*/
|
| 1496 |
+
if (_isStatusReady()) {
|
| 1497 |
+
setTimeout(_tryAutoSearch, 100);
|
| 1498 |
+
}
|
| 1499 |
+
|
| 1500 |
var observer = new MutationObserver(function() {
|
| 1501 |
if (_autoTriggered) { observer.disconnect(); return; }
|
| 1502 |
+
if (!_isStatusReady()) return;
|
| 1503 |
+
/* Small delay to let Gradio finish rendering the status update */
|
| 1504 |
+
setTimeout(_tryAutoSearch, 200);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1505 |
});
|
| 1506 |
|
| 1507 |
+
statusBar._retryObserver = observer;
|
| 1508 |
observer.observe(statusBar, { childList: true, subtree: true, characterData: true });
|
| 1509 |
setTimeout(function() { observer.disconnect(); }, 300000);
|
| 1510 |
}
|