fix: Prompt-Deaktivierung jetzt voll funktionsfähig
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
4886f00826
commit
3f4ef75463
2 files changed
+10
-7
No files matched your search
+2
-1
@@ -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",
|
||||
|
||||
@@ -348,13 +348,13 @@ export default function Analysis() {
|
||||
Einzelanalysen
|
||||
</div>
|
||||
{singlePrompts.map(p=>(
|
||||
<div key={p.id} className="card section-gap">
|
||||
<div key={p.id} className="card section-gap" style={{opacity:p.active?1:0.6}}>
|
||||
<div style={{display:'flex',alignItems:'center',gap:10}}>
|
||||
<div style={{flex:1}}>
|
||||
<div style={{fontWeight:600,fontSize:14,display:'flex',alignItems:'center',gap:8}}>
|
||||
{SLUG_LABELS[p.slug]||p.name}
|
||||
{!p.active && <span style={{fontSize:10,color:'var(--text3)',
|
||||
background:'var(--surface2)',padding:'1px 6px',borderRadius:4}}>Inaktiv</span>}
|
||||
{!p.active && <span style={{fontSize:10,color:'#D85A30',
|
||||
background:'#FCEBEB',padding:'2px 8px',borderRadius:4,fontWeight:600}}>⏸ Deaktiviert</span>}
|
||||
</div>
|
||||
{p.description && <div style={{fontSize:12,color:'var(--text3)',marginTop:1}}>{p.description}</div>}
|
||||
</div>
|
||||
@@ -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'}
|
||||
</button>
|
||||
<button className="btn btn-secondary" style={{padding:'5px 8px'}}
|
||||
onClick={()=>setEditing(p)}><Pencil size={13}/></button>
|
||||
@@ -393,13 +393,15 @@ export default function Analysis() {
|
||||
const isJson = jsonSlugs.includes(p.slug)
|
||||
return (
|
||||
<div key={p.id} className="card section-gap"
|
||||
style={{borderLeft:`3px solid ${isJson?'var(--warn)':'var(--accent)'}`}}>
|
||||
style={{borderLeft:`3px solid ${isJson?'var(--warn)':'var(--accent)'}`,opacity:p.active?1:0.6}}>
|
||||
<div style={{display:'flex',alignItems:'center',gap:10}}>
|
||||
<div style={{flex:1}}>
|
||||
<div style={{fontWeight:600,fontSize:14,display:'flex',alignItems:'center',gap:8}}>
|
||||
{p.name}
|
||||
{isJson && <span style={{fontSize:10,background:'var(--warn-bg)',
|
||||
color:'var(--warn-text)',padding:'1px 6px',borderRadius:4}}>JSON-Output</span>}
|
||||
{!p.active && <span style={{fontSize:10,color:'#D85A30',
|
||||
background:'#FCEBEB',padding:'2px 8px',borderRadius:4,fontWeight:600}}>⏸ Deaktiviert</span>}
|
||||
</div>
|
||||
{p.description && <div style={{fontSize:12,color:'var(--text3)',marginTop:1}}>{p.description}</div>}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user