feat(history): add "Clear failed" button to wipe failed generations (#412)

When the model wasn't loaded, the app was closed mid-run, or a
generation otherwise errored out, the resulting "Failed" rows
accumulate in history and there was no way to remove them in bulk —
individual delete was the only option.

Adds a header row above the history list (only rendered when at
least one failed generation is present) with a "Clear failed" button
that opens a confirmation dialog, then calls a new
DELETE /history/failed endpoint which sweeps all status='failed'
rows (plus their version files / audio files on disk).

Closes jamiepine/voicebox#410

Co-authored-by: Claude Opus 4.6 <[email protected]>
This commit is contained in:
Mukunda Rao Katta
2026-04-16 02:12:30 -07:00
committed by GitHub
co-authored by Claude Opus 4.6
parent 73170d0e92
commit 0aa19a9994
5 changed files with 129 additions and 2 deletions
+6
View File
@@ -270,6 +270,12 @@ class ApiClient {
});
}
async clearFailedGenerations(): Promise<{ deleted: number }> {
return this.request<{ deleted: number }>(`/history/failed`, {
method: 'DELETE',
});
}
async exportGeneration(generationId: string): Promise<Blob> {
const url = `${this.getBaseUrl()}/history/${generationId}/export`;
const response = await fetch(url);
+11
View File
@@ -29,6 +29,17 @@ export function useDeleteGeneration() {
});
}
export function useClearFailedGenerations() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: () => apiClient.clearFailedGenerations(),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['history'] });
},
});
}
export function useExportGeneration() {
const platform = usePlatform();