[DASHBOARDS] Dashboard duplication (#16291)

## Description

- Created a Dashboard duplication action
- Created a new duplication custom resolver
- Created the service using the v2 of the API
- Created the integration tests following the v2 methodology

## Video QA


https://github.com/user-attachments/assets/e409951a-5946-4da0-91a0-1f7d2ecadb08
This commit is contained in:
Raphaël Bosi
2025-12-11 12:15:15 +01:00
committed by GitHub
parent 6c728fff78
commit 5af2d37253
39 changed files with 1542 additions and 79 deletions
@@ -4,6 +4,7 @@ import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDr
import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState';
import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget';
import { addWidgetToTab } from '@/page-layout/utils/addWidgetToTab';
import { generateDuplicatedTimestamps } from '@/page-layout/utils/generateDuplicatedTimestamps';
import { getScrollWrapperInstanceIdFromPageLayoutId } from '@/page-layout/utils/getScrollWrapperInstanceIdFromPageLayoutId';
import { getUpdatedTabLayouts } from '@/page-layout/utils/getUpdatedTabLayouts';
import { useScrollWrapperHTMLElement } from '@/ui/utilities/scroll/hooks/useScrollWrapperHTMLElement';
@@ -11,10 +12,8 @@ import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/com
import { useRecoilComponentCallbackState } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentCallbackState';
import { useSetRecoilComponentState } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentState';
import { useRecoilCallback } from 'recoil';
import { isDefined } from 'twenty-shared/utils';
import { appendCopySuffix, isDefined } from 'twenty-shared/utils';
import { v4 as uuidv4 } from 'uuid';
import { generateDuplicatedTimestamps } from '../utils/generateDuplicatedTimestamps';
import { getDuplicatedTitle } from '../utils/getDuplicatedTitle';
export const useDuplicatePageLayoutWidget = (
pageLayoutIdFromProps?: string,
@@ -77,7 +76,7 @@ export const useDuplicatePageLayoutWidget = (
const clonedWidget: PageLayoutWidget = {
...sourceWidget,
id: newWidgetId,
title: getDuplicatedTitle(sourceWidget.title),
title: appendCopySuffix(sourceWidget.title),
...generateDuplicatedTimestamps(),
};