feat: unified prompt UI - Phase 3 complete (Issue #28)
Frontend Consolidation: - UnifiedPromptModal: Single editor for base + pipeline prompts - Type selector (base/pipeline) - Base: Template editor with placeholders - Pipeline: Dynamic stage editor - Add/remove stages with drag/drop - Inline or reference prompts per stage - Output key + format per prompt - AdminPromptsPage redesign: - Removed tab switcher (prompts/pipelines) - Added type filter (All/Base/Pipeline) - Type badge in table - Stage count column - Icon-based actions (Edit/Copy/Delete) - Category filter retained Changes: - Completely rewrote AdminPromptsPage (495 → 446 lines) - Single modal for all prompt types - Mobile-ready layout - Simplified state management Next: Phase 4 - Cleanup deprecated endpoints + docs
This commit is contained in:
1 parent
7be7266477
commit
31e2c24a8a
2 files changed
+865
-373
No files matched your search
@@ -1,27 +1,23 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { api } from '../utils/api'
|
||||
import PromptEditModal from '../components/PromptEditModal'
|
||||
import PipelineConfigModal from '../components/PipelineConfigModal'
|
||||
import { Star, Trash2, Edit, Copy } from 'lucide-react'
|
||||
import UnifiedPromptModal from '../components/UnifiedPromptModal'
|
||||
import { Star, Trash2, Edit, Copy, Filter } from 'lucide-react'
|
||||
|
||||
/**
|
||||
* Admin Prompts Page - Unified System (Issue #28 Phase 3)
|
||||
*
|
||||
* Manages both base and pipeline-type prompts in one interface.
|
||||
*/
|
||||
export default function AdminPromptsPage() {
|
||||
const [activeTab, setActiveTab] = useState('prompts') // 'prompts' | 'pipelines'
|
||||
|
||||
// Prompts state
|
||||
const [prompts, setPrompts] = useState([])
|
||||
const [filteredPrompts, setFilteredPrompts] = useState([])
|
||||
const [typeFilter, setTypeFilter] = useState('all') // 'all' | 'base' | 'pipeline'
|
||||
const [category, setCategory] = useState('all')
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState(null)
|
||||
const [editingPrompt, setEditingPrompt] = useState(null)
|
||||
const [showNewPrompt, setShowNewPrompt] = useState(false)
|
||||
|
||||
// Pipeline configs state
|
||||
const [pipelineConfigs, setPipelineConfigs] = useState([])
|
||||
const [pipelineLoading, setPipelineLoading] = useState(false)
|
||||
const [editingPipeline, setEditingPipeline] = useState(null)
|
||||
const [showNewPipeline, setShowNewPipeline] = useState(false)
|
||||
|
||||
const categories = [
|
||||
{ id: 'all', label: 'Alle Kategorien' },
|
||||
{ id: 'körper', label: 'Körper' },
|
||||
@@ -30,21 +26,31 @@ export default function AdminPromptsPage() {
|
||||
{ id: 'schlaf', label: 'Schlaf' },
|
||||
{ id: 'vitalwerte', label: 'Vitalwerte' },
|
||||
{ id: 'ziele', label: 'Ziele' },
|
||||
{ id: 'ganzheitlich', label: 'Ganzheitlich' }
|
||||
{ id: 'ganzheitlich', label: 'Ganzheitlich' },
|
||||
{ id: 'pipeline', label: 'Pipeline' }
|
||||
]
|
||||
|
||||
useEffect(() => {
|
||||
loadPrompts()
|
||||
loadPipelineConfigs()
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (category === 'all') {
|
||||
setFilteredPrompts(prompts)
|
||||
} else {
|
||||
setFilteredPrompts(prompts.filter(p => p.category === category))
|
||||
let filtered = prompts
|
||||
|
||||
// Filter by type
|
||||
if (typeFilter === 'base') {
|
||||
filtered = filtered.filter(p => p.type === 'base')
|
||||
} else if (typeFilter === 'pipeline') {
|
||||
filtered = filtered.filter(p => p.type === 'pipeline')
|
||||
}
|
||||
}, [category, prompts])
|
||||
|
||||
// Filter by category
|
||||
if (category !== 'all') {
|
||||
filtered = filtered.filter(p => p.category === category)
|
||||
}
|
||||
|
||||
setFilteredPrompts(filtered)
|
||||
}, [typeFilter, category, prompts])
|
||||
|
||||
const loadPrompts = async () => {
|
||||
try {
|
||||
@@ -61,7 +67,7 @@ export default function AdminPromptsPage() {
|
||||
|
||||
const handleToggleActive = async (prompt) => {
|
||||
try {
|
||||
await api.updatePrompt(prompt.id, { active: !prompt.active })
|
||||
await api.updateUnifiedPrompt(prompt.id, { active: !prompt.active })
|
||||
await loadPrompts()
|
||||
} catch (e) {
|
||||
alert('Fehler: ' + e.message)
|
||||
@@ -88,408 +94,345 @@ export default function AdminPromptsPage() {
|
||||
}
|
||||
}
|
||||
|
||||
const handleMoveUp = async (prompt) => {
|
||||
const idx = filteredPrompts.findIndex(p => p.id === prompt.id)
|
||||
if (idx === 0) return // Already at top
|
||||
|
||||
const above = filteredPrompts[idx - 1]
|
||||
const newOrder = filteredPrompts.map(p => p.id)
|
||||
newOrder[idx] = above.id
|
||||
newOrder[idx - 1] = prompt.id
|
||||
|
||||
try {
|
||||
await api.reorderPrompts(newOrder)
|
||||
await loadPrompts()
|
||||
} catch (e) {
|
||||
alert('Fehler: ' + e.message)
|
||||
}
|
||||
}
|
||||
|
||||
const handleMoveDown = async (prompt) => {
|
||||
const idx = filteredPrompts.findIndex(p => p.id === prompt.id)
|
||||
if (idx === filteredPrompts.length - 1) return // Already at bottom
|
||||
|
||||
const below = filteredPrompts[idx + 1]
|
||||
const newOrder = filteredPrompts.map(p => p.id)
|
||||
newOrder[idx] = below.id
|
||||
newOrder[idx + 1] = prompt.id
|
||||
|
||||
try {
|
||||
await api.reorderPrompts(newOrder)
|
||||
await loadPrompts()
|
||||
} catch (e) {
|
||||
alert('Fehler: ' + e.message)
|
||||
}
|
||||
}
|
||||
|
||||
const handleSavePrompt = async () => {
|
||||
await loadPrompts()
|
||||
const handleSave = async () => {
|
||||
setEditingPrompt(null)
|
||||
setShowNewPrompt(false)
|
||||
await loadPrompts()
|
||||
}
|
||||
|
||||
// Pipeline Config handlers
|
||||
const loadPipelineConfigs = async () => {
|
||||
const getStageCount = (prompt) => {
|
||||
if (prompt.type !== 'pipeline' || !prompt.stages) return 0
|
||||
try {
|
||||
setPipelineLoading(true)
|
||||
const data = await api.listPipelineConfigs()
|
||||
setPipelineConfigs(data)
|
||||
const stages = typeof prompt.stages === 'string'
|
||||
? JSON.parse(prompt.stages)
|
||||
: prompt.stages
|
||||
return stages.length
|
||||
} catch (e) {
|
||||
setError(e.message)
|
||||
} finally {
|
||||
setPipelineLoading(false)
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
const handleDeletePipeline = async (config) => {
|
||||
if (!confirm(`Pipeline-Config "${config.name}" wirklich löschen?`)) return
|
||||
|
||||
try {
|
||||
await api.deletePipelineConfig(config.id)
|
||||
await loadPipelineConfigs()
|
||||
} catch (e) {
|
||||
alert('Fehler: ' + e.message)
|
||||
}
|
||||
const getTypeLabel = (type) => {
|
||||
if (type === 'base') return 'Basis'
|
||||
if (type === 'pipeline') return 'Pipeline'
|
||||
return type || 'Pipeline' // Default for old prompts
|
||||
}
|
||||
|
||||
const handleSetDefaultPipeline = async (config) => {
|
||||
try {
|
||||
await api.setDefaultPipelineConfig(config.id)
|
||||
await loadPipelineConfigs()
|
||||
} catch (e) {
|
||||
alert('Fehler: ' + e.message)
|
||||
}
|
||||
}
|
||||
|
||||
const handleSavePipeline = async () => {
|
||||
await loadPipelineConfigs()
|
||||
setEditingPipeline(null)
|
||||
setShowNewPipeline(false)
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="page">
|
||||
<div style={{textAlign:'center', padding:40}}>
|
||||
<div className="spinner"/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
const getTypeColor = (type) => {
|
||||
if (type === 'base') return 'var(--accent)'
|
||||
if (type === 'pipeline') return '#6366f1'
|
||||
return 'var(--text3)'
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="page">
|
||||
<div style={{display:'flex', justifyContent:'space-between', alignItems:'center', marginBottom:24}}>
|
||||
<h1 className="page-title">KI-Prompts & Pipelines</h1>
|
||||
<div style={{
|
||||
padding: 20,
|
||||
maxWidth: 1400,
|
||||
margin: '0 auto',
|
||||
paddingBottom: 80
|
||||
}}>
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
marginBottom: 24
|
||||
}}>
|
||||
<h1 style={{ margin: 0, fontSize: 24, fontWeight: 600 }}>
|
||||
KI-Prompts ({filteredPrompts.length})
|
||||
</h1>
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
onClick={() => activeTab === 'prompts' ? setShowNewPrompt(true) : setShowNewPipeline(true)}
|
||||
onClick={() => setShowNewPrompt(true)}
|
||||
>
|
||||
{activeTab === 'prompts' ? '+ Neuer Prompt' : '+ Neue Pipeline'}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Tab Switcher */}
|
||||
<div style={{display:'flex', gap:12, marginBottom:24, borderBottom:'2px solid var(--border)'}}>
|
||||
<button
|
||||
onClick={() => setActiveTab('prompts')}
|
||||
style={{
|
||||
padding:'12px 24px', background:'none', border:'none',
|
||||
borderBottom: activeTab === 'prompts' ? '2px solid var(--accent)' : '2px solid transparent',
|
||||
marginBottom:-2, cursor:'pointer', fontSize:14, fontWeight:activeTab === 'prompts' ? 600 : 400,
|
||||
color: activeTab === 'prompts' ? 'var(--accent)' : 'var(--text2)'
|
||||
}}
|
||||
>
|
||||
Prompts ({prompts.length})
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setActiveTab('pipelines')}
|
||||
style={{
|
||||
padding:'12px 24px', background:'none', border:'none',
|
||||
borderBottom: activeTab === 'pipelines' ? '2px solid var(--accent)' : '2px solid transparent',
|
||||
marginBottom:-2, cursor:'pointer', fontSize:14, fontWeight:activeTab === 'pipelines' ? 600 : 400,
|
||||
color: activeTab === 'pipelines' ? 'var(--accent)' : 'var(--text2)'
|
||||
}}
|
||||
>
|
||||
Pipeline-Konfigurationen ({pipelineConfigs.length})
|
||||
+ Neuer Prompt
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{error && (
|
||||
<div style={{padding:12, background:'#fee', color:'#c00', borderRadius:8, marginBottom:16}}>
|
||||
<div style={{
|
||||
padding: 16,
|
||||
background: '#fee',
|
||||
color: '#c00',
|
||||
borderRadius: 8,
|
||||
marginBottom: 16
|
||||
}}>
|
||||
{error}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Prompts Tab */}
|
||||
{activeTab === 'prompts' && (
|
||||
<>
|
||||
{/* Category Filter */}
|
||||
<div style={{marginBottom:24}}>
|
||||
<label style={{fontSize:13, fontWeight:600, marginBottom:8, display:'block'}}>
|
||||
Kategorie filtern:
|
||||
</label>
|
||||
{/* Filters */}
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
gap: 12,
|
||||
marginBottom: 24,
|
||||
flexWrap: 'wrap',
|
||||
alignItems: 'center'
|
||||
}}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||||
<Filter size={16} color="var(--text3)" />
|
||||
<span style={{ fontSize: 13, color: 'var(--text3)' }}>Typ:</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: 6 }}>
|
||||
<button
|
||||
className={typeFilter === 'all' ? 'btn btn-primary' : 'btn'}
|
||||
onClick={() => setTypeFilter('all')}
|
||||
style={{ fontSize: 13, padding: '6px 12px' }}
|
||||
>
|
||||
Alle ({prompts.length})
|
||||
</button>
|
||||
<button
|
||||
className={typeFilter === 'base' ? 'btn btn-primary' : 'btn'}
|
||||
onClick={() => setTypeFilter('base')}
|
||||
style={{ fontSize: 13, padding: '6px 12px' }}
|
||||
>
|
||||
Basis-Prompts ({prompts.filter(p => p.type === 'base').length})
|
||||
</button>
|
||||
<button
|
||||
className={typeFilter === 'pipeline' ? 'btn btn-primary' : 'btn'}
|
||||
onClick={() => setTypeFilter('pipeline')}
|
||||
style={{ fontSize: 13, padding: '6px 12px' }}
|
||||
>
|
||||
Pipelines ({prompts.filter(p => p.type === 'pipeline' || !p.type).length})
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div style={{
|
||||
width: 1,
|
||||
height: 24,
|
||||
background: 'var(--border)',
|
||||
margin: '0 8px'
|
||||
}} />
|
||||
|
||||
<select
|
||||
className="form-select"
|
||||
value={category}
|
||||
onChange={e => setCategory(e.target.value)}
|
||||
style={{maxWidth:300}}
|
||||
style={{ fontSize: 13, padding: '6px 12px' }}
|
||||
>
|
||||
{categories.map(cat => (
|
||||
<option key={cat.id} value={cat.id}>{cat.label}</option>
|
||||
<option key={cat.id} value={cat.id}>
|
||||
{cat.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{/* Prompts Table */}
|
||||
<div className="card">
|
||||
<table style={{width:'100%', borderCollapse:'collapse'}}>
|
||||
<thead>
|
||||
<tr style={{borderBottom:'2px solid var(--border)', textAlign:'left'}}>
|
||||
<th style={{padding:'12px 8px', fontSize:12, fontWeight:600, color:'var(--text3)'}}>
|
||||
Titel
|
||||
</th>
|
||||
<th style={{padding:'12px 8px', fontSize:12, fontWeight:600, color:'var(--text3)'}}>
|
||||
Kategorie
|
||||
</th>
|
||||
<th style={{padding:'12px 8px', fontSize:12, fontWeight:600, color:'var(--text3)'}}>
|
||||
Aktiv
|
||||
</th>
|
||||
<th style={{padding:'12px 8px', fontSize:12, fontWeight:600, color:'var(--text3)'}}>
|
||||
Reihenfolge
|
||||
</th>
|
||||
<th style={{padding:'12px 8px', fontSize:12, fontWeight:600, color:'var(--text3)'}}>
|
||||
Aktionen
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{filteredPrompts.map((prompt, idx) => (
|
||||
<tr key={prompt.id} style={{borderBottom:'1px solid var(--border)'}}>
|
||||
<td style={{padding:'12px 8px'}}>
|
||||
<div style={{fontWeight:500, fontSize:14}}>{prompt.name}</div>
|
||||
{prompt.description && (
|
||||
<div style={{fontSize:11, color:'var(--text3)', marginTop:2}}>
|
||||
{prompt.description}
|
||||
</div>
|
||||
)}
|
||||
<div style={{fontSize:10, color:'var(--text3)', marginTop:4}}>
|
||||
{prompt.slug}
|
||||
</div>
|
||||
</td>
|
||||
<td style={{padding:'12px 8px'}}>
|
||||
<span style={{
|
||||
padding:'4px 8px', borderRadius:4, fontSize:11, fontWeight:500,
|
||||
background:'var(--surface2)', color:'var(--text2)'
|
||||
}}>
|
||||
{prompt.category || 'ganzheitlich'}
|
||||
</span>
|
||||
</td>
|
||||
<td style={{padding:'12px 8px'}}>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={prompt.active}
|
||||
onChange={() => handleToggleActive(prompt)}
|
||||
style={{cursor:'pointer'}}
|
||||
/>
|
||||
</td>
|
||||
<td style={{padding:'12px 8px'}}>
|
||||
<div style={{display:'flex', gap:4}}>
|
||||
<button
|
||||
onClick={() => handleMoveUp(prompt)}
|
||||
disabled={idx === 0}
|
||||
style={{
|
||||
padding:'4px 8px', fontSize:12, cursor: idx === 0 ? 'not-allowed' : 'pointer',
|
||||
opacity: idx === 0 ? 0.5 : 1
|
||||
}}
|
||||
title="Nach oben"
|
||||
>
|
||||
↑
|
||||
</button>
|
||||
<button
|
||||
onClick={() => handleMoveDown(prompt)}
|
||||
disabled={idx === filteredPrompts.length - 1}
|
||||
style={{
|
||||
padding:'4px 8px', fontSize:12,
|
||||
cursor: idx === filteredPrompts.length - 1 ? 'not-allowed' : 'pointer',
|
||||
opacity: idx === filteredPrompts.length - 1 ? 0.5 : 1
|
||||
}}
|
||||
title="Nach unten"
|
||||
>
|
||||
↓
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
<td style={{padding:'12px 8px'}}>
|
||||
<div style={{display:'flex', gap:6}}>
|
||||
<button
|
||||
className="btn"
|
||||
onClick={() => setEditingPrompt(prompt)}
|
||||
style={{fontSize:12, padding:'6px 12px'}}
|
||||
>
|
||||
Bearbeiten
|
||||
</button>
|
||||
<button
|
||||
className="btn"
|
||||
onClick={() => handleDuplicate(prompt)}
|
||||
style={{fontSize:12, padding:'6px 12px'}}
|
||||
>
|
||||
Duplizieren
|
||||
</button>
|
||||
<button
|
||||
className="btn"
|
||||
onClick={() => handleDelete(prompt)}
|
||||
style={{fontSize:12, padding:'6px 12px', color:'#D85A30'}}
|
||||
>
|
||||
Löschen
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
{loading ? (
|
||||
<div style={{ textAlign: 'center', padding: 40, color: 'var(--text3)' }}>
|
||||
Lädt...
|
||||
</div>
|
||||
) : (
|
||||
<div style={{
|
||||
background: 'var(--surface)',
|
||||
borderRadius: 12,
|
||||
border: '1px solid var(--border)',
|
||||
overflow: 'hidden'
|
||||
}}>
|
||||
<table style={{ width: '100%', borderCollapse: 'collapse' }}>
|
||||
<thead>
|
||||
<tr style={{
|
||||
background: 'var(--surface2)',
|
||||
borderBottom: '1px solid var(--border)'
|
||||
}}>
|
||||
<th style={{
|
||||
padding: 12,
|
||||
textAlign: 'left',
|
||||
fontSize: 12,
|
||||
fontWeight: 600,
|
||||
color: 'var(--text3)',
|
||||
width: 80
|
||||
}}>
|
||||
Typ
|
||||
</th>
|
||||
<th style={{
|
||||
padding: 12,
|
||||
textAlign: 'left',
|
||||
fontSize: 12,
|
||||
fontWeight: 600,
|
||||
color: 'var(--text3)'
|
||||
}}>
|
||||
Name
|
||||
</th>
|
||||
<th style={{
|
||||
padding: 12,
|
||||
textAlign: 'left',
|
||||
fontSize: 12,
|
||||
fontWeight: 600,
|
||||
color: 'var(--text3)',
|
||||
width: 120
|
||||
}}>
|
||||
Kategorie
|
||||
</th>
|
||||
<th style={{
|
||||
padding: 12,
|
||||
textAlign: 'center',
|
||||
fontSize: 12,
|
||||
fontWeight: 600,
|
||||
color: 'var(--text3)',
|
||||
width: 100
|
||||
}}>
|
||||
Stages
|
||||
</th>
|
||||
<th style={{
|
||||
padding: 12,
|
||||
textAlign: 'center',
|
||||
fontSize: 12,
|
||||
fontWeight: 600,
|
||||
color: 'var(--text3)',
|
||||
width: 80
|
||||
}}>
|
||||
Status
|
||||
</th>
|
||||
<th style={{
|
||||
padding: 12,
|
||||
textAlign: 'right',
|
||||
fontSize: 12,
|
||||
fontWeight: 600,
|
||||
color: 'var(--text3)',
|
||||
width: 120
|
||||
}}>
|
||||
Aktionen
|
||||
</th>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{filteredPrompts.length === 0 && (
|
||||
<div style={{padding:40, textAlign:'center', color:'var(--text3)'}}>
|
||||
Keine Prompts in dieser Kategorie
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Pipelines Tab */}
|
||||
{activeTab === 'pipelines' && (
|
||||
<>
|
||||
{pipelineLoading ? (
|
||||
<div style={{textAlign:'center', padding:40}}>
|
||||
<div className="spinner"/>
|
||||
</div>
|
||||
) : (
|
||||
<div className="card">
|
||||
<table style={{width:'100%', borderCollapse:'collapse'}}>
|
||||
<thead>
|
||||
<tr style={{borderBottom:'2px solid var(--border)', textAlign:'left'}}>
|
||||
<th style={{padding:'12px 8px', fontSize:12, fontWeight:600, color:'var(--text3)'}}>Name</th>
|
||||
<th style={{padding:'12px 8px', fontSize:12, fontWeight:600, color:'var(--text3)'}}>Module</th>
|
||||
<th style={{padding:'12px 8px', fontSize:12, fontWeight:600, color:'var(--text3)'}}>Stages</th>
|
||||
<th style={{padding:'12px 8px', fontSize:12, fontWeight:600, color:'var(--text3)'}}>Status</th>
|
||||
<th style={{padding:'12px 8px', fontSize:12, fontWeight:600, color:'var(--text3)'}}>Aktionen</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{filteredPrompts.length === 0 ? (
|
||||
<tr>
|
||||
<td colSpan="6" style={{
|
||||
padding: 40,
|
||||
textAlign: 'center',
|
||||
color: 'var(--text3)'
|
||||
}}>
|
||||
Keine Prompts gefunden
|
||||
</td>
|
||||
</tr>
|
||||
) : (
|
||||
filteredPrompts.map(prompt => (
|
||||
<tr
|
||||
key={prompt.id}
|
||||
style={{
|
||||
borderBottom: '1px solid var(--border)',
|
||||
opacity: prompt.active ? 1 : 0.5
|
||||
}}
|
||||
>
|
||||
<td style={{ padding: 12 }}>
|
||||
<div style={{
|
||||
display: 'inline-block',
|
||||
padding: '2px 8px',
|
||||
background: getTypeColor(prompt.type) + '20',
|
||||
color: getTypeColor(prompt.type),
|
||||
borderRadius: 6,
|
||||
fontSize: 11,
|
||||
fontWeight: 600
|
||||
}}>
|
||||
{getTypeLabel(prompt.type)}
|
||||
</div>
|
||||
</td>
|
||||
<td style={{ padding: 12 }}>
|
||||
<div>
|
||||
<div style={{ fontSize: 14, fontWeight: 500 }}>
|
||||
{prompt.display_name || prompt.name}
|
||||
</div>
|
||||
<div style={{ fontSize: 11, color: 'var(--text3)', marginTop: 2 }}>
|
||||
{prompt.slug}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td style={{ padding: 12, fontSize: 13 }}>
|
||||
{prompt.category || 'ganzheitlich'}
|
||||
</td>
|
||||
<td style={{ padding: 12, textAlign: 'center', fontSize: 13 }}>
|
||||
{prompt.type === 'pipeline' ? (
|
||||
<span style={{
|
||||
background: 'var(--surface2)',
|
||||
padding: '2px 6px',
|
||||
borderRadius: 4,
|
||||
fontSize: 11
|
||||
}}>
|
||||
{getStageCount(prompt)} Stages
|
||||
</span>
|
||||
) : (
|
||||
<span style={{ color: 'var(--text3)', fontSize: 11 }}>—</span>
|
||||
)}
|
||||
</td>
|
||||
<td style={{ padding: 12, textAlign: 'center' }}>
|
||||
<label style={{
|
||||
display: 'inline-flex',
|
||||
alignItems: 'center',
|
||||
cursor: 'pointer'
|
||||
}}>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={prompt.active}
|
||||
onChange={() => handleToggleActive(prompt)}
|
||||
style={{ margin: 0 }}
|
||||
/>
|
||||
</label>
|
||||
</td>
|
||||
<td style={{ padding: 12 }}>
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
gap: 6,
|
||||
justifyContent: 'flex-end'
|
||||
}}>
|
||||
<button
|
||||
onClick={() => setEditingPrompt(prompt)}
|
||||
style={{
|
||||
background: 'none',
|
||||
border: 'none',
|
||||
cursor: 'pointer',
|
||||
padding: 4
|
||||
}}
|
||||
title="Bearbeiten"
|
||||
>
|
||||
<Edit size={16} color="var(--accent)" />
|
||||
</button>
|
||||
<button
|
||||
onClick={() => handleDuplicate(prompt)}
|
||||
style={{
|
||||
background: 'none',
|
||||
border: 'none',
|
||||
cursor: 'pointer',
|
||||
padding: 4
|
||||
}}
|
||||
title="Duplizieren"
|
||||
>
|
||||
<Copy size={16} color="var(--text3)" />
|
||||
</button>
|
||||
<button
|
||||
onClick={() => handleDelete(prompt)}
|
||||
style={{
|
||||
background: 'none',
|
||||
border: 'none',
|
||||
cursor: 'pointer',
|
||||
padding: 4
|
||||
}}
|
||||
title="Löschen"
|
||||
>
|
||||
<Trash2 size={16} color="var(--danger)" />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{pipelineConfigs.map(config => {
|
||||
const activeModules = Object.entries(config.modules || {}).filter(([_, active]) => active)
|
||||
|
||||
return (
|
||||
<tr key={config.id} style={{borderBottom:'1px solid var(--border)'}}>
|
||||
<td style={{padding:'12px 8px'}}>
|
||||
<div style={{fontWeight:500, fontSize:14}}>{config.name}</div>
|
||||
{config.is_default && (
|
||||
<span style={{
|
||||
fontSize:10, padding:'2px 6px', background:'var(--accent)',
|
||||
color:'white', borderRadius:3, marginTop:4, display:'inline-block'
|
||||
}}>
|
||||
Standard
|
||||
</span>
|
||||
)}
|
||||
{config.description && (
|
||||
<div style={{fontSize:11, color:'var(--text3)', marginTop:2}}>
|
||||
{config.description}
|
||||
</div>
|
||||
)}
|
||||
</td>
|
||||
<td style={{padding:'12px 8px'}}>
|
||||
<div style={{fontSize:11}}>
|
||||
{activeModules.map(([name]) => name).join(', ')}
|
||||
</div>
|
||||
<div style={{fontSize:10, color:'var(--text3)', marginTop:2}}>
|
||||
{activeModules.length} Module
|
||||
</div>
|
||||
</td>
|
||||
<td style={{padding:'12px 8px'}}>
|
||||
<div style={{fontSize:11}}>
|
||||
S1: {config.stage1_prompts?.length || 0} Prompts
|
||||
</div>
|
||||
<div style={{fontSize:10, color:'var(--text3)'}}>
|
||||
S2: {config.stage2_prompt ? '✓' : '-'} | S3: {config.stage3_prompt ? '✓' : '-'}
|
||||
</div>
|
||||
</td>
|
||||
<td style={{padding:'12px 8px'}}>
|
||||
<span style={{
|
||||
fontSize:11, padding:'3px 8px', borderRadius:4,
|
||||
background: config.active ? 'var(--accent-light)' : 'var(--surface2)',
|
||||
color: config.active ? 'var(--accent)' : 'var(--text3)'
|
||||
}}>
|
||||
{config.active ? 'Aktiv' : 'Inaktiv'}
|
||||
</span>
|
||||
</td>
|
||||
<td style={{padding:'12px 8px'}}>
|
||||
<div style={{display:'flex', gap:6}}>
|
||||
{!config.is_default && (
|
||||
<button
|
||||
onClick={() => handleSetDefaultPipeline(config)}
|
||||
style={{padding:'4px 8px', fontSize:11}}
|
||||
title="Als Standard setzen"
|
||||
>
|
||||
<Star size={14} />
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
onClick={() => setEditingPipeline(config)}
|
||||
style={{padding:'4px 8px', fontSize:11}}
|
||||
title="Bearbeiten"
|
||||
>
|
||||
<Edit size={14} />
|
||||
</button>
|
||||
<button
|
||||
onClick={() => handleDeletePipeline(config)}
|
||||
style={{padding:'4px 8px', fontSize:11, color:'var(--danger)'}}
|
||||
title="Löschen"
|
||||
>
|
||||
<Trash2 size={14} />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{pipelineConfigs.length === 0 && (
|
||||
<div style={{padding:40, textAlign:'center', color:'var(--text3)'}}>
|
||||
Noch keine Pipeline-Konfigurationen vorhanden
|
||||
</div>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Edit Modals */}
|
||||
{/* Unified Prompt Modal */}
|
||||
{(editingPrompt || showNewPrompt) && (
|
||||
<PromptEditModal
|
||||
<UnifiedPromptModal
|
||||
prompt={editingPrompt}
|
||||
onSave={handleSavePrompt}
|
||||
onSave={handleSave}
|
||||
onClose={() => {
|
||||
setEditingPrompt(null)
|
||||
setShowNewPrompt(false)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
{(editingPipeline || showNewPipeline) && (
|
||||
<PipelineConfigModal
|
||||
config={editingPipeline}
|
||||
onSave={handleSavePipeline}
|
||||
onClose={() => {
|
||||
setEditingPipeline(null)
|
||||
setShowNewPipeline(false)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user