fix: keep log panel persistent and scrollable after sync completes
All checks were successful
Deploy / deploy (push) Successful in 12s
All checks were successful
Deploy / deploy (push) Successful in 12s
- Remove auto-reload after job completion - Re-enable button and refresh stats in-place via /status fetch - Increase log panel max-height to 600px, add resize:vertical - Add IDs to stat cells for targeted DOM updates Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
29
webui.py
29
webui.py
@@ -340,7 +340,7 @@ h2{margin:0 0 16px;font-size:1.1rem}
|
|||||||
.row{display:flex;gap:12px;flex-wrap:wrap;align-items:center}
|
.row{display:flex;gap:12px;flex-wrap:wrap;align-items:center}
|
||||||
.alert{padding:12px 16px;border-radius:6px;margin-bottom:12px}
|
.alert{padding:12px 16px;border-radius:6px;margin-bottom:12px}
|
||||||
.alert-warn{background:#fff3cd;border:1px solid #ffc107;color:#664d03}
|
.alert-warn{background:#fff3cd;border:1px solid #ffc107;color:#664d03}
|
||||||
#output{background:#1a1a2e;color:#d0d0e0;border-radius:8px;padding:16px;font-family:monospace;font-size:.85rem;min-height:60px;max-height:420px;overflow-y:auto;margin-top:16px;display:none}
|
#output{background:#1a1a2e;color:#d0d0e0;border-radius:8px;padding:16px;font-family:monospace;font-size:.85rem;min-height:80px;max-height:600px;overflow-y:auto;margin-top:16px;display:none;resize:vertical}
|
||||||
#output .ln{padding:1px 0}
|
#output .ln{padding:1px 0}
|
||||||
#output .ln.ok{color:#6ee7b7}
|
#output .ln.ok{color:#6ee7b7}
|
||||||
#output .ln.err{color:#fca5a5}
|
#output .ln.err{color:#fca5a5}
|
||||||
@@ -361,6 +361,19 @@ tr:last-child td{border-bottom:none}
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
_SCRIPT = r"""
|
_SCRIPT = r"""
|
||||||
|
async function refreshStats() {
|
||||||
|
try {
|
||||||
|
const r = await fetch('/status');
|
||||||
|
if (!r.ok) return;
|
||||||
|
const s = await r.json();
|
||||||
|
const set = (id, val) => { const el = document.getElementById(id); if (el) el.innerHTML = val; };
|
||||||
|
set('stat-pull', s.last_pull ? s.last_pull : '—');
|
||||||
|
set('stat-push', s.last_push ? s.last_push : '—');
|
||||||
|
set('stat-pending', s.pending_count ?? '?');
|
||||||
|
set('stat-status', s.vault_status ?? '?');
|
||||||
|
} catch(e) {}
|
||||||
|
}
|
||||||
|
|
||||||
async function doSync(endpoint, label) {
|
async function doSync(endpoint, label) {
|
||||||
const btn = event.currentTarget;
|
const btn = event.currentTarget;
|
||||||
btn.disabled = true;
|
btn.disabled = true;
|
||||||
@@ -383,8 +396,10 @@ async function doSync(endpoint, label) {
|
|||||||
div.className = 'ln done';
|
div.className = 'ln done';
|
||||||
div.textContent = ev.message || 'Done.';
|
div.textContent = ev.message || 'Done.';
|
||||||
panel.appendChild(div);
|
panel.appendChild(div);
|
||||||
|
panel.scrollTop = panel.scrollHeight;
|
||||||
src.close();
|
src.close();
|
||||||
setTimeout(() => location.reload(), 1800);
|
btn.disabled = false;
|
||||||
|
refreshStats();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
@@ -476,11 +491,11 @@ async def dashboard():
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<h2>Vault Status</h2>
|
<h2>Vault Status</h2>
|
||||||
{warn}
|
{warn}
|
||||||
<div class="grid">
|
<div class="grid" id="stats-grid">
|
||||||
<div class="stat"><label>Status</label><span>{badge}</span></div>
|
<div class="stat"><label>Status</label><span id="stat-status">{badge}</span></div>
|
||||||
<div class="stat"><label>Pending local changes</label><strong>{pending}</strong></div>
|
<div class="stat"><label>Pending local changes</label><strong id="stat-pending">{pending}</strong></div>
|
||||||
<div class="stat"><label>Last pull</label>{pull_html}</div>
|
<div class="stat"><label>Last pull</label><span id="stat-pull">{pull_html}</span></div>
|
||||||
<div class="stat"><label>Last push</label>{push_html}</div>
|
<div class="stat"><label>Last push</label><span id="stat-push">{push_html}</span></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<button class="btn btn-primary" onclick="doSync('/pull','Pulling from Outline')">Get from Outline</button>
|
<button class="btn btn-primary" onclick="doSync('/pull','Pulling from Outline')">Get from Outline</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user