통계 카드 작동하도록 고침
This commit is contained in:
@@ -144,7 +144,7 @@ export function WidgetConfigSidebar({ element, isOpen, onClose, onApply }: Widge
|
||||
const [chartConfig, setChartConfig] = useState<ChartConfig>({});
|
||||
|
||||
// 커스텀 메트릭 설정
|
||||
const [customMetricConfig, setCustomMetricConfig] = useState<CustomMetricConfig>({ metrics: [] });
|
||||
const [customMetricConfig, setCustomMetricConfig] = useState<CustomMetricConfig>({});
|
||||
|
||||
// 사이드바 열릴 때 초기화
|
||||
useEffect(() => {
|
||||
@@ -175,7 +175,7 @@ export function WidgetConfigSidebar({ element, isOpen, onClose, onApply }: Widge
|
||||
setChartConfig(element.chartConfig || {});
|
||||
|
||||
// 커스텀 메트릭 설정 초기화
|
||||
setCustomMetricConfig(element.customMetricConfig || { metrics: [] });
|
||||
setCustomMetricConfig(element.customMetricConfig || {});
|
||||
} else if (!isOpen) {
|
||||
// 사이드바 닫힐 때 초기화
|
||||
setCustomTitle("");
|
||||
@@ -194,7 +194,7 @@ export function WidgetConfigSidebar({ element, isOpen, onClose, onApply }: Widge
|
||||
cardColumns: 3,
|
||||
});
|
||||
setChartConfig({});
|
||||
setCustomMetricConfig({ metrics: [] });
|
||||
setCustomMetricConfig({});
|
||||
}
|
||||
}, [isOpen, element]);
|
||||
|
||||
@@ -336,6 +336,12 @@ export function WidgetConfigSidebar({ element, isOpen, onClose, onApply }: Widge
|
||||
: {}),
|
||||
};
|
||||
|
||||
console.log("🔧 [WidgetConfigSidebar] handleApply 호출:", {
|
||||
subtype: element.subtype,
|
||||
customMetricConfig,
|
||||
updatedElement,
|
||||
});
|
||||
|
||||
onApply(updatedElement);
|
||||
onClose();
|
||||
}, [
|
||||
@@ -431,9 +437,7 @@ export function WidgetConfigSidebar({ element, isOpen, onClose, onApply }: Widge
|
||||
<TabsContent value="data" className="mt-0 flex-1 overflow-y-auto p-3">
|
||||
<div className="space-y-3">
|
||||
{/* 데이터 소스 선택 - 단일 데이터 소스 위젯에만 표시 */}
|
||||
{!["map-summary-v2", "chart", "list-v2", "custom-metric-v2", "risk-alert-v2"].includes(
|
||||
element.subtype,
|
||||
) && (
|
||||
{!["map-summary-v2", "chart", "risk-alert-v2"].includes(element.subtype) && (
|
||||
<div className="bg-background rounded-lg p-3 shadow-sm">
|
||||
<Label className="mb-2 block text-xs font-semibold">데이터 소스</Label>
|
||||
|
||||
@@ -478,9 +482,9 @@ export function WidgetConfigSidebar({ element, isOpen, onClose, onApply }: Widge
|
||||
)}
|
||||
|
||||
{/* 다중 데이터 소스 설정 */}
|
||||
{["map-summary-v2", "chart", "list-v2", "custom-metric-v2", "risk-alert-v2"].includes(
|
||||
element.subtype,
|
||||
) && <MultiDataSourceConfig dataSources={dataSources} onChange={handleDataSourcesChange} />}
|
||||
{["map-summary-v2", "chart", "risk-alert-v2"].includes(element.subtype) && (
|
||||
<MultiDataSourceConfig dataSources={dataSources} onChange={handleDataSourcesChange} />
|
||||
)}
|
||||
|
||||
{/* 위젯별 커스텀 섹션 */}
|
||||
{element.subtype === "list-v2" && (
|
||||
|
||||
Reference in New Issue
Block a user