[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
@@ -103,6 +103,7 @@ export { removeUndefinedFields } from './removeUndefinedFields';
export { safeParseRelativeDateFilterJSONStringified } from './safeParseRelativeDateFilterJSONStringified';
export { getGenericOperationName } from './sentry/getGenericOperationName';
export { getHumanReadableNameFromCode } from './sentry/getHumanReadableNameFromCode';
export { appendCopySuffix } from './strings/appendCopySuffix';
export { capitalize } from './strings/capitalize';
export { uncapitalize } from './strings/uncapitalize';
export type {
@@ -0,0 +1,15 @@
import { appendCopySuffix } from '@/utils/strings/appendCopySuffix';
describe('appendCopySuffix', () => {
it('should add (Copy) suffix to a string', () => {
expect(appendCopySuffix('My Dashboard')).toBe('My Dashboard (Copy)');
});
it('should not add (Copy) suffix if string already ends with (Copy)', () => {
expect(appendCopySuffix('My Dashboard (Copy)')).toBe('My Dashboard (Copy)');
});
it('should not add (Copy) suffix if string ends with (copy) - case insensitive', () => {
expect(appendCopySuffix('My Dashboard (copy)')).toBe('My Dashboard (copy)');
});
});
@@ -0,0 +1,16 @@
import { isNonEmptyString } from '@sniptt/guards';
const COPY_SUFFIX = '(Copy)';
const COPY_SUFFIX_LOWERCASE = '(copy)';
export const appendCopySuffix = (value: string): string => {
if (!isNonEmptyString(value)) {
return value;
}
if (value.toLowerCase().endsWith(COPY_SUFFIX_LOWERCASE)) {
return value;
}
return `${value} ${COPY_SUFFIX}`;
};
@@ -1 +1,2 @@
export * from './appendCopySuffix';
export * from './capitalize';