-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ResponseOps] [Cases] UX enhancements (#146608)
Fixes #144614 ## Summary Case Detail Page - The ‘Add comment’ button in the Case detail page is now disabled until a comment is filled in. - The save button in the 'Edit Comment' section of the Case detail page is now disabled if a comment is empty. - The Tags in the activity stream now display a hollow badge equal to the ones on the sidebar. - Fixed the spacing between the headings in the sidebar. The gutter size was increased. Case Creation Page - The Create and Cancel buttons were too close together. The distance between them was increased. - There is now a confirmation dialog if the user clicks the cancel button. - Introduced a restricted page width. The max is now 1200px. All Cases list - Brought back the distance between tags in the rows ### Screenshots <details><summary>Disabled Add comment button</summary><img width="705" alt="Screenshot 2022-11-29 at 19 04 25" src="https://user-images.githubusercontent.com/1533137/204610436-69311744-0761-4ed9-9c38-d1763f230157.png"></details> <details><summary>Enabled Add comment button</summary><img width="706" alt="Screenshot 2022-11-29 at 19 04 34" src="https://user-images.githubusercontent.com/1533137/204610667-a8befd8a-944c-4e64-bc97-21bd7685acf8.png"></details> <details><summary>Hollow tags</summary><img width="368" alt="Screenshot 2022-11-29 at 19 03 33" src="https://user-images.githubusercontent.com/1533137/204609898-33f1609e-6f42-4fdb-853d-5c049838f1f3.png"></details> <details><summary>Fixed sidebar spacing</summary><img width="696" alt="Screenshot 2022-11-28 at 12 11 52" src="https://user-images.githubusercontent.com/1533137/204607633-954b8aa4-697f-4a48-9337-4a82448b853d.png"></details> <details><summary>Create and Cancel button spacing</summary><img width="289" alt="Screenshot 2022-11-29 at 19 05 54" src="https://user-images.githubusercontent.com/1533137/204611166-3644f59f-c5f8-405f-9587-00e7840f37fc.png"></details> <details><summary>Cancel create case confirmation dialog</summary><img width="424" alt="Screenshot 2022-11-29 at 19 06 03" src="https://user-images.githubusercontent.com/1533137/204611225-1ef49533-8e14-49f1-8ba7-6cf17bac4305.png"> </details> <details><summary>Centered, restricted page width</summary><img width="2247" alt="Screenshot 2022-11-28 at 14 58 34" src="https://user-images.githubusercontent.com/1533137/204609106-fae1d3dc-3f8d-47b3-a4bb-fe9398bf75c0.png"></details> <details><summary>Margin between tags</summary><img width="662" alt="Screenshot 2022-12-02 at 10 59 26" src="https://user-images.githubusercontent.com/1533137/205267224-f7bbb909-1bb4-42f8-b0e3-e1c9a2a7b8a6.png"></details>
- Loading branch information
Showing
21 changed files
with
438 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
x-pack/plugins/cases/public/components/create/cancel_creation_confirmation_modal.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import userEvent from '@testing-library/user-event'; | ||
import React from 'react'; | ||
import type { AppMockRenderer } from '../../common/mock'; | ||
import { createAppMockRenderer } from '../../common/mock'; | ||
import { CancelCreationConfirmationModal } from './cancel_creation_confirmation_modal'; | ||
|
||
describe('CancelCreationConfirmationModal', () => { | ||
let appMock: AppMockRenderer; | ||
const props = { | ||
title: 'My title', | ||
confirmButtonText: 'My confirm button text', | ||
cancelButtonText: 'My cancel button text', | ||
onCancel: jest.fn(), | ||
onConfirm: jest.fn(), | ||
}; | ||
|
||
beforeEach(() => { | ||
appMock = createAppMockRenderer(); | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it('renders correctly', async () => { | ||
const result = appMock.render(<CancelCreationConfirmationModal {...props} />); | ||
|
||
expect(result.getByTestId('cancel-creation-confirmation-modal')).toBeInTheDocument(); | ||
expect(result.getByText(props.title)).toBeInTheDocument(); | ||
expect(result.getByText(props.confirmButtonText)).toBeInTheDocument(); | ||
expect(result.getByText(props.cancelButtonText)).toBeInTheDocument(); | ||
}); | ||
|
||
it('calls onConfirm', async () => { | ||
const result = appMock.render(<CancelCreationConfirmationModal {...props} />); | ||
|
||
expect(result.getByText(props.confirmButtonText)).toBeInTheDocument(); | ||
userEvent.click(result.getByText(props.confirmButtonText)); | ||
|
||
expect(props.onConfirm).toHaveBeenCalled(); | ||
}); | ||
|
||
it('calls onCancel', async () => { | ||
const result = appMock.render(<CancelCreationConfirmationModal {...props} />); | ||
|
||
expect(result.getByText(props.cancelButtonText)).toBeInTheDocument(); | ||
userEvent.click(result.getByText(props.cancelButtonText)); | ||
|
||
expect(props.onCancel).toHaveBeenCalled(); | ||
}); | ||
}); |
41 changes: 41 additions & 0 deletions
41
x-pack/plugins/cases/public/components/create/cancel_creation_confirmation_modal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { EuiConfirmModalProps } from '@elastic/eui'; | ||
import { EuiConfirmModal } from '@elastic/eui'; | ||
import * as i18n from './translations'; | ||
|
||
type Props = Pick< | ||
EuiConfirmModalProps, | ||
'title' | 'confirmButtonText' | 'cancelButtonText' | 'onConfirm' | 'onCancel' | ||
>; | ||
|
||
const CancelCreationConfirmationModalComponent: React.FC<Props> = ({ | ||
title, | ||
confirmButtonText = i18n.CONFIRM_MODAL_BUTTON, | ||
cancelButtonText = i18n.CANCEL_MODAL_BUTTON, | ||
onConfirm, | ||
onCancel, | ||
}) => { | ||
return ( | ||
<EuiConfirmModal | ||
title={title} | ||
onCancel={onCancel} | ||
onConfirm={onConfirm} | ||
cancelButtonText={cancelButtonText} | ||
confirmButtonText={confirmButtonText} | ||
buttonColor="danger" | ||
defaultFocusedButton="confirm" | ||
data-test-subj="cancel-creation-confirmation-modal" | ||
/> | ||
); | ||
}; | ||
|
||
CancelCreationConfirmationModalComponent.displayName = 'CancelCreationConfirmationModal'; | ||
|
||
export const CancelCreationConfirmationModal = React.memo(CancelCreationConfirmationModalComponent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.