From e5e10a02a82fdbaae48cb1546b23c8589c97fb5b Mon Sep 17 00:00:00 2001 From: Georgiana Onoleata Date: Fri, 4 Oct 2024 14:48:59 +0300 Subject: [PATCH 1/4] Design Review changes PR 3 --- .../cases/public/components/configure_cases/index.tsx | 8 ++++++-- .../public/components/configure_cases/translations.ts | 11 +++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/cases/public/components/configure_cases/index.tsx b/x-pack/plugins/cases/public/components/configure_cases/index.tsx index d26fe1ee185f8..8097e644e268a 100644 --- a/x-pack/plugins/cases/public/components/configure_cases/index.tsx +++ b/x-pack/plugins/cases/public/components/configure_cases/index.tsx @@ -484,7 +484,9 @@ export const ConfigureCases: React.FC = React.memo(() => { } onCloseFlyout={onCloseCustomFieldFlyout} onSaveField={onCustomFieldSave} - renderHeader={() => {i18n.ADD_CUSTOM_FIELD}} + renderHeader={() => ( + {!customFieldToEdit ? i18n.ADD_CUSTOM_FIELD : i18n.EDIT_CUSTOM_FIELD} + )} > {({ onChange }) => ( @@ -504,7 +506,9 @@ export const ConfigureCases: React.FC = React.memo(() => { } onCloseFlyout={onCloseTemplateFlyout} onSaveField={onTemplateSave} - renderHeader={() => {i18n.CREATE_TEMPLATE}} + renderHeader={() => ( + {!templateToEdit ? i18n.CREATE_TEMPLATE : i18n.EDIT_TEMPLATE} + )} > {({ onChange }) => ( Date: Mon, 7 Oct 2024 13:39:38 +0300 Subject: [PATCH 2/4] updated test to check if title is rendered corectly --- .../public/components/configure_cases/index.test.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/x-pack/plugins/cases/public/components/configure_cases/index.test.tsx b/x-pack/plugins/cases/public/components/configure_cases/index.test.tsx index 7f375ef75938b..6c65eae41c78b 100644 --- a/x-pack/plugins/cases/public/components/configure_cases/index.test.tsx +++ b/x-pack/plugins/cases/public/components/configure_cases/index.test.tsx @@ -902,6 +902,10 @@ describe('ConfigureCases', () => { expect(await screen.findByTestId('common-flyout')).toBeInTheDocument(); + expect(await screen.findByTestId('common-flyout-header')).toHaveTextContent( + i18n.EDIT_CUSTOM_FIELD + ); + await userEvent.click(screen.getByTestId('custom-field-label-input')); await userEvent.paste('!!'); await userEvent.click(screen.getByTestId('text-custom-field-required')); @@ -941,6 +945,10 @@ describe('ConfigureCases', () => { await userEvent.click(screen.getByTestId('add-custom-field')); expect(await screen.findByTestId('common-flyout')).toBeInTheDocument(); + + expect(await screen.findByTestId('common-flyout-header')).toHaveTextContent( + i18n.ADD_CUSTOM_FIELD + ); }); it('closes fly out for when click on cancel', async () => { @@ -1177,6 +1185,10 @@ describe('ConfigureCases', () => { expect(await screen.findByTestId('common-flyout')).toBeInTheDocument(); + expect(await screen.findByTestId('common-flyout-header')).toHaveTextContent( + i18n.EDIT_TEMPLATE + ); + await userEvent.clear(await screen.findByTestId('template-name-input')); await userEvent.click(await screen.findByTestId('template-name-input')); await userEvent.paste('Updated template name'); From bbd9fc93a2d7ed617f368492c2e131855b467bcc Mon Sep 17 00:00:00 2001 From: Georgiana Onoleata Date: Tue, 8 Oct 2024 11:39:48 +0300 Subject: [PATCH 3/4] changed fly out title to be 'add template' --- .../cases/public/components/configure_cases/translations.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/cases/public/components/configure_cases/translations.ts b/x-pack/plugins/cases/public/components/configure_cases/translations.ts index a549d3f6b3951..7a2e0e84b0306 100644 --- a/x-pack/plugins/cases/public/components/configure_cases/translations.ts +++ b/x-pack/plugins/cases/public/components/configure_cases/translations.ts @@ -176,7 +176,7 @@ export const EDIT_CUSTOM_FIELD = i18n.translate( ); export const CREATE_TEMPLATE = i18n.translate('xpack.cases.configureCases.templates.flyoutTitle', { - defaultMessage: 'Create template', + defaultMessage: 'Add template', }); export const EDIT_TEMPLATE = i18n.translate('xpack.cases.configureCases.templates.editTemplate', { From bc430d6ae94c12fa42731f563c3bff892e4175ba Mon Sep 17 00:00:00 2001 From: Georgiana Onoleata Date: Tue, 8 Oct 2024 14:16:52 +0300 Subject: [PATCH 4/4] addressed comments --- .../plugins/cases/public/components/configure_cases/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/cases/public/components/configure_cases/index.tsx b/x-pack/plugins/cases/public/components/configure_cases/index.tsx index 8097e644e268a..61f99a46a0b08 100644 --- a/x-pack/plugins/cases/public/components/configure_cases/index.tsx +++ b/x-pack/plugins/cases/public/components/configure_cases/index.tsx @@ -485,7 +485,7 @@ export const ConfigureCases: React.FC = React.memo(() => { onCloseFlyout={onCloseCustomFieldFlyout} onSaveField={onCustomFieldSave} renderHeader={() => ( - {!customFieldToEdit ? i18n.ADD_CUSTOM_FIELD : i18n.EDIT_CUSTOM_FIELD} + {customFieldToEdit ? i18n.EDIT_CUSTOM_FIELD : i18n.ADD_CUSTOM_FIELD} )} > {({ onChange }) => ( @@ -507,7 +507,7 @@ export const ConfigureCases: React.FC = React.memo(() => { onCloseFlyout={onCloseTemplateFlyout} onSaveField={onTemplateSave} renderHeader={() => ( - {!templateToEdit ? i18n.CREATE_TEMPLATE : i18n.EDIT_TEMPLATE} + {templateToEdit ? i18n.EDIT_TEMPLATE : i18n.CREATE_TEMPLATE} )} > {({ onChange }) => (