feat: Add Placeholder Metadata Export to Admin Panel
Adds download functionality for complete placeholder metadata catalog. Backend: - Fix: None-template handling in placeholder_metadata_extractor.py - Prevents TypeError when template is None in ai_prompts - New endpoint: GET /api/prompts/placeholders/export-catalog-zip - Generates ZIP with 4 files: JSON catalog, Markdown catalog, Gap Report, Export Spec - Admin-only endpoint with on-the-fly generation - Returns streaming ZIP download Frontend: - Admin Panel: New "Placeholder Metadata Export" section - Button: "Complete JSON exportieren" - Downloads extended JSON - Button: "Complete ZIP" - Downloads all 4 catalog files as ZIP - Displays file descriptions - api.js: Added exportPlaceholdersExtendedJson() function Features: - Non-breaking: Existing endpoints unchanged - In-memory ZIP generation (no temp files) - Formatted filenames with date - Admin-only access for ZIP download - JSON download available for all authenticated users Use Cases: - Backup/archiving of placeholder metadata - Offline documentation access - Import into other tools - Compliance reporting Files in ZIP: 1. PLACEHOLDER_CATALOG_EXTENDED.json - Machine-readable metadata 2. PLACEHOLDER_CATALOG_EXTENDED.md - Human-readable catalog 3. PLACEHOLDER_GAP_REPORT.md - Unresolved fields analysis 4. PLACEHOLDER_EXPORT_SPEC.md - API specification Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
b7afa98639
commit
087e8dd885
4 files changed
+215
-9
No files matched your search
@@ -502,6 +502,53 @@ export default function AdminPanel() {
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Placeholder Metadata Export Section */}
|
||||
<div className="card section-gap" style={{marginTop:16}}>
|
||||
<div style={{fontWeight:700,fontSize:14,marginBottom:12,display:'flex',alignItems:'center',gap:6}}>
|
||||
<Settings size={16} color="var(--accent)"/> Placeholder Metadata Export (v1.0)
|
||||
</div>
|
||||
<div style={{fontSize:12,color:'var(--text3)',marginBottom:12,lineHeight:1.5}}>
|
||||
Exportiere vollständige Metadaten aller 116 Placeholders. Normative Compliance v1.0.0.
|
||||
</div>
|
||||
<div style={{display:'grid',gap:8}}>
|
||||
<button className="btn btn-secondary btn-full"
|
||||
onClick={async()=>{
|
||||
try {
|
||||
const data = await api.exportPlaceholdersExtendedJson()
|
||||
const blob = new Blob([JSON.stringify(data, null, 2)], {type:'application/json'})
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.download = `placeholder-metadata-extended-${new Date().toISOString().split('T')[0]}.json`
|
||||
a.click()
|
||||
window.URL.revokeObjectURL(url)
|
||||
} catch(e) {
|
||||
alert('Fehler beim Export: '+e.message)
|
||||
}
|
||||
}}>
|
||||
📄 Complete JSON exportieren
|
||||
</button>
|
||||
<button className="btn btn-secondary btn-full"
|
||||
onClick={async()=>{
|
||||
try {
|
||||
const token = localStorage.getItem('bodytrack_token')
|
||||
const a = document.createElement('a')
|
||||
a.href = `/api/prompts/placeholders/export-catalog-zip?token=${token}`
|
||||
a.download = `placeholder-catalog-${new Date().toISOString().split('T')[0]}.zip`
|
||||
a.click()
|
||||
} catch(e) {
|
||||
alert('Fehler beim Export: '+e.message)
|
||||
}
|
||||
}}>
|
||||
📦 Complete ZIP (JSON + Markdown + Reports)
|
||||
</button>
|
||||
</div>
|
||||
<div style={{fontSize:11,color:'var(--text3)',marginTop:8,lineHeight:1.5}}>
|
||||
<strong>JSON:</strong> Maschinenlesbare Metadaten aller Placeholders<br/>
|
||||
<strong>ZIP:</strong> Katalog (JSON + MD), Gap Report, Export Spec (4 Dateien)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -390,4 +390,7 @@ export const api = {
|
||||
getSleepDurationQualityChart: (days=28) => req(`/charts/sleep-duration-quality?days=${days}`),
|
||||
getSleepDebtChart: (days=28) => req(`/charts/sleep-debt?days=${days}`),
|
||||
getVitalSignsMatrixChart: (days=7) => req(`/charts/vital-signs-matrix?days=${days}`),
|
||||
|
||||
// Placeholder Metadata Export (v1.0)
|
||||
exportPlaceholdersExtendedJson: () => req('/prompts/placeholders/export-values-extended'),
|
||||
}
|
||||
Reference in new issue
Block a user