From 3f4ef75463f8a9da2b7d511af50e95d94d50ae85 Mon Sep 17 00:00:00 2001 From: Lars Date: Thu, 19 Mar 2026 07:27:56 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20Prompt-Deaktivierung=20jetzt=20voll=20fu?= =?UTF-8?q?nktionsf=C3=A4hig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PROBLEME behoben: 1. Falscher Datentyp: Frontend sendete 0/1 statt boolean 2. Button-Text: "Aktiv." → "Aktivieren" 3. Keine visuelle Markierung für deaktivierte Prompts FIXES: Backend (main.py): - active-Wert wird explizit zu boolean konvertiert - Akzeptiert jetzt sowohl true/false als auch 1/0 Frontend (Analysis.jsx): - Sendet jetzt !p.active (boolean) statt p.active?0:1 - Button-Text: "Deaktivieren" / "Aktivieren" (klar lesbar) - Visuelle Markierung für inaktive Prompts: * Opacity 0.6 (ausgegraut) * Rotes Badge "⏸ Deaktiviert" - Gilt für Einzel- UND Pipeline-Prompts RESULTAT: ✅ Deaktivierte Prompts werden nicht mehr auf "Analysen starten" gezeigt ✅ Klare visuelle Unterscheidung im Prompts-Tab ✅ Button-Text eindeutig ("Aktivieren" vs "Deaktivieren") Co-Authored-By: Claude Opus 4.6 --- backend/main.py | 3 ++- frontend/src/pages/Analysis.jsx | 14 ++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/backend/main.py b/backend/main.py index c30b46b..76339a0 100644 --- a/backend/main.py +++ b/backend/main.py @@ -1099,7 +1099,8 @@ def update_prompt(prompt_id: str, data: dict, session: dict=Depends(require_admi values.append(data['template']) if 'active' in data: updates.append('active=%s') - values.append(data['active']) + # Convert to boolean (accepts true/false, 1/0) + values.append(bool(data['active'])) if updates: cur.execute(f"UPDATE ai_prompts SET {', '.join(updates)}, updated=CURRENT_TIMESTAMP WHERE id=%s", diff --git a/frontend/src/pages/Analysis.jsx b/frontend/src/pages/Analysis.jsx index ca9e734..27377be 100644 --- a/frontend/src/pages/Analysis.jsx +++ b/frontend/src/pages/Analysis.jsx @@ -348,13 +348,13 @@ export default function Analysis() { Einzelanalysen {singlePrompts.map(p=>( -
+
{SLUG_LABELS[p.slug]||p.name} - {!p.active && Inaktiv} + {!p.active && ⏸ Deaktiviert}
{p.description &&
{p.description}
}
@@ -364,10 +364,10 @@ export default function Analysis() { fetch(`/api/prompts/${p.id}`,{ method:'PUT', headers:{'Content-Type':'application/json','X-Auth-Token':token}, - body:JSON.stringify({active:p.active?0:1}) + body:JSON.stringify({active:!p.active}) }).then(loadAll) }}> - {p.active?'Deaktiv.':'Aktiv.'} + {p.active?'Deaktivieren':'Aktivieren'} @@ -393,13 +393,15 @@ export default function Analysis() { const isJson = jsonSlugs.includes(p.slug) return (
+ style={{borderLeft:`3px solid ${isJson?'var(--warn)':'var(--accent)'}`,opacity:p.active?1:0.6}}>
{p.name} {isJson && JSON-Output} + {!p.active && ⏸ Deaktiviert}
{p.description &&
{p.description}
}