diff --git a/frontend/components/dataflow/connection/redesigned/DataConnectionDesigner.tsx b/frontend/components/dataflow/connection/redesigned/DataConnectionDesigner.tsx index 604b29f1..8c5514c3 100644 --- a/frontend/components/dataflow/connection/redesigned/DataConnectionDesigner.tsx +++ b/frontend/components/dataflow/connection/redesigned/DataConnectionDesigner.tsx @@ -1,17 +1,46 @@ "use client"; -import React, { useState } from "react"; -import { ConnectionTypeSelector } from "./LeftPanel/ConnectionTypeSelector"; -import { MappingInfoPanel } from "./LeftPanel/MappingInfoPanel"; -import { StepProgress } from "./RightPanel/StepProgress"; -import { ConnectionStep } from "./RightPanel/ConnectionStep"; -import { TableStep } from "./RightPanel/TableStep"; -import { FieldMappingStep } from "./RightPanel/FieldMappingStep"; -import { DataConnectionState } from "./types/redesigned"; -import { ResponsiveContainer, ResponsiveGrid } from "@/components/layout/ResponsiveContainer"; -import { useResponsive } from "@/lib/hooks/useResponsive"; +import React, { useState, useCallback, useEffect } from "react"; +import { Card } from "@/components/ui/card"; +import { Button } from "@/components/ui/button"; +import { toast } from "sonner"; +import { X, ArrowLeft } from "lucide-react"; -const initialState: DataConnectionState = { +// API import +import { saveDataflowRelationship, checkRelationshipNameDuplicate } from "@/lib/api/dataflowSave"; +import { getColumnsFromConnection } from "@/lib/api/multiConnection"; + +// 타입 import +import { + DataConnectionState, + DataConnectionActions, + DataConnectionDesignerProps, + FieldMapping, + ValidationResult, + TestResult, + MappingStats, + ActionGroup, + SingleAction, +} from "./types/redesigned"; +import { ColumnInfo, Connection, TableInfo } from "@/lib/types/multiConnection"; + +// 컴포넌트 import +import LeftPanel from "./LeftPanel/LeftPanel"; +import RightPanel from "./RightPanel/RightPanel"; + +/** + * 🎨 데이터 연결 설정 메인 디자이너 + * - 좌우 분할 레이아웃 (30% + 70%) + * - 상태 관리 및 액션 처리 + * - 기존 모달 기능을 메인 화면으로 통합 + */ +const DataConnectionDesigner: React.FC = ({ + onClose, + initialData, + showBackButton = false, +}) => { + // 🔄 상태 관리 + const [state, setState] = useState(() => ({ connectionType: "data_save", currentStep: 1, fieldMappings: [], @@ -23,6 +52,34 @@ const initialState: DataConnectionState = { estimatedRows: 0, actionType: "INSERT", }, + // 제어 실행 조건 초기값 + controlConditions: [], + + // 액션 그룹 초기값 (멀티 액션) + actionGroups: [ + { + id: "group_1", + name: "기본 액션 그룹", + logicalOperator: "AND" as const, + actions: [ + { + id: "action_1", + name: "액션 1", + actionType: "insert" as const, + conditions: [], + fieldMappings: [], + isEnabled: true, + }, + ], + isEnabled: true, + }, + ], + groupsLogicalOperator: "AND" as "AND" | "OR", + + // 기존 호환성 필드들 (deprecated) + actionType: "insert", + actionConditions: [], + actionFieldMappings: [], isLoading: false, validationErrors: [], @@ -720,30 +777,23 @@ const initialState: DataConnectionState = { }; return ( -
-
-

- 🎨 제어관리 - 데이터 연결 설정 -

-

- 시각적 필드 매핑으로 데이터 연결을 쉽게 설정하세요 +

+ {/* 상단 네비게이션 */} + {showBackButton && ( +
+
+
+ +
+

🔗 데이터 연결 설정

+

+ {state.connectionType === "data_save" ? "데이터 저장" : "외부 호출"} 연결 설정

- -
-
- setState(prev => ({ ...prev, connectionType: type }))} - /> - -
- setState(prev => ({ ...prev, selectedMapping: mappingId }))} - /> +
)}