이력테이블 기준 컬럼 설정 기능

This commit is contained in:
kjs
2025-10-27 11:41:30 +09:00
parent 5fdefffd26
commit a3bfcdf2d8
15 changed files with 26 additions and 379 deletions

View File

@@ -39,13 +39,6 @@ export const ButtonConfigPanel: React.FC<ButtonConfigPanelProps> = ({
const config = component.componentConfig || {};
const currentAction = component.componentConfig?.action || {};
console.log("🎨 ButtonConfigPanel 렌더링:", {
componentId: component.id,
"component.componentConfig?.action?.type": component.componentConfig?.action?.type,
currentTableName: currentTableName,
"config.action?.historyTableName": config.action?.historyTableName,
});
// 로컬 상태 관리 (실시간 입력 반영)
const [localInputs, setLocalInputs] = useState({
text: config.text !== undefined ? config.text : "버튼",
@@ -140,14 +133,6 @@ export const ButtonConfigPanel: React.FC<ButtonConfigPanelProps> = ({
},
});
console.log("📋 [ButtonConfigPanel] API 응답:", {
tableName,
success: response.data.success,
hasData: !!response.data.data,
hasColumns: !!response.data.data?.columns,
totalColumns: response.data.data?.columns?.length,
});
// API 응답 구조: { success, data: { columns: [...], total, page, totalPages } }
const columnData = response.data.data?.columns;
@@ -164,28 +149,13 @@ export const ButtonConfigPanel: React.FC<ButtonConfigPanelProps> = ({
const colName = col.columnName.toLowerCase();
const dataType = col.dataType?.toLowerCase() || "";
console.log(`🔍 [필터링 체크] ${col.columnName}:`, {
colName,
dataType,
isId: colName === "id" || colName.endsWith("_id"),
hasDateInType: dataType.includes("date") || dataType.includes("time") || dataType.includes("timestamp"),
hasDateInName:
colName.includes("date") ||
colName.includes("time") ||
colName.endsWith("_at") ||
colName.startsWith("created") ||
colName.startsWith("updated"),
});
// ID 컬럼 제외 (id, _id로 끝나는 컬럼)
if (colName === "id" || colName.endsWith("_id")) {
console.log(` ❌ 제외: ID 컬럼`);
return false;
}
// 날짜/시간 타입 제외 (데이터 타입 기준)
if (dataType.includes("date") || dataType.includes("time") || dataType.includes("timestamp")) {
console.log(` ❌ 제외: 날짜/시간 타입`);
return false;
}
@@ -197,20 +167,13 @@ export const ButtonConfigPanel: React.FC<ButtonConfigPanelProps> = ({
colName.startsWith("created") ||
colName.startsWith("updated")
) {
console.log(` ❌ 제외: 날짜 관련 컬럼명`);
return false;
}
console.log(` ✅ 통과`);
return true;
})
.map((col: any) => col.columnName);
console.log("✅ [ButtonConfigPanel] 필터링된 컬럼:", {
totalFiltered: filteredColumns.length,
columns: filteredColumns,
});
setTableColumns(filteredColumns);
}
} catch (error) {
@@ -305,18 +268,12 @@ export const ButtonConfigPanel: React.FC<ButtonConfigPanelProps> = ({
key={`action-${component.id}-${component.componentConfig?.action?.type || "save"}`}
value={component.componentConfig?.action?.type || "save"}
onValueChange={(value) => {
console.log("🎯 버튼 액션 드롭다운 변경:", {
oldValue: component.componentConfig?.action?.type,
newValue: value,
});
// 🔥 action.type 업데이트
onUpdateProperty("componentConfig.action.type", value);
// 🔥 색상 업데이트는 충분히 지연 (React 리렌더링 완료 후)
setTimeout(() => {
const newColor = value === "delete" ? "#ef4444" : "#212121";
console.log("🎨 라벨 색상 업데이트:", { value, newColor });
onUpdateProperty("style.labelColor", newColor);
}, 100); // 0 → 100ms로 증가
}}
@@ -737,8 +694,8 @@ export const ButtonConfigPanel: React.FC<ButtonConfigPanelProps> = ({
<p className="mt-2 text-xs text-gray-700">
<strong> </strong> .
<br />
: <code className="rounded bg-white px-1">device_code</code> &quot; ID: 5&quot;
&quot;DTG-001 (ID: 5)&quot; .
: <code className="rounded bg-white px-1">device_code</code> &quot;DTG-001&quot;
.
<br /> .
</p>