feat: enhance media lifecycle management and inline media integration
Deploy Development / deploy (push) Successful in 34s
Test Suite / pytest-backend (push) Successful in 23s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Successful in 24s

- Implemented media lifecycle management with new API endpoints for handling asset states (trash_soft, trash_hidden, recover, purge), improving media governance.
- Updated frontend components to filter and display media based on lifecycle states, enhancing user experience and visibility.
- Enhanced documentation in MEDIA_ASSETS_AND_ARCHIVE_SPEC.md to include guidelines for inline media references in exercise texts, establishing a clear implementation plan.
- Incremented version to 0.8.42, reflecting the latest changes in media handling and lifecycle management.
This commit is contained in:
Lars committed 2026-05-07 12:55:50 +02:00
1 parent ece08ec1a1
commit 8ac723eafe
16 files changed
+553 -20

No files matched your search

+86
View File
@@ -612,6 +612,16 @@ function ExerciseFormPage() {
}
}
const runMediaLifecycle = async (assetId, action) => {
if (!assetId) return
try {
await api.postMediaAssetLifecycle(assetId, action)
await refreshMedia()
} catch (e) {
alert(e.message || String(e))
}
}
const moveMediaRow = async (idx, dir) => {
if (!exerciseId) return
const j = idx + dir
@@ -1321,6 +1331,82 @@ function ExerciseFormPage() {
</>
)}
</div>
{m.media_asset_id ? (
<div style={{ marginTop: '8px', fontSize: '12px' }}>
{String(m.asset_lifecycle_state || 'active').toLowerCase() === 'trash_soft' && (
<p style={{ color: 'var(--danger)', margin: '0 0 6px' }}>
Papierkorb (Stufe 1): für neue Zuordnungen gesperrt.
</p>
)}
{String(m.asset_lifecycle_state || 'active').toLowerCase() === 'trash_hidden' && (
<p style={{ color: 'var(--danger)', margin: '0 0 6px' }}>
Ausgeblendet (Stufe 2): in der Übungsansicht nicht sichtbar.
</p>
)}
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '6px', alignItems: 'center' }}>
{String(m.asset_lifecycle_state || 'active').toLowerCase() === 'active' && (
<button
type="button"
className="btn btn-secondary"
style={{ fontSize: '11px', padding: '4px 8px' }}
onClick={() => {
if (confirm('Medium in den Papierkorb (Stufe 1)?')) {
runMediaLifecycle(m.media_asset_id, 'trash_soft')
}
}}
>
Papierkorb (Stufe 1)
</button>
)}
{['active', 'trash_soft'].includes(String(m.asset_lifecycle_state || 'active').toLowerCase()) && (
<button
type="button"
className="btn btn-secondary"
style={{ fontSize: '11px', padding: '4px 8px' }}
onClick={() => {
if (confirm('Medium ausblenden (Stufe 2)? Lesende Nutzer sehen es nicht mehr.')) {
runMediaLifecycle(m.media_asset_id, 'trash_hidden')
}
}}
>
Ausblenden (Stufe 2)
</button>
)}
{String(m.asset_lifecycle_state || 'active').toLowerCase() === 'trash_hidden' && (
<>
<button
type="button"
className="btn btn-secondary"
style={{ fontSize: '11px', padding: '4px 8px' }}
onClick={() => runMediaLifecycle(m.media_asset_id, 'recover')}
>
Wiederherstellen (Stufe 1)
</button>
<button
type="button"
className="btn"
style={{
fontSize: '11px',
padding: '4px 8px',
background: 'var(--danger)',
color: '#fff',
border: 'none',
}}
onClick={() => {
if (
confirm('Endgültig löschen? Entfernt Datei und Verknüpfungen dieser Medien-ID.')
) {
runMediaLifecycle(m.media_asset_id, 'purge')
}
}}
>
Endgültig löschen
</button>
</>
)}
</div>
</div>
) : null}
<div className="form-row" style={{ marginTop: '8px', display: 'grid', gap: '8px' }}>
<input
type="text"