UI: Formular nach Agent-Übernahme neu aufbauen (zeigte alte Werte); Cache-Busting für JS/CSS

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
RubenRWU
2026-10-15 16:51:16 +02:00
parent 40b3f687f7
commit c0d3ec5dab
4 changed files with 21 additions and 6 deletions

View File

@@ -67,12 +67,16 @@ function layout(){
document.querySelectorAll('#h-panel button').forEach(b => b.classList.toggle('on', b.dataset.p === ui.mode));
if(ui.open) refreshPreview();
}
$('#h-panel').addEventListener('click', e => { const b = e.target.closest('button'); if(!b) return; ui.mode = b.dataset.p; renderNav(); layout(); if(ui.mode === 'agent') $('#chat-text').focus(); });
function renderSection(){
renderNav(); layout();
$('#h-panel').addEventListener('click', e => {
const b = e.target.closest('button'); if(!b) return; ui.mode = b.dataset.p;
if(ui.mode === 'edit') renderSection(); // Formular NEU aufbauen: der Agent kann den Entwurf inzwischen geändert haben (sonst alte Werte sichtbar)
else { renderNav(); layout(); $('#chat-text').focus(); }
});
function renderSectionContent(){
({overview: sOverview, brand: sBrand, texts: sTexts, pdf: sPdf, prompt: sPrompt, files: sFiles, func: sFunc, code: sCode, adv: sAdv,
domain: sDomain, secrets: sSecrets, deploy: sDeploy, versions: sVersions})[ui.sec]();
}
function renderSection(){ renderNav(); layout(); renderSectionContent(); }
/* ───────── Speichern (Entwurf) ───────── */
const saveState = txt => { const e = $('#save-ind'); if(e) e.textContent = txt; };
@@ -448,7 +452,7 @@ function showPdfIfRelevant(paths){
async function decide(id, d){
const m = await api('POST', A(`/chat/${id}/${d}`)); $('#m'+id).replaceWith(msgEl(m));
ui.agentSrc = null; setPvSrc('draft');
if(d==='apply'){ await load(true); renderNav(); headLogo(); if(ui.sec==='overview') sOverview(); toast('Im Entwurf – Vorschau zeigt jetzt den Entwurf'); }
if(d==='apply'){ await load(true); renderNav(); headLogo(); try{ renderSectionContent(); }catch(e){} toast('Im Entwurf – Vorschau zeigt jetzt den Entwurf'); }
refreshPreview(true);
}
async function showProposalDiff(id){ const d = await api('GET', A(`/chat/${id}/diff`)); $('#diff-title').textContent = 'Vorschlag des Agenten'; $('#diff-body').innerHTML = d.items.length ? d.items.map(diffHtml).join('') : '<div class="empty">Keine Unterschiede zum Entwurf.</div>'; modal('m-diff', true); }

View File

@@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>{% block title %}Onyscribe Admin{% endblock %}</title>
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='14' fill='%231a1a1a'/%3E%3Cpath d='M20 22l14 10-14 10' fill='none' stroke='%2300cccc' stroke-width='7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E">
<link rel="stylesheet" href="/static/admin.css">
<link rel="stylesheet" href="/static/admin.css?v={{ static_v('admin.css') }}">
</head>
<body>
<aside class="side">

View File

@@ -47,5 +47,5 @@
{% endblock %}
{% block scripts %}
<script>const TID={{ t.id|tojson }};</script>
<script src="/static/tenant.js"></script>
<script src="/static/tenant.js?v={{ static_v('tenant.js') }}"></script>
{% endblock %}

View File

@@ -30,3 +30,14 @@ def _live() -> bool:
templates.env.globals["deploy_live"] = _live
def _static_v(name: str) -> str:
"""Cache-Busting: Änderungszeit der Datei als Query-Parameter, damit Browser nach einem Deploy nie veraltete JS/CSS-Dateien nutzen."""
try:
return str(int((ROOT / "app" / "static" / name).stat().st_mtime))
except OSError:
return "0"
templates.env.globals["static_v"] = _static_v