From 356929b399ef31a4de82906267df438cf29ea59d Mon Sep 17 00:00:00 2001 From: 0-Zz-ang Date: Thu, 10 Jul 2025 15:56:13 +0900 Subject: 인터페이스 관련 파일 수정 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../table/integration-delete-dialog.tsx | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 lib/integration/table/integration-delete-dialog.tsx (limited to 'lib/integration/table/integration-delete-dialog.tsx') diff --git a/lib/integration/table/integration-delete-dialog.tsx b/lib/integration/table/integration-delete-dialog.tsx new file mode 100644 index 00000000..dfabd17f --- /dev/null +++ b/lib/integration/table/integration-delete-dialog.tsx @@ -0,0 +1,122 @@ +"use client"; + +import * as React from "react"; +import { Trash2, Loader2 } from "lucide-react"; + +import { Button } from "@/components/ui/button"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; +import { deleteIntegration } from "../service"; +import { toast } from "sonner"; +import type { Integration } from "../validations"; + +interface IntegrationDeleteDialogProps { + integration: Integration; + onSuccess?: () => void; +} + +export function IntegrationDeleteDialog({ integration, onSuccess }: IntegrationDeleteDialogProps) { + const [open, setOpen] = React.useState(false); + const [isLoading, setIsLoading] = React.useState(false); + + const handleOpenChange = (newOpen: boolean) => { + setOpen(newOpen); + }; + + const handleCancel = () => { + setOpen(false); + }; + + const handleDelete = async () => { + setIsLoading(true); + try { + const result = await deleteIntegration(integration.id); + if (result.success) { + toast.success("인터페이스가 성공적으로 삭제되었습니다."); + setOpen(false); + if (onSuccess) { + onSuccess(); + } + } else { + toast.error(result.error || "삭제 중 오류가 발생했습니다."); + } + } catch (error) { + console.error("인터페이스 삭제 오류:", error); + toast.error("인터페이스 삭제에 실패했습니다."); + } finally { + setIsLoading(false); + } + }; + + return ( + + + + + + + 인터페이스 삭제 + + 정말로 이 인터페이스를 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다. + + + +
+
+

삭제할 인터페이스 정보

+
+
+ 코드: {integration.code} +
+
+ 이름: {integration.name} +
+
+ 타입: {integration.type} +
+
+ 소스 시스템: {integration.sourceSystem} +
+
+ 타겟 시스템: {integration.targetSystem} +
+
+ 상태: {integration.status} +
+
+
+
+ + + + + +
+
+ ); +} \ No newline at end of file -- cgit v1.2.3