대시보드 복제 기능 구현

This commit is contained in:
dohyeons
2025-10-16 17:27:03 +09:00
parent 317b4ed1e7
commit 7155f76345

View File

@@ -67,13 +67,17 @@ export default function DashboardListPage() {
// 대시보드 복사 // 대시보드 복사
const handleCopy = async (dashboard: Dashboard) => { const handleCopy = async (dashboard: Dashboard) => {
try { try {
// 전체 대시보드 정보(요소 포함)를 가져오기
const fullDashboard = await dashboardApi.getDashboard(dashboard.id);
const newDashboard = await dashboardApi.createDashboard({ const newDashboard = await dashboardApi.createDashboard({
title: `${dashboard.title} (복사본)`, title: `${fullDashboard.title} (복사본)`,
description: dashboard.description, description: fullDashboard.description,
elements: dashboard.elements || [], elements: fullDashboard.elements || [],
isPublic: false, isPublic: false,
tags: dashboard.tags, tags: fullDashboard.tags,
category: dashboard.category, category: fullDashboard.category,
settings: (fullDashboard as any).settings, // 해상도와 배경색 설정도 복사
}); });
alert("대시보드가 복사되었습니다."); alert("대시보드가 복사되었습니다.");
loadDashboards(); loadDashboards();