kibana
kibana copied to clipboard
[ResponseOps][Cases] Allow users to create case using templates
Summary
Fixes https://github.com/elastic/kibana/issues/181309
This PR
- allows users to create, edit or delete templates via cases > settings page
- allows users to create case using templates
https://github.com/elastic/kibana/assets/117571355/39226aa4-9d9a-41a8-a900-ca765ed98e1b
Testing
- Go to all solutions and create cases with all fields (including all fields of all supported connectors) without using templates. Verify that everything is working as expected.
- Go to all solutions and create and edit templates with various fields. Verify that everything is working as expected.
- 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.
- 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.
- 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.
Checklist
Delete any items that are not applicable to this PR.
- [x] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
- [x] Unit or functional tests were updated or added to match the most common scenarios
- [x] Flaky Test Runner was used on any tests changed
- [x] Any UI touched in this PR is usable by keyboard only (learn more about keyboard accessibility)
- [x] This renders correctly on smaller devices using a responsive layout. (You can test this in your browser)
For maintainers
- [x] This was checked for breaking API changes and was labeled appropriately
Release notes
Allow users to create case using templates.
Pinging @elastic/response-ops (Team:ResponseOps)
Pinging @elastic/response-ops-cases (Feature:Cases)
@angorayc
Does it means I have to always apply the template when creating a new case?
You don't have to pick any template in that dropdown. It is supposed to serve as a way to prefill fields when creating cases but it is totally optional. You can always create a case without a template applied 🙂
However, your video makes me think we could have a no template option in the templates dropdown. I don't like that after we select a template there is no going back besides leaving the page 🤔 What do you think @js-jankisalvi ?
- [...] At the same time, the template information I deleted seemed still applying to my new case.
I managed to reproduce this but I am not sure it is connected to templates. I get the same behaviour if I manually populate the description. (I'll check if we already have an issue for this.)
When you were initially in the Create Case page did you leave by pressing back to cases or cancel?
@angorayc
Does it means I have to always apply the template when creating a new case?
You don't have to pick any template in that dropdown. It is supposed to serve as a way to prefill fields when creating cases but it is totally optional. You can always create a case without a template applied 🙂
However, your video makes me think we could have a
no templateoption in the templates dropdown. I don't like that after we select a template there is no going back besides leaving the page 🤔 What do you think @js-jankisalvi ?
In the first video, I wasn't able to unselected the template after selecting one, adding an option No template might be useful here.
- [...] At the same time, the template information I deleted seemed still applying to my new case.
I managed to reproduce this but I am not sure it is connected to templates. I get the same behaviour if I manually populate the description. (I'll check if we already have an issue for this.)
When you were initially in the
Create Casepage did you leave by pressingback to casesorcancel?![]()
I think I clicked back to cases
However, your video makes me think we could have a
no templateoption in the templates dropdown. I don't like that after we select a template there is no going back besides leaving the page 🤔 What do you think @js-jankisalvi ?
Yes, agree. no template option makes sense. created an issue for it: https://github.com/elastic/kibana/issues/187233
- [...] At the same time, the template information I deleted seemed still applying to my new case.
I managed to reproduce this but I am not sure it is connected to templates. I get the same behaviour if I manually populate the description. (I'll check if we already have an issue for this.) When you were initially in the
Create Casepage did you leave by pressingback to casesorcancel?I think I clicked
back to cases
Created a bug for case description: https://github.com/elastic/kibana/issues/187236
In the case configuration page, the ui gets broken if we have too many tags.
If I have a default External Incident Management System in the configuration and try to create a template I get the following error.
I am aware of this issue but I don't think it is the same.
Does it make sense to have "required" fields in the template?
In the case configuration page, the ui gets broken if we have too many tags.
Fixed here 6319822
Now it looks like this:
I was messing around with custom field default values and whatnot.
If I:
- Create a template(named X, whatever 😄 )
- Create a
togglecustom field withtrueas the default value - Go straight to the case creation page and select my template the toggle will be true with that template selected
- If I go back to the case configuration page and edit the template, the toggle will have value false.
I am having trouble uploading the screen recording so ping me offline if the description above is not clear 😅
I am aware of this issue but I don't think it is the same.
yup, it's different.
Does it make sense to have "required" fields in the template?
No, every field should be optional in templates. I quickly checked the code and it seems only Jira connector's issueTypes field has this validation. Maybe we can ignore this validation for templates. I could update this issue to handle it.
Flaky Test Runner Stats
🎉 All tests passed! - kibana-flaky-test-suite-runner#6425
[✅] x-pack/test_serverless/functional/test_suites/security/config.ts: 25/25 tests passed. [✅] x-pack/test_serverless/functional/test_suites/observability/config.ts: 25/25 tests passed. [✅] x-pack/test/functional_with_es_ssl/apps/cases/group2/config.ts: 25/25 tests passed. [✅] x-pack/test/functional_with_es_ssl/apps/cases/group1/config.ts: 25/25 tests passed. [✅] x-pack/test/cases_api_integration/security_and_spaces/config_basic.ts: 25/25 tests passed.
I found another issue with the toggle custom field. If I create a custom field with the default value set to true (toggle on) and go to create a template the default value is not populated correctly. The text field is working as expected.
No, every field should be optional in templates. I quickly checked the code and it seems only Jira connector's issueTypes field has this validation. Maybe we can ignore this validation for templates. I could update https://github.com/elastic/kibana/issues/187087 to handle it.
Yes, let's handle it on another PR and update the issue as you said.
I found another issue with the toggle custom field. If I create a custom field with the default value set to
true(toggle on) and go to create a template the default value is not populated correctly. The text field is working as expected.
I cannot reproduce it. Probably a mistake on my part.
Created an issue for custom fields bugs
:yellow_heart: Build succeeded, but was flaky
- Buildkite Build
- Commit: 5c9a65b256d776b7528796e29a2cbaad2d7c5923
Failed CI Steps
Metrics [docs]
Module Count
Fewer modules leads to a faster build time
| id | before | after | diff |
|---|---|---|---|
cases |
755 | 772 | +17 |
Async chunks
Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app
| id | before | after | diff |
|---|---|---|---|
cases |
479.4KB | 497.7KB | +18.3KB |
Page load bundle
Size of the bundles that are downloaded on every page load. Target size is below 100kb
| id | before | after | diff |
|---|---|---|---|
cases |
151.7KB | 153.4KB | +1.8KB |
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
- :yellow_heart: Build #218789 was flaky daebf7fa97c2f6eafcd623cdf6a70ee291dce755
- :green_heart: Build #218704 succeeded 4632959cef908e63079d099469ca5d45f140944d
- :green_heart: Build #218539 succeeded db94f1cbb90ea91e47caa7a2f67679d13f15e035
- :broken_heart: Build #218524 failed 9a8b6295f41cb0d98e4e375f8d9e35e06e14c93d
- :broken_heart: Build #218470 failed 97dadf7364af4c3ed2d09d8962979e537c43a005
- :green_heart: Build #218443 succeeded 9369d61f500e11799ff7eaee457beecef8019b9e
To update your PR or re-run it, just comment with:
@elasticmachine merge upstream
cc @js-jankisalvi