api 오류 수정

This commit is contained in:
dohyeons
2025-10-29 11:52:18 +09:00
parent f62af9077a
commit 8edd5e4ca6
10 changed files with 26 additions and 13 deletions

View File

@@ -5,6 +5,7 @@ import { DashboardElement, ChartDataSource } from "@/components/admin/dashboard/
import { Button } from "@/components/ui/button";
import { Loader2, RefreshCw } from "lucide-react";
import { applyColumnMapping } from "@/lib/utils/columnMapping";
import { getApiUrl } from "@/lib/utils/apiUrl";
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
@@ -241,8 +242,8 @@ export default function CustomMetricTestWidget({ element }: CustomMetricTestWidg
});
// 🆕 자동 집계 로직: 집계 컬럼 이름으로 판단 (count, 개수, sum, avg 등)
const isAggregated = numericColumns.some((col) =>
/count|개수|sum|합계|avg|평균|min|최소|max|최대|total|전체/i.test(col)
const isAggregated = numericColumns.some((col) =>
/count|개수|sum|합계|avg|평균|min|최소|max|최대|total|전체/i.test(col),
);
if (isAggregated && numericColumns.length > 0) {
@@ -553,7 +554,7 @@ export default function CustomMetricTestWidget({ element }: CustomMetricTestWidg
console.log("🌐 API 호출:", source.endpoint, "파라미터:", Object.fromEntries(params));
const response = await fetch("http://localhost:8080/api/dashboards/fetch-external-api", {
const response = await fetch(getApiUrl("/api/dashboards/fetch-external-api"), {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -746,7 +747,10 @@ export default function CustomMetricTestWidget({ element }: CustomMetricTestWidg
return (
<div className="flex h-full w-full flex-col bg-white p-2">
{/* 콘텐츠 영역 - 스크롤 가능하도록 개선 */}
<div className="grid w-full gap-2 overflow-y-auto" style={{ gridTemplateColumns: "repeat(auto-fit, minmax(140px, 1fr))" }}>
<div
className="grid w-full gap-2 overflow-y-auto"
style={{ gridTemplateColumns: "repeat(auto-fit, minmax(140px, 1fr))" }}
>
{/* 그룹별 카드 (활성화 시) */}
{isGroupByMode &&
groupedCards.map((card, index) => {