feat: add extraction deletion functionality with confirmation dialog and update extraction list on deletion
Some checks failed
Frontend CI / lint (push) Failing after 18s
Frontend CI / build (push) Has been skipped

This commit is contained in:
JSC
2025-08-25 21:40:47 +02:00
parent 4a973e5044
commit 6a40311a82
4 changed files with 135 additions and 4 deletions

View File

@@ -159,6 +159,23 @@ export function ExtractionsPage() {
setShowCreateDialog(false)
}
const handleExtractionDeleted = (extractionId: number) => {
// Remove the deleted extraction from the current list
setExtractions(prev => prev.filter(extraction => extraction.id !== extractionId))
// Update total count
setTotalCount(prev => prev - 1)
// If current page is now empty and not the first page, go to previous page
const remainingOnCurrentPage = extractions.length - 1
if (remainingOnCurrentPage === 0 && currentPage > 1) {
setCurrentPage(currentPage - 1)
}
// Refresh the full list to ensure accuracy
fetchExtractions()
}
const renderContent = () => {
if (loading) {
return <ExtractionsLoading />
@@ -174,7 +191,10 @@ export function ExtractionsPage() {
return (
<div className="space-y-4">
<ExtractionsTable extractions={extractions} />
<ExtractionsTable
extractions={extractions}
onExtractionDeleted={handleExtractionDeleted}
/>
<AppPagination
currentPage={currentPage}
totalPages={totalPages}