제어관리 캔버스 테이블 및 컬럼 db에서 가져오기

This commit is contained in:
hyeonsu
2025-09-19 10:26:57 +09:00
parent c679bacabc
commit 210a4ec62d
3 changed files with 57 additions and 14 deletions

View File

@@ -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);