디버깅용 console.log 삭제

This commit is contained in:
dohyeons 2025-11-04 18:02:20 +09:00
parent acaa3414d2
commit 63b6e89435
2 changed files with 0 additions and 80 deletions

View File

@ -243,9 +243,6 @@ export const uploadFiles = async (
} else {
finalTargetObjid = `${linkedTable}:${recordId}`;
}
console.log("📎 autoLink 적용:", { original: targetObjid, final: finalTargetObjid });
} else if (isTemplateFile) {
console.log("🎨 템플릿 파일이므로 targetObjid 유지:", targetObjid);
}
const savedFiles = [];

View File

@ -148,12 +148,6 @@ const FileUploadComponent: React.FC<FileUploadComponentProps> = ({
// 현재 컴포넌트와 일치하고 화면설계 모드에서 온 이벤트인 경우
if (event.detail.componentId === component.id && event.detail.source === "designMode") {
console.log("✅✅✅ 화면설계 모드 → 실제 화면 파일 동기화 시작:", {
componentId: component.id,
filesCount: event.detail.files?.length || 0,
action: event.detail.action,
});
// 파일 상태 업데이트
const newFiles = event.detail.files || [];
setUploadedFiles(newFiles);
@ -216,14 +210,12 @@ const FileUploadComponent: React.FC<FileUploadComponentProps> = ({
const screenMatch = pathname.match(/\/screens\/(\d+)/);
if (screenMatch) {
screenId = parseInt(screenMatch[1]);
console.log("📂 URL에서 화면 ID 추출:", screenId);
}
}
// 3. 디자인 모드인 경우 임시 화면 ID 사용
if (!screenId && isDesignMode) {
screenId = 999999; // 디자인 모드 임시 ID
console.log("📂 디자인 모드: 임시 화면 ID 사용 (999999)");
}
// 4. 화면 ID가 없으면 컴포넌트 ID만으로 조회 시도
@ -245,18 +237,9 @@ const FileUploadComponent: React.FC<FileUploadComponentProps> = ({
columnName: component.columnName || component.id, // 🔑 columnName이 없으면 component.id 사용
};
console.log("📂 컴포넌트 파일 조회:", params);
const response = await getComponentFiles(params);
if (response.success) {
console.log("📁 파일 조회 결과:", {
templateFiles: response.templateFiles.length,
dataFiles: response.dataFiles.length,
totalFiles: response.totalFiles.length,
summary: response.summary,
actualFiles: response.totalFiles,
});
// 파일 데이터 형식 통일
const formattedFiles = response.totalFiles.map((file: any) => ({
@ -271,7 +254,6 @@ const FileUploadComponent: React.FC<FileUploadComponentProps> = ({
...file,
}));
console.log("📁 형식 변환된 파일 데이터:", formattedFiles);
// 🔄 localStorage의 기존 파일과 서버 파일 병합
let finalFiles = formattedFiles;
@ -287,13 +269,6 @@ const FileUploadComponent: React.FC<FileUploadComponentProps> = ({
finalFiles = [...formattedFiles, ...additionalFiles];
console.log("🔄 파일 병합 완료:", {
서버파일: formattedFiles.length,
로컬파일: parsedBackupFiles.length,
추가파일: additionalFiles.length,
최종파일: finalFiles.length,
최종파일목록: finalFiles.map((f: any) => ({ objid: f.objid, name: f.realFileName })),
});
}
} catch (e) {
console.warn("파일 병합 중 오류:", e);
@ -319,7 +294,6 @@ const FileUploadComponent: React.FC<FileUploadComponentProps> = ({
try {
const backupKey = `fileUpload_${component.id}`;
localStorage.setItem(backupKey, JSON.stringify(finalFiles));
console.log("💾 localStorage 백업 업데이트 완료:", finalFiles.length);
} catch (e) {
console.warn("localStorage 백업 업데이트 실패:", e);
}
@ -348,12 +322,10 @@ const FileUploadComponent: React.FC<FileUploadComponentProps> = ({
// 🔒 항상 DB에서 최신 파일 목록을 조회 (멀티테넌시 격리)
loadComponentFiles().then((dbLoadSuccess) => {
if (dbLoadSuccess) {
console.log("✅ DB에서 파일 로드 성공 (멀티테넌시 적용)");
return; // DB 로드 성공 시 localStorage 무시
}
// DB 로드 실패 시에만 기존 로직 사용 (하위 호환성)
console.log("📂 DB 로드 실패, 기존 로직 사용");
// 전역 상태에서 최신 파일 정보 가져오기
const globalFileState = typeof window !== "undefined" ? (window as any).globalFileState || {} : {};
@ -362,23 +334,9 @@ const FileUploadComponent: React.FC<FileUploadComponentProps> = ({
// 최신 파일 정보 사용 (전역 상태 > 컴포넌트 속성)
const currentFiles = globalFiles.length > 0 ? globalFiles : componentFiles;
console.log("🔄 FileUploadComponent 파일 동기화:", {
componentId: component.id,
componentFiles: componentFiles.length,
globalFiles: globalFiles.length,
currentFiles: currentFiles.length,
uploadedFiles: uploadedFiles.length,
lastUpdate: lastUpdate,
});
// 최신 파일과 현재 파일 비교
if (JSON.stringify(currentFiles) !== JSON.stringify(uploadedFiles)) {
console.log("🔄 useEffect에서 파일 목록 변경 감지:", {
currentFiles: currentFiles.length,
uploadedFiles: uploadedFiles.length,
currentFilesData: currentFiles.map((f: any) => ({ objid: f.objid, name: f.realFileName })),
uploadedFilesData: uploadedFiles.map((f) => ({ objid: f.objid, name: f.realFileName })),
});
setUploadedFiles(currentFiles);
setForceUpdate((prev) => prev + 1);
}
@ -476,28 +434,15 @@ const FileUploadComponent: React.FC<FileUploadComponentProps> = ({
const duplicates: string[] = [];
const uniqueFiles: File[] = [];
console.log("🔍 중복 파일 체크:", {
uploadedFiles: uploadedFiles.length,
existingFileNames: existingFileNames,
newFiles: files.map((f) => f.name.toLowerCase()),
});
files.forEach((file) => {
const fileName = file.name.toLowerCase();
if (existingFileNames.includes(fileName)) {
duplicates.push(file.name);
console.log("❌ 중복 파일 발견:", file.name);
} else {
uniqueFiles.push(file);
console.log("✅ 새로운 파일:", file.name);
}
});
console.log("🔍 중복 체크 결과:", {
duplicates: duplicates,
uniqueFiles: uniqueFiles.map((f) => f.name),
});
if (duplicates.length > 0) {
toast.error(`중복된 파일이 있습니다: ${duplicates.join(", ")}`, {
description: "같은 이름의 파일이 이미 업로드되어 있습니다.",
@ -543,7 +488,6 @@ const FileUploadComponent: React.FC<FileUploadComponentProps> = ({
} else if (screenId) {
// 🔑 템플릿 파일 (백엔드 조회 형식과 동일하게)
targetObjid = `screen_files:${screenId}:${component.id}:${columnName}`;
console.log("🎨 템플릿 파일 업로드:", { targetObjid, screenId, componentId: component.id, columnName });
} else {
// 기본값 (화면관리에서 사용)
targetObjid = `temp_${component.id}`;
@ -569,30 +513,16 @@ const FileUploadComponent: React.FC<FileUploadComponentProps> = ({
targetObjid: targetObjid, // InteractiveDataTable 호환을 위한 targetObjid 추가
};
console.log("📤 파일 업로드 시작:", {
originalFiles: files.length,
filesToUpload: filesToUpload.length,
files: filesToUpload.map((f) => ({ name: f.name, size: f.size })),
uploadData,
});
const response = await uploadFiles({
files: filesToUpload,
...uploadData,
});
console.log("📤 파일 업로드 API 응답:", response);
if (response.success) {
// FileUploadResponse 타입에 맞게 files 배열 사용
const fileData = response.files || (response as any).data || [];
console.log("📁 파일 데이터 확인:", {
hasFiles: !!response.files,
hasData: !!(response as any).data,
fileDataLength: fileData.length,
fileData: fileData,
responseKeys: Object.keys(response),
});
if (fileData.length === 0) {
throw new Error("업로드된 파일 데이터를 받지 못했습니다.");
@ -617,15 +547,8 @@ const FileUploadComponent: React.FC<FileUploadComponentProps> = ({
...file,
}));
console.log("📁 변환된 파일 데이터:", newFiles);
const updatedFiles = [...uploadedFiles, ...newFiles];
console.log("🔄 파일 상태 업데이트:", {
이전파일수: uploadedFiles.length,
새파일수: newFiles.length,
총파일수: updatedFiles.length,
updatedFiles: updatedFiles.map((f) => ({ objid: f.objid, name: f.realFileName })),
});
setUploadedFiles(updatedFiles);
setUploadStatus("success");