From 210a4ec62d8e1cde2b207c49a68e10e1d6f59624 Mon Sep 17 00:00:00 2001 From: hyeonsu Date: Fri, 19 Sep 2025 10:26:57 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A0=9C=EC=96=B4=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=EC=BA=94=EB=B2=84=EC=8A=A4=20=ED=85=8C=EC=9D=B4=EB=B8=94=20?= =?UTF-8?q?=EB=B0=8F=20=EC=BB=AC=EB=9F=BC=20db=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EA=B0=80=EC=A0=B8=EC=98=A4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/dataflow/DataFlowDesigner.tsx | 8 +++- frontend/components/dataflow/TableNode.tsx | 23 +++++++---- frontend/lib/api/dataflow.ts | 40 +++++++++++++++++-- 3 files changed, 57 insertions(+), 14 deletions(-) diff --git a/frontend/components/dataflow/DataFlowDesigner.tsx b/frontend/components/dataflow/DataFlowDesigner.tsx index 7ebe19ab..f3a5372f 100644 --- a/frontend/components/dataflow/DataFlowDesigner.tsx +++ b/frontend/components/dataflow/DataFlowDesigner.tsx @@ -284,8 +284,12 @@ export const DataFlowDesigner: React.FC = ({ description: "", // 새로 추가된 노드는 description 없이 통일 columns: Array.isArray(table.columns) ? table.columns.map((col) => ({ - name: col.columnName || "unknown", - type: col.dataType || "varchar", // 기존과 동일한 기본값 사용 + columnName: col.columnName || "unknown", + name: col.columnName || "unknown", // 호환성을 위해 유지 + displayName: col.displayName, // 한국어 라벨 + columnLabel: col.columnLabel, // 한국어 라벨 + type: col.dataType || "varchar", + dataType: col.dataType || "varchar", description: col.description || "", })) : [], diff --git a/frontend/components/dataflow/TableNode.tsx b/frontend/components/dataflow/TableNode.tsx index bbe7f88b..67fdf8b0 100644 --- a/frontend/components/dataflow/TableNode.tsx +++ b/frontend/components/dataflow/TableNode.tsx @@ -4,9 +4,13 @@ import React from "react"; import { Handle, Position } from "@xyflow/react"; interface TableColumn { - name: string; - type: string; - description: string; + columnName: string; + name?: string; // 호환성을 위해 유지 + columnLabel?: string; + displayName?: string; + dataType?: string; + type?: string; // 호환성을 위해 유지 + description?: string; } interface Table { @@ -43,21 +47,24 @@ export const TableNode: React.FC<{ data: TableNodeData }> = ({ data }) => {
{table.columns.map((column) => { - const isSelected = selectedColumns.includes(column.name); + const columnKey = column.columnName || column.name || ""; + const columnDisplayName = column.displayName || column.columnLabel || column.name || column.columnName; + const columnType = column.dataType || column.type || ""; + const isSelected = selectedColumns.includes(columnKey); return (
onColumnClick(table.tableName, column.name)} + onClick={() => onColumnClick(table.tableName, columnKey)} > {/* 핸들 제거됨 - 컬럼 클릭으로만 연결 생성 */}
- {column.name} - {column.type} + {columnDisplayName} + {columnType}
{column.description &&
{column.description}
}
diff --git a/frontend/lib/api/dataflow.ts b/frontend/lib/api/dataflow.ts index c40f1a3b..2e5610a5 100644 --- a/frontend/lib/api/dataflow.ts +++ b/frontend/lib/api/dataflow.ts @@ -376,7 +376,13 @@ export class DataFlowAPI { } // 페이지네이션된 응답에서 columns 배열만 추출 - return response.data.data?.columns || []; + const columns = response.data.data?.columns || []; + + // 이미 displayName에 라벨이 포함되어 있으므로 추가 처리 불필요 + return columns.map((column) => ({ + ...column, + columnLabel: column.displayName || column.columnName, // displayName을 columnLabel로도 설정 + })); } catch (error) { console.error("컬럼 정보 조회 오류:", error); throw error; @@ -390,11 +396,37 @@ export class DataFlowAPI { try { const columns = await this.getTableColumns(tableName); + // 테이블 라벨 정보 조회 + let tableLabel = tableName; + let tableDescription = `${tableName} 테이블`; + + try { + const response = await apiClient.get(`/table-management/tables/${tableName}/labels`); + if (response.data.success && response.data.data) { + tableLabel = response.data.data.tableLabel || tableName; + tableDescription = response.data.data.description || `${tableName} 테이블`; + } + } catch { + // 라벨 정보가 없으면 기본값 사용 + console.log(`테이블 라벨 정보 없음: ${tableName}`); + } + + // TableNode가 기대하는 컬럼 구조로 변환 + const formattedColumns = columns.map((column) => ({ + columnName: column.columnName, + name: column.columnName, // TableNode에서 사용하는 필드 + displayName: column.displayName, // 한국어 라벨 + columnLabel: column.displayName, // 동일한 값으로 설정 + type: column.dataType, // TableNode에서 사용하는 필드 + dataType: column.dataType, + description: column.description || "", + })); + return { tableName, - displayName: tableName, - description: `${tableName} 테이블`, - columns, + displayName: tableLabel, + description: tableDescription, + columns: formattedColumns, }; } catch (error) { console.error("테이블 및 컬럼 정보 조회 오류:", error);