diff --git a/frontend/components/admin/dashboard/CanvasElement.tsx b/frontend/components/admin/dashboard/CanvasElement.tsx index 9706e06b..23d51880 100644 --- a/frontend/components/admin/dashboard/CanvasElement.tsx +++ b/frontend/components/admin/dashboard/CanvasElement.tsx @@ -152,7 +152,8 @@ import { ClockWidget } from "./widgets/ClockWidget"; import { CalendarWidget } from "./widgets/CalendarWidget"; // 기사 관리 위젯 임포트 import { DriverManagementWidget } from "./widgets/DriverManagementWidget"; -// import { ListWidget } from "./widgets/ListWidget"; // (구버전 - 주석 처리: 2025-10-28, list-v2로 대체) +// 리스트 위젯 임포트 (구버전) +import { ListWidget } from "./widgets/ListWidget"; import { X } from "lucide-react"; import { Button } from "@/components/ui/button"; diff --git a/frontend/components/dashboard/widgets/CustomMetricTestWidget.tsx b/frontend/components/dashboard/widgets/CustomMetricTestWidget.tsx index eb7adf75..45459703 100644 --- a/frontend/components/dashboard/widgets/CustomMetricTestWidget.tsx +++ b/frontend/components/dashboard/widgets/CustomMetricTestWidget.tsx @@ -240,32 +240,34 @@ export default function CustomMetricTestWidget({ element }: CustomMetricTestWidg 문자열: stringColumns, }); - // 숫자 컬럼이 있으면 집계된 데이터로 판단 - if (numericColumns.length > 0) { - console.log(`✅ [${sourceName}] 집계된 데이터, 각 행을 메트릭으로 변환`); + // 🆕 각 행을 메트릭 카드로 표시 (숫자 컬럼 여부와 관계없이) + console.log(`✅ [${sourceName}] 각 행을 메트릭 카드로 변환`); - rows.forEach((row, index) => { - // 라벨: 첫 번째 문자열 컬럼 - const labelField = stringColumns[0] || columns[0]; - const label = String(row[labelField] || `항목 ${index + 1}`); + rows.forEach((row, index) => { + // 라벨: 첫 번째 컬럼 (보통 ID나 이름) + const labelField = columns[0]; + const label = String(row[labelField] || `항목 ${index + 1}`); - // 값: 첫 번째 숫자 컬럼 - const valueField = numericColumns[0] || columns[1] || columns[0]; - const value = Number(row[valueField]) || 0; + // 값: 숫자 컬럼이 있으면 사용, 없으면 행 번호 + const valueField = numericColumns.length > 0 ? numericColumns[0] : null; + const value = valueField ? Number(row[valueField]) || 0 : index + 1; - console.log(` [${sourceName}] 메트릭: ${label} = ${value}`); + console.log(` [${sourceName}] 메트릭: ${label} = ${value}`); - allMetrics.push({ - label: `${sourceName} - ${label}`, - value: value, - field: valueField, - aggregation: "custom", - color: colors[allMetrics.length % colors.length], - sourceName: sourceName, - rawData: rows, // 원본 데이터 저장 - }); + allMetrics.push({ + label: label, + value: value, + field: valueField || labelField, + aggregation: "custom", + color: colors[allMetrics.length % colors.length], + sourceName: sourceName, + rawData: [row], // 🆕 해당 행만 저장 (상세보기용) + fullData: rows, // 🆕 전체 데이터도 저장 }); - } else { + }); + + // 🆕 숫자 컬럼이 없을 때의 기존 로직은 주석 처리 + if (false) { // 숫자 컬럼이 없으면 각 컬럼별 고유값 개수 표시 console.log(`📊 [${sourceName}] 문자열 데이터, 각 컬럼별 고유값 개수 표시`);