이력테이블 기준 컬럼 설정 기능
This commit is contained in:
@@ -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>를 설정하면 "레코드 ID: 5"
|
||||
대신 "DTG-001 (ID: 5)"로 표시됩니다.
|
||||
예: <code className="rounded bg-white px-1">device_code</code>를 설정하면 이력에 "DTG-001"로
|
||||
표시됩니다.
|
||||
<br />이 컬럼으로 검색도 가능합니다.
|
||||
</p>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user