Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cases] Use templates when creating a case #185880

Merged

Conversation

cnasikas
Copy link
Member

@cnasikas cnasikas commented Jun 10, 2024

Summary

This PR adds the ability for users to select a template when creating a case. When a user selects a template the cases form fields are populated with the values from the template. The solution picker in the flyout changed as:

Screenshot 2024-06-20 at 1 26 14 PM

Bug fixes

  1. Changing the solution through the solution picket in the flyout would not respect the connector's configuration.
  2. Bug where the lazy loading of connectors' icons was causing the flyout to open and close when you selected a solution picket. This bug appeared when the first bug was fixed.

Testing

  1. Go to all solutions and create cases setting all fields (including all fields of all supported connectors) without using templates. Verify that everything is working as expected.
  2. Go to all solutions, create different templates on each solution, and verify that when creating a case you can use templates and everything is working as expected.
  3. Go to the alerts table of o11y and security and attach alerts to a new case. Verify that in the flyout the templates are working as expected.
  4. Go to ML and try to attach an ML visualization to a new case. Verify that the solution picker is working as expected and it resets the form when changing solutions.

Fixes: #181871
Depends on: #185877

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@cnasikas cnasikas added release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Cases Cases feature v8.15.0 labels Jun 10, 2024
@cnasikas cnasikas self-assigned this Jun 10, 2024
@@ -102,7 +114,11 @@ const ConnectorsDropdownComponent: React.FC<Props> = ({
margin-right: ${euiTheme.size.m};
margin-bottom: 0 !important;
`}
type={getConnectorIcon(triggersActionsUi, connector.actionTypeId)}
type={
Copy link
Member Author

@cnasikas cnasikas Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed to avoid the following bug:

Screen.Recording.2024-06-11.at.3.59.54.PM.mov

The icon class can be a lazy-loaded component. React will fall back to the nearest Suspense causing the flyout on each render of the SVG icon to appear and disappear. By adding suspense here we isolate the loading inside the select option. With the fix:

Screen.Recording.2024-06-11.at.4.18.06.PM.mov

Thanks @umbopepato! Your investigation of the flaky tests made me figure it out!

@cnasikas
Copy link
Member Author

@js-jankisalvi About:

  1. The bug you found was fixed by @adcoelho in 2e0b9e8 (#185880).
  2. This is happening because when you create the case it's being pushed to Jira. Then Jira throws an error. It seems unrelated to templates but it is a great point as users can configure templates with malformed data. Could you open an issue for that? We may need to filter out parent issues based on the issue type.
  3. Good point! I agree but I could not find a way to do it with EuiSelect. Do you mind if we leave it for another PR as a fix?

@adcoelho I fixed the test with the infinitive loop here 172f0dd (#185880)

@js-jankisalvi
Copy link
Contributor

Could you open an issue for that? We may need to filter out parent issues based on the issue type.

Created issue

  1. Good point! I agree but I could not find a way to do it with EuiSelect. Do you mind if we leave it for another PR as a fix?

yes, sure 👍

@js-jankisalvi
Copy link
Contributor

Owner bug is fixed 🎉
However custom fields validations have stopped working.
Here CF3 custom field is required and does not have default value:

image

@cnasikas
Copy link
Member Author

@js-jankisalvi Thank! Fixed in f784b51 (#185880)

Copy link
Contributor

@js-jankisalvi js-jankisalvi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified locally, works as expected 👍

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
cases 771 772 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
cases 497.4KB 497.7KB +301.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
cases 153.1KB 153.4KB +286.0B
Unknown metric groups

ESLint disabled in files

id before after diff
cases 16 17 +1

ESLint disabled line counts

id before after diff
cases 61 62 +1

Total ESLint disabled count

id before after diff
cases 77 79 +2

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @cnasikas

@cnasikas cnasikas merged commit 97dadf7 into elastic:feat/case_templates Jun 28, 2024
21 checks passed
@cnasikas cnasikas deleted the create_case_with_templates branch June 28, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Cases Cases feature release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants