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