"use client"; import React from "react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Plus, Save, Trash2 } from "lucide-react"; import { TableInfo, ColumnInfo } from "@/lib/api/dataflow"; import { DataSaveSettings as DataSaveSettingsType } from "@/types/connectionTypes"; import { ActionConditionsSection } from "./ActionConditionsSection"; import { ActionFieldMappings } from "./ActionFieldMappings"; import { ActionSplitConfig } from "./ActionSplitConfig"; interface DataSaveSettingsProps { settings: DataSaveSettingsType; onSettingsChange: (settings: DataSaveSettingsType) => void; availableTables: TableInfo[]; fromTableColumns: ColumnInfo[]; toTableColumns: ColumnInfo[]; tableColumnsCache: { [tableName: string]: ColumnInfo[] }; } export const DataSaveSettings: React.FC = ({ settings, onSettingsChange, availableTables, fromTableColumns, toTableColumns, tableColumnsCache, }) => { const addAction = () => { const newAction = { id: `action_${settings.actions.length + 1}`, name: `액션 ${settings.actions.length + 1}`, actionType: "insert" as const, fieldMappings: [], conditions: [], splitConfig: { sourceField: "", delimiter: "", targetField: "", }, }; onSettingsChange({ ...settings, actions: [...settings.actions, newAction], }); }; const updateAction = (actionIndex: number, field: string, value: any) => { const newActions = [...settings.actions]; (newActions[actionIndex] as any)[field] = value; onSettingsChange({ ...settings, actions: newActions }); }; const removeAction = (actionIndex: number) => { const newActions = settings.actions.filter((_, i) => i !== actionIndex); onSettingsChange({ ...settings, actions: newActions }); }; return (
데이터 저장 설정
{/* 액션 목록 */}
{settings.actions.length === 0 ? (
저장 액션을 추가하여 데이터를 어떻게 저장할지 설정하세요.
) : (
{settings.actions.map((action, actionIndex) => (
updateAction(actionIndex, "name", e.target.value)} className="h-7 flex-1 text-xs font-medium" placeholder="액션 이름" />
{/* 액션 타입 */}
{/* 액션별 개별 실행 조건 */} {/* 데이터 분할 설정 */} {/* 필드 매핑 */}
))}
)}
); };