fix: TableListConfigPanel API 호출 수정 및 엔티티 컬럼 참조 테이블 로깅 추가
- fetch('/api/tables') 직접 호출을 tableTypeApi.getTables()로 변경하여 올바른 포트 사용
- 엔티티 컬럼 감지 시 reference_table/referenceTable 필드 로깅 추가
- joinTable 설정 시 두 필드 모두 확인하도록 수정
This commit is contained in:
parent
ad7f350f00
commit
4c5e0330ef
|
|
@ -6,12 +6,12 @@ const getApiBaseUrl = (): string => {
|
|||
const currentHost = window.location.hostname;
|
||||
const currentPort = window.location.port;
|
||||
|
||||
// 로컬 개발환경: localhost:9771 또는 localhost:3000 → localhost:3001
|
||||
// 로컬 개발환경: localhost:9771 또는 localhost:3000 → localhost:8080
|
||||
if (
|
||||
(currentHost === "localhost" || currentHost === "127.0.0.1") &&
|
||||
(currentPort === "9771" || currentPort === "3000")
|
||||
) {
|
||||
return "http://localhost:3001/api";
|
||||
return "http://localhost:8080/api";
|
||||
}
|
||||
|
||||
// 서버 환경에서 localhost:5555 → 39.117.244.52:8080
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import { Badge } from "@/components/ui/badge";
|
|||
import { ScrollArea } from "@/components/ui/scroll-area";
|
||||
import { TableListConfig, ColumnConfig } from "./types";
|
||||
import { entityJoinApi } from "@/lib/api/entityJoin";
|
||||
import { tableTypeApi } from "@/lib/api/screen";
|
||||
import { Plus, Trash2, ArrowUp, ArrowDown, Settings, Columns, Filter, Palette, MousePointer } from "lucide-react";
|
||||
|
||||
export interface TableListConfigPanelProps {
|
||||
|
|
@ -31,11 +32,11 @@ export const TableListConfigPanel: React.FC<TableListConfigPanelProps> = ({
|
|||
screenTableName,
|
||||
tableColumns,
|
||||
}) => {
|
||||
console.log("🔍 TableListConfigPanel props:", {
|
||||
config: config?.selectedTable,
|
||||
screenTableName,
|
||||
console.log("🔍 TableListConfigPanel props:", {
|
||||
config: config?.selectedTable,
|
||||
screenTableName,
|
||||
tableColumns: tableColumns?.length,
|
||||
tableColumnsSample: tableColumns?.[0]
|
||||
tableColumnsSample: tableColumns?.[0],
|
||||
});
|
||||
|
||||
const [availableTables, setAvailableTables] = useState<Array<{ tableName: string; displayName: string }>>([]);
|
||||
|
|
@ -92,18 +93,14 @@ export const TableListConfigPanel: React.FC<TableListConfigPanelProps> = ({
|
|||
const fetchTables = async () => {
|
||||
setLoadingTables(true);
|
||||
try {
|
||||
const response = await fetch("/api/tables");
|
||||
if (response.ok) {
|
||||
const result = await response.json();
|
||||
if (result.success && result.data) {
|
||||
setAvailableTables(
|
||||
result.data.map((table: any) => ({
|
||||
tableName: table.tableName,
|
||||
displayName: table.displayName || table.tableName,
|
||||
})),
|
||||
);
|
||||
}
|
||||
}
|
||||
// API 클라이언트를 사용하여 올바른 포트로 호출
|
||||
const response = await tableTypeApi.getTables();
|
||||
setAvailableTables(
|
||||
response.map((table: any) => ({
|
||||
tableName: table.tableName,
|
||||
displayName: table.displayName || table.tableName,
|
||||
})),
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("테이블 목록 가져오기 실패:", error);
|
||||
} finally {
|
||||
|
|
@ -327,7 +324,12 @@ export const TableListConfigPanel: React.FC<TableListConfigPanelProps> = ({
|
|||
|
||||
// 엔티티 타입인 경우 isEntityJoin 플래그 설정 (input_type 또는 web_type 확인)
|
||||
if (tableColumn && (tableColumn.input_type === "entity" || tableColumn.web_type === "entity")) {
|
||||
console.log("🎯 엔티티 컬럼 감지 및 플래그 설정:", column.columnName);
|
||||
console.log("🎯 엔티티 컬럼 감지 및 플래그 설정:", {
|
||||
columnName: column.columnName,
|
||||
referenceTable: tableColumn.reference_table,
|
||||
referenceTableAlt: tableColumn.referenceTable,
|
||||
allTableColumnKeys: Object.keys(tableColumn),
|
||||
});
|
||||
|
||||
return {
|
||||
...column,
|
||||
|
|
@ -341,7 +343,7 @@ export const TableListConfigPanel: React.FC<TableListConfigPanelProps> = ({
|
|||
displayColumns: [], // 빈 배열로 초기화
|
||||
separator: " - ",
|
||||
sourceTable: config.selectedTable || "",
|
||||
joinTable: tableColumn.reference_table || "",
|
||||
joinTable: tableColumn.reference_table || tableColumn.referenceTable || "",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue