Compare commits

..

No commits in common. "7039cca1cf00af3321b11b4c42556141bfb42ab8" and "147d187901ea79bb21233fa6261a7028a6bbc998" have entirely different histories.

1 changed files with 4 additions and 26 deletions

View File

@ -1418,7 +1418,7 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
// 수정 버튼 핸들러
const handleEditClick = useCallback(
async (panel: "left" | "right", item: any) => {
(panel: "left" | "right", item: any) => {
// 🆕 우측 패널 수정 버튼 설정 확인
if (panel === "right" && componentConfig.rightPanel?.editButton?.mode === "modal") {
const modalScreenId = componentConfig.rightPanel?.editButton?.modalScreenId;
@ -1427,40 +1427,18 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
// 커스텀 모달 화면 열기
const rightTableName = componentConfig.rightPanel?.tableName || "";
// Primary Key 찾기: 테이블 메타데이터에서 실제 PK 컬럼 조회
// Primary Key 찾기 (우선순위: id > ID > 첫 번째 필드)
let primaryKeyName = "id";
let primaryKeyValue: any;
// 1. 테이블 컬럼 메타데이터에서 실제 PK 찾기
let pkColumn = rightTableColumns.find(
(col) => col.isPrimaryKey === true || col.is_primary_key === true || col.is_primary_key === "YES"
);
// 2. rightTableColumns가 비어있으면 API로 직접 조회
if (!pkColumn && rightTableColumns.length === 0 && rightTableName) {
try {
const columnsResponse = await tableTypeApi.getColumns(rightTableName);
pkColumn = columnsResponse?.find(
(col: any) => col.isPrimaryKey === true || col.is_primary_key === true || col.is_primary_key === "YES"
);
} catch (error) {
console.error("PK 컬럼 조회 실패:", error);
}
}
if (pkColumn) {
const pkName = pkColumn.columnName || pkColumn.column_name;
primaryKeyName = pkName;
primaryKeyValue = item[pkName];
} else if (item.id !== undefined && item.id !== null) {
// 3. 폴백: id 컬럼
if (item.id !== undefined && item.id !== null) {
primaryKeyName = "id";
primaryKeyValue = item.id;
} else if (item.ID !== undefined && item.ID !== null) {
primaryKeyName = "ID";
primaryKeyValue = item.ID;
} else {
// 4. 최후의 폴백: 첫 번째 필드
// 첫 번째 필드를 Primary Key로 간주
const firstKey = Object.keys(item)[0];
primaryKeyName = firstKey;
primaryKeyValue = item[firstKey];