diff --git a/frontend/app/(main)/admin/dataflow/page.tsx b/frontend/app/(main)/admin/dataflow/page.tsx index 9ef77927..19914665 100644 --- a/frontend/app/(main)/admin/dataflow/page.tsx +++ b/frontend/app/(main)/admin/dataflow/page.tsx @@ -15,7 +15,6 @@ export default function DataFlowPage() { const { user } = useAuth(); const router = useRouter(); const [currentStep, setCurrentStep] = useState("list"); - const [selectedDiagram, setSelectedDiagram] = useState(null); const [stepHistory, setStepHistory] = useState(["list"]); // 단계별 제목과 설명 @@ -26,10 +25,8 @@ export default function DataFlowPage() { icon: "📊", }, design: { - title: selectedDiagram ? `${selectedDiagram.diagramName} 관계도 설계` : "새 관계도 설계", - description: selectedDiagram - ? "기존 관계도를 수정하거나 새로운 관계를 추가하세요" - : "테이블 간 데이터 관계를 시각적으로 설계하세요", + title: "새 관계도 설계", + description: "테이블 간 데이터 관계를 시각적으로 설계하세요", icon: "🎨", }, }; @@ -47,11 +44,6 @@ export default function DataFlowPage() { const previousStep = newHistory[newHistory.length - 1]; setStepHistory(newHistory); setCurrentStep(previousStep); - - // list로 돌아갈 때 선택된 관계도 초기화 - if (previousStep === "list") { - setSelectedDiagram(null); - } } }; @@ -63,11 +55,6 @@ export default function DataFlowPage() { if (stepIndex !== -1) { setStepHistory(stepHistory.slice(0, stepIndex + 1)); } - - // list로 이동할 때 선택된 관계도 초기화 - if (step === "list") { - setSelectedDiagram(null); - } }; const handleSave = (relationships: TableRelationship[]) => { @@ -78,17 +65,12 @@ export default function DataFlowPage() { }, 0); }; - const handleDiagramSelect = (diagram: DataFlowDiagram) => { - setSelectedDiagram(diagram); - }; - const handleDesignDiagram = (diagram: DataFlowDiagram | null) => { if (diagram) { // 기존 관계도 편집 - 새로운 URL로 이동 router.push(`/admin/dataflow/edit/${diagram.diagramId}`); } else { // 새 관계도 생성 - 현재 페이지에서 처리 - setSelectedDiagram(null); goToNextStep("design"); } }; @@ -121,11 +103,7 @@ export default function DataFlowPage() { {/* 관계도 목록 단계 */} {currentStep === "list" && (
- +
)} @@ -135,7 +113,7 @@ export default function DataFlowPage() { goToStep("list")} /> diff --git a/frontend/components/dataflow/ConnectionSetupModal.tsx b/frontend/components/dataflow/ConnectionSetupModal.tsx index 120aa3e6..4147b87e 100644 --- a/frontend/components/dataflow/ConnectionSetupModal.tsx +++ b/frontend/components/dataflow/ConnectionSetupModal.tsx @@ -32,6 +32,12 @@ interface ConnectionInfo { columns: string[]; }; }; + existingRelationship?: { + relationshipName: string; + relationshipType: string; + connectionType: string; + settings?: any; + }; } // 연결 설정 타입 @@ -150,14 +156,18 @@ export const ConnectionSetupModal: React.FC = ({ setSelectedFromTable(fromTableName); setSelectedToTable(toTableName); + // 기존 관계 정보가 있으면 사용, 없으면 기본값 설정 + const existingRel = connection.existingRelationship; setConfig({ - relationshipName: `${fromDisplayName} → ${toDisplayName}`, - relationshipType: "one-to-one", - connectionType: "simple-key", + relationshipName: existingRel?.relationshipName || `${fromDisplayName} → ${toDisplayName}`, + relationshipType: + (existingRel?.relationshipType as "one-to-one" | "one-to-many" | "many-to-one" | "many-to-many") || + "one-to-one", + connectionType: (existingRel?.connectionType as "simple-key" | "data-save" | "external-call") || "simple-key", fromColumnName: "", toColumnName: "", - description: `${fromDisplayName}과 ${toDisplayName} 간의 데이터 관계`, - settings: {}, + description: existingRel?.settings?.description || `${fromDisplayName}과 ${toDisplayName} 간의 데이터 관계`, + settings: existingRel?.settings || {}, }); // 단순 키값 연결 기본값 설정 diff --git a/frontend/components/dataflow/DataFlowDesigner.tsx b/frontend/components/dataflow/DataFlowDesigner.tsx index 7763bb7a..ab8f0776 100644 --- a/frontend/components/dataflow/DataFlowDesigner.tsx +++ b/frontend/components/dataflow/DataFlowDesigner.tsx @@ -101,6 +101,12 @@ export const DataFlowDesigner: React.FC = ({ columns: string[]; }; }; + existingRelationship?: { + relationshipName: string; + relationshipType: string; + connectionType: string; + settings?: any; + }; } | null>(null); const [relationships, setRelationships] = useState([]); // eslint-disable-line @typescript-eslint/no-unused-vars const [currentDiagramId, setCurrentDiagramId] = useState(null); // 현재 화면의 diagram_id @@ -989,6 +995,13 @@ export const DataFlowDesigner: React.FC = ({ columns: edgeData.toColumns, }, }, + // 기존 관계 정보 추가 (연결 이름 유지를 위해) + existingRelationship: { + relationshipName: existingRelationship.relationshipName, + relationshipType: existingRelationship.relationshipType, + connectionType: existingRelationship.connectionType, + settings: existingRelationship.settings, + }, }; // ConnectionSetupModal을 위한 연결 정보 설정 @@ -1123,8 +1136,8 @@ export const DataFlowDesigner: React.FC = ({ - {/* 선택된 컬럼 팝업 - 캔버스 좌측 상단 고정 (엣지 정보 팝업이 없을 때만 표시) */} - {Object.keys(selectedColumns).length > 0 && !showEdgeActions && ( + {/* 선택된 컬럼 팝업 - 캔버스 좌측 상단 고정 (신규 관계도 생성 시에만 표시) */} + {Object.keys(selectedColumns).length > 0 && !showEdgeActions && !pendingConnection && !diagramId && (
{/* 헤더 */}
diff --git a/frontend/components/dataflow/DataFlowList.tsx b/frontend/components/dataflow/DataFlowList.tsx index 2da1200a..5b1e3879 100644 --- a/frontend/components/dataflow/DataFlowList.tsx +++ b/frontend/components/dataflow/DataFlowList.tsx @@ -3,7 +3,6 @@ import { useState, useEffect, useCallback } from "react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; -import { Badge } from "@/components/ui/badge"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { @@ -26,12 +25,10 @@ import { toast } from "sonner"; import { useAuth } from "@/hooks/useAuth"; interface DataFlowListProps { - onDiagramSelect: (diagram: DataFlowDiagram) => void; - selectedDiagram: DataFlowDiagram | null; onDesignDiagram: (diagram: DataFlowDiagram | null) => void; } -export default function DataFlowList({ onDiagramSelect, selectedDiagram, onDesignDiagram }: DataFlowListProps) { +export default function DataFlowList({ onDesignDiagram }: DataFlowListProps) { const { user } = useAuth(); const [diagrams, setDiagrams] = useState([]); const [loading, setLoading] = useState(true); @@ -88,10 +85,6 @@ export default function DataFlowList({ onDiagramSelect, selectedDiagram, onDesig loadDiagrams(); }, [loadDiagrams]); - const handleDiagramSelect = (diagram: DataFlowDiagram) => { - onDiagramSelect(diagram); - }; - const handleDelete = (diagram: DataFlowDiagram) => { setSelectedDiagramForAction(diagram); setShowDeleteModal(true); @@ -149,38 +142,6 @@ export default function DataFlowList({ onDiagramSelect, selectedDiagram, onDesig } }; - // 연결 타입에 따른 배지 색상 - const getConnectionTypeBadge = (connectionType: string) => { - switch (connectionType) { - case "simple-key": - return ( - - 단순 키값 - - ); - case "data-save": - return ( - - 데이터 저장 - - ); - case "external-call": - return ( - - 외부 호출 - - ); - case "json-based": - return ( - - JSON 기반 - - ); - default: - return {connectionType}; - } - }; - if (loading) { return (
@@ -224,7 +185,6 @@ export default function DataFlowList({ onDiagramSelect, selectedDiagram, onDesig 관계도명 - 연결 타입 회사 코드 테이블 수 관계 수 @@ -234,13 +194,7 @@ export default function DataFlowList({ onDiagramSelect, selectedDiagram, onDesig {diagrams.map((diagram) => ( - handleDiagramSelect(diagram)} - > +
@@ -253,7 +207,6 @@ export default function DataFlowList({ onDiagramSelect, selectedDiagram, onDesig
- {getConnectionTypeBadge(diagram.connectionType)} {diagram.companyCode || "*"}