diff --git a/frontend/components/admin/dashboard/WidgetConfigSidebar.tsx b/frontend/components/admin/dashboard/WidgetConfigSidebar.tsx index 9fcfe296..5c272ec8 100644 --- a/frontend/components/admin/dashboard/WidgetConfigSidebar.tsx +++ b/frontend/components/admin/dashboard/WidgetConfigSidebar.tsx @@ -297,10 +297,10 @@ export function WidgetConfigSidebar({ element, isOpen, onClose, onApply }: Widge ...(needsDataSource(element.subtype) ? { dataSource, - // 다중 데이터 소스 위젯은 dataSources도 포함 + // 다중 데이터 소스 위젯은 dataSources도 포함 (빈 배열도 허용 - 연결 해제) ...(isMultiDataSourceWidget ? { - dataSources: dataSources.length > 0 ? dataSources : element.dataSources || [], + dataSources: dataSources, } : {}), } @@ -316,14 +316,14 @@ export function WidgetConfigSidebar({ element, isOpen, onClose, onApply }: Widge element.subtype === "chart" || ["bar", "horizontal-bar", "pie", "line", "area", "stacked-bar", "donut", "combo"].includes(element.subtype) ? { - // 다중 데이터 소스 위젯은 chartConfig에 dataSources 포함 + // 다중 데이터 소스 위젯은 chartConfig에 dataSources 포함 (빈 배열도 허용 - 연결 해제) chartConfig: isMultiDataSourceWidget - ? { ...chartConfig, dataSources: dataSources.length > 0 ? dataSources : element.dataSources || [] } + ? { ...chartConfig, dataSources: dataSources } : chartConfig, - // 프론트엔드 호환성을 위해 dataSources도 element에 직접 포함 + // 프론트엔드 호환성을 위해 dataSources도 element에 직접 포함 (빈 배열도 허용 - 연결 해제) ...(isMultiDataSourceWidget ? { - dataSources: dataSources.length > 0 ? dataSources : element.dataSources || [], + dataSources: dataSources, } : {}), } @@ -570,15 +570,16 @@ export function WidgetConfigSidebar({ element, isOpen, onClose, onApply }: Widge onClick={handleApply} className="h-9 flex-1 text-sm" disabled={ - // 다중 데이터 소스 위젯: dataSources가 비어있거나 endpoint가 없으면 비활성화 + // 다중 데이터 소스 위젯: 데이터 소스가 있는데 endpoint가 비어있으면 비활성화 + // (데이터 소스가 없는 건 OK - 연결 해제하는 경우) (element?.subtype === "map-summary-v2" || element?.subtype === "chart" || element?.subtype === "list-v2" || element?.subtype === "custom-metric-v2" || element?.subtype === "risk-alert-v2") && - (!dataSources || - dataSources.length === 0 || - dataSources.some(ds => ds.type === "api" && !ds.endpoint)) + dataSources && + dataSources.length > 0 && + dataSources.some(ds => ds.type === "api" && !ds.endpoint) } > 적용