diff --git a/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/EnvironmentRow/index.js b/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/EnvironmentRow/index.js index 217a69771dd..6be9640c7ea 100644 --- a/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/EnvironmentRow/index.js +++ b/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/EnvironmentRow/index.js @@ -1,25 +1,8 @@ import React, { memo } from 'react'; import { ResolutionButton } from '../ReviewStep/StyledWrapper'; -import { RESOLUTION_TYPES, RESOLUTION_LABELS, RESOLUTION_SHORT_LABELS } from '../utils'; - -const RESOLUTION_OPTIONS = [ - { - value: RESOLUTION_TYPES.COPY, - label: RESOLUTION_LABELS[RESOLUTION_TYPES.COPY], - shortLabel: RESOLUTION_SHORT_LABELS[RESOLUTION_TYPES.COPY], - testId: 'env-import-copy-btn' - }, - { - value: RESOLUTION_TYPES.REPLACE, - label: RESOLUTION_LABELS[RESOLUTION_TYPES.REPLACE], - shortLabel: RESOLUTION_SHORT_LABELS[RESOLUTION_TYPES.REPLACE], - testId: 'env-import-replace-btn' - } -]; +import { RESOLUTION_OPTIONS } from '../utils'; const EnvironmentRow = ({ env, isSelected, resolution, toggleItemSelection, setItemResolution, showResolutions }) => { - const sourceFile = env.filePath || env.fileName; - return (
{showResolutions && (
- {RESOLUTION_OPTIONS.map(({ value, label, shortLabel, testId }) => { + {RESOLUTION_OPTIONS.map(({ value, label, title, testId }) => { const selected = resolution === value; return ( @@ -45,10 +28,10 @@ const EnvironmentRow = ({ env, isSelected, resolution, toggleItemSelection, setI $selected={selected} aria-pressed={selected} onClick={() => setItemResolution(env.id, value)} - title={label} + title={title} data-testid={testId} > - {shortLabel} + {label} ); })} diff --git a/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/InvalidEnvironmentGroup/index.js b/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/InvalidEnvironmentGroup/index.js index 6b65e1c5c1b..7657c5bc71c 100644 --- a/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/InvalidEnvironmentGroup/index.js +++ b/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/InvalidEnvironmentGroup/index.js @@ -27,7 +27,7 @@ const InvalidEnvironmentGroup = ({ invalid, isExpanded, toggleExpanded }) => { {invalid.map((item, idx) => (
-
{item.fileName}
+
{item.fileName}
{item.error}
diff --git a/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/ReviewStep/StyledWrapper.js b/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/ReviewStep/StyledWrapper.js index 85bf79b4412..19a1da30613 100644 --- a/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/ReviewStep/StyledWrapper.js +++ b/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/ReviewStep/StyledWrapper.js @@ -5,6 +5,8 @@ export const StyledWrapper = styled.div` .modal-content { display: flex; flex-direction: column; + width: 498px; + max-width: 100%; height: 450px; max-height: calc(100vh - 180px); overflow: hidden; @@ -229,6 +231,9 @@ export const StyledWrapper = styled.div` font-weight: 400; font-size: ${(props) => props.theme.font.size.base}; line-height: 1.5; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } .env-error { @@ -236,6 +241,9 @@ export const StyledWrapper = styled.div` font-weight: 400; color: ${(props) => props.theme.colors.text.danger}; margin-top: 2px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } .env-actions { diff --git a/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/hooks/useEnvironmentImport/index.js b/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/hooks/useEnvironmentImport/index.js index e4e99ec1ecc..2c8ef78da77 100644 --- a/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/hooks/useEnvironmentImport/index.js +++ b/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/hooks/useEnvironmentImport/index.js @@ -34,7 +34,7 @@ export const useEnvironmentImport = (type, collection, onClose, onEnvironmentCre const isDuplicate = environment.status === ENV_STATUS.DUPLICATE; if (isDuplicate) { - const resolution = itemResolutions.get(environment.id) || RESOLUTION_TYPES.COPY; + const resolution = itemResolutions.get(environment.id) || RESOLUTION_TYPES.CREATE_NEW; const normalizedName = normalizeEnvName(environment.name); if (resolution === RESOLUTION_TYPES.REPLACE && !replacedNames.has(normalizedName)) { const existingEnv = getExistingEnv(environment.name); @@ -125,7 +125,7 @@ export const useEnvironmentImport = (type, collection, onClose, onEnvironmentCre const initialResolutions = new Map(); validItems .filter((item) => item.status === ENV_STATUS.DUPLICATE) - .forEach((item) => initialResolutions.set(item.id, RESOLUTION_TYPES.COPY)); + .forEach((item) => initialResolutions.set(item.id, RESOLUTION_TYPES.CREATE_NEW)); setResolutions(initialResolutions); setStep(IMPORT_STEPS.REVIEW); diff --git a/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/utils.js b/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/utils.js index be404fa6334..01b28dbd800 100644 --- a/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/utils.js +++ b/packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/utils.js @@ -10,18 +10,11 @@ export const detectEnvironmentFormat = (data) => { }; export const RESOLUTION_TYPES = { - CUSTOM: 'custom', - COPY: 'copy', + CREATE_NEW: 'create_new', REPLACE: 'replace' }; -export const RESOLUTION_SHORT_LABELS = { - [RESOLUTION_TYPES.COPY]: 'Clone', - [RESOLUTION_TYPES.REPLACE]: 'Replace' -}; - -export const RESOLUTION_LABELS = { - [RESOLUTION_TYPES.CUSTOM]: 'Custom', - [RESOLUTION_TYPES.COPY]: 'Import as clone', - [RESOLUTION_TYPES.REPLACE]: 'Replace existing' -}; +export const RESOLUTION_OPTIONS = [ + { value: RESOLUTION_TYPES.CREATE_NEW, label: 'New', title: 'Import as a new environment', testId: 'env-import-create-new-btn' }, + { value: RESOLUTION_TYPES.REPLACE, label: 'Replace', title: 'Replace existing', testId: 'env-import-replace-btn' } +]; diff --git a/tests/environments/import-environment/name-conflicts/name-conflicts.spec.ts b/tests/environments/import-environment/name-conflicts/name-conflicts.spec.ts index 5c2698a3a5b..74a533d94bc 100644 --- a/tests/environments/import-environment/name-conflicts/name-conflicts.spec.ts +++ b/tests/environments/import-environment/name-conflicts/name-conflicts.spec.ts @@ -51,13 +51,13 @@ test.describe('Import environment - name conflict handling', () => { await test.step('Copy is the default resolution and can be switched to Replace', async () => { const item = environment.importReviewItem('Production'); await expect(item).toBeVisible(); - await expect(environment.importCopyButton('Production')).toHaveAttribute('aria-pressed', 'true'); + await expect(environment.importCreateNewButton('Production')).toHaveAttribute('aria-pressed', 'true'); await expect(environment.importReplaceButton('Production')).toHaveAttribute('aria-pressed', 'false'); await environment.importReplaceButton('Production').click(); await expect(environment.importReplaceButton('Production')).toHaveAttribute('aria-pressed', 'true'); - await expect(environment.importCopyButton('Production')).toHaveAttribute('aria-pressed', 'false'); + await expect(environment.importCreateNewButton('Production')).toHaveAttribute('aria-pressed', 'false'); }); await modal.closeButton().click(); diff --git a/tests/utils/page/environments/index.ts b/tests/utils/page/environments/index.ts index f2376e41622..0d5c64e8be2 100644 --- a/tests/utils/page/environments/index.ts +++ b/tests/utils/page/environments/index.ts @@ -131,7 +131,7 @@ export const buildEnvironmentLocators = (page: Page) => ({ importSelectedCount: () => page.getByTestId('env-import-selected-count'), importReviewItem: (name: string) => page.getByTestId('env-import-item').filter({ has: page.getByText(name, { exact: true }) }), importItemCheckbox: (name: string) => buildEnvironmentLocators(page).importReviewItem(name).getByTestId('env-import-item-checkbox'), - importCopyButton: (name: string) => buildEnvironmentLocators(page).importReviewItem(name).getByTestId('env-import-copy-btn'), + importCreateNewButton: (name: string) => buildEnvironmentLocators(page).importReviewItem(name).getByTestId('env-import-create-new-btn'), importReplaceButton: (name: string) => buildEnvironmentLocators(page).importReviewItem(name).getByTestId('env-import-replace-btn'), importReviewItemNames: () => page.getByTestId('env-import-item').locator('.env-name'), importInvalidGroup: () => page.getByTestId('env-import-invalid-group'),