bugfixes
This commit is contained in:
parent
f2b8cb2457
commit
2fb3d4f00b
@ -1466,6 +1466,8 @@ func recordRemoveQueuedPostwork(w http.ResponseWriter, r *http.Request) {
|
||||
respondJSON(w, map[string]any{
|
||||
"ok": true,
|
||||
"id": id,
|
||||
"file": filepath.Base(out),
|
||||
"output": out,
|
||||
"removedAudioSidecars": len(removedAudioSidecars),
|
||||
})
|
||||
}
|
||||
|
||||
@ -3124,12 +3124,76 @@ export default function App() {
|
||||
}
|
||||
|
||||
async function removeQueuedPostworkJob(id: string) {
|
||||
const cleanId = String(id || '').trim()
|
||||
if (!cleanId) return
|
||||
|
||||
const beforeJob =
|
||||
jobsRef.current.find((j) => String((j as any)?.id ?? '').trim() === cleanId) ??
|
||||
jobs.find((j) => String((j as any)?.id ?? '').trim() === cleanId) ??
|
||||
null
|
||||
|
||||
const beforeFile = baseName(beforeJob?.output || '')
|
||||
|
||||
try {
|
||||
await apiJSON(`/api/record/postwork/remove?id=${encodeURIComponent(id)}`, {
|
||||
const data = await apiJSON<{
|
||||
ok?: boolean
|
||||
id?: string
|
||||
file?: string
|
||||
output?: string
|
||||
}>(`/api/record/postwork/remove?id=${encodeURIComponent(cleanId)}`, {
|
||||
method: 'POST',
|
||||
})
|
||||
|
||||
if (data?.ok !== true) {
|
||||
return
|
||||
}
|
||||
|
||||
const removedId = String(data.id || cleanId).trim()
|
||||
const removedFile =
|
||||
baseName(String(data.file || data.output || beforeFile || ''))
|
||||
|
||||
delete lastSeenAtByJobIdRef.current[removedId]
|
||||
|
||||
setJobs((prev) => {
|
||||
const next = prev.filter((j) => {
|
||||
const jid = String((j as any)?.id ?? '').trim()
|
||||
return jid !== removedId
|
||||
})
|
||||
|
||||
jobsRef.current = next
|
||||
return next
|
||||
})
|
||||
|
||||
setPlayerJob((prev) => {
|
||||
if (!prev) return prev
|
||||
|
||||
const sameId = String((prev as any)?.id ?? '').trim() === removedId
|
||||
const sameFile =
|
||||
removedFile &&
|
||||
baseName(prev.output || '') === removedFile
|
||||
|
||||
return sameId || sameFile ? null : prev
|
||||
})
|
||||
|
||||
setDoneJobs((prev) =>
|
||||
prev.filter((j) => {
|
||||
const jid = String((j as any)?.id ?? '').trim()
|
||||
const file = baseName(j.output || '')
|
||||
|
||||
if (jid && jid === removedId) return false
|
||||
if (removedFile && file === removedFile) return false
|
||||
|
||||
return true
|
||||
})
|
||||
)
|
||||
|
||||
donePrefetchRef.current = null
|
||||
|
||||
void loadDonePageRef.current(donePageRef.current, doneSortRef.current)
|
||||
void loadDoneCount()
|
||||
} catch (e: any) {
|
||||
notify.error('Entfernen fehlgeschlagen', e?.message ?? String(e))
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user