summaryrefslogtreecommitdiff
path: root/lib/welding/table/ocr-table-toolbar-actions.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/welding/table/ocr-table-toolbar-actions.tsx')
-rw-r--r--lib/welding/table/ocr-table-toolbar-actions.tsx22
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/welding/table/ocr-table-toolbar-actions.tsx b/lib/welding/table/ocr-table-toolbar-actions.tsx
index 03d8cab0..a6a38adc 100644
--- a/lib/welding/table/ocr-table-toolbar-actions.tsx
+++ b/lib/welding/table/ocr-table-toolbar-actions.tsx
@@ -2,7 +2,7 @@
import * as React from "react"
import { type Table } from "@tanstack/react-table"
-import { Download, RefreshCcw, Upload, FileText, Loader2, ChevronDown, X, Play, Pause, RotateCcw } from "lucide-react"
+import { Download, RefreshCcw, Upload, FileText, Loader2, ChevronDown, X, Play, Pause, RotateCcw, Trash } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
@@ -48,6 +48,7 @@ import {
} from "@/components/ui/file-list"
import { getOcrAllRows } from "../service"
import { exportOcrDataToExcel } from "./exporft-ocr-data"
+import { DeleteOcrRowsDialog } from "./delete-ocr-rows-dialog"
interface OcrTableToolbarActionsProps {
table: Table<OcrRow>
@@ -96,6 +97,9 @@ export function OcrTableToolbarActions({ table }: OcrTableToolbarActionsProps) {
const [isPaused, setIsPaused] = React.useState(false)
const batchControllerRef = React.useRef<AbortController | null>(null)
+ // 선택된 행들
+ const selectedRows = table.getFilteredSelectedRowModel().rows
+
// 단일 파일 업로드 다이얼로그 닫기 핸들러
const handleDialogOpenChange = (open: boolean) => {
if (!open) {
@@ -522,6 +526,14 @@ export function OcrTableToolbarActions({ table }: OcrTableToolbarActionsProps) {
}
}
+ // 삭제 후 콜백 - 테이블 새로고침
+ const handleDeleteSuccess = () => {
+ // 선택 해제
+ table.resetRowSelection()
+ // 페이지 새로고침
+ window.location.reload()
+ }
+
const getStatusBadgeVariant = (status: FileUploadItem['status']) => {
switch (status) {
case 'pending': return 'secondary'
@@ -554,6 +566,14 @@ export function OcrTableToolbarActions({ table }: OcrTableToolbarActionsProps) {
return (
<div className="flex items-center gap-2">
+ {/* 선택된 행이 있을 때만 삭제 버튼 표시 */}
+ {selectedRows.length > 0 && (
+ <DeleteOcrRowsDialog
+ ocrRows={selectedRows}
+ onSuccess={handleDeleteSuccess}
+ />
+ )}
+
{/* 단일 파일 OCR 업로드 다이얼로그 */}
<Dialog open={isUploadDialogOpen} onOpenChange={handleDialogOpenChange}>
<DialogTrigger asChild>