-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
[ResponseOps][Cases] Allow users to create templates #184104
[ResponseOps][Cases] Allow users to create templates #184104
Conversation
Pinging @elastic/response-ops (Team:ResponseOps) |
Pinging @elastic/response-ops-cases (Feature:Cases) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No code review. I tested the UI first. I will test the code soon. Finding:
- I noticed that the template tags field provides options coming from the cases tags. Given that the tags are related to tags I think we should provide them from the template tags. We have all tags from all templates in the configuration. No need for an API call. Do we have a limit on the total number of tags per template?
-
The description is a text field. I think it should be a text area or markdown editor. Let's start with a text area for this MVP.
-
The description is required. What about making it optional?
- The description is persisted to local storage. Given that this is a flyout and not a page I think we should not persist it. Otherwise, every time I open the flyout the description of the template I created previously will appear.
Ahh, good point. Will load the template tags here.
Yes, it's 10
Max description length is 1000 characters and it should be informative only, so agree with text area.
It was mandatory in issue, but I am fine with making it optional.
Hmm.. yes, this will need some modification in the existing description component. That's why I thought of doing it in next PR, but it makes sense to do it here to test the create template feature properly. Fixed in a468d94 |
Flaky Test Runner Stats🟠 Some tests failed. - kibana-flaky-test-suite-runner#6176[❌] x-pack/test/functional_with_es_ssl/apps/cases/group2/config.ts: 0/25 tests passed. |
…, make description optional, show template tags options
Flaky Test Runner Stats🟠 Some tests failed. - kibana-flaky-test-suite-runner#6182[❌] x-pack/test/functional_with_es_ssl/apps/cases/group2/config.ts: 0/25 tests passed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested locally and worked as expected, LGTM! I was able to create templates with custom fields and a connector. This is really small, but now that the description is optional it'd be good to add the OptionalFieldLabel
to match the other optional fields.
@elasticmachine merge upstream |
Flaky Test Runner Stats🟠 Some tests failed. - kibana-flaky-test-suite-runner#6190[❌] x-pack/test/functional_with_es_ssl/apps/cases/group2/config.ts: 0/25 tests passed. |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#6213[✅] x-pack/test/functional_with_es_ssl/apps/cases/group2/config.ts: 30/30 tests passed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work and great test coverage 🚀 ! I left a couple of comments.
x-pack/plugins/cases/public/components/case_form_fields/index.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/case_form_fields/index.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/case_form_fields/index.test.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/configure_cases/flyout.test.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/configure_cases/flyout.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/templates/form_fields.tsx
Outdated
Show resolved
Hide resolved
|
||
const { emptyField, maxLengthField } = fieldValidators; | ||
|
||
export const schema: FormSchema<TemplateFormProps> = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A portion of this schema seems identical with the schema defined here x-pack/plugins/cases/public/components/create/schema.tsx
. Wdyt about having one base schema common to both? Then, in this file, we can iterate the common schema and add the optional label to the fields we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created schema for case_form_fields
and used it in template schema to append optional label. here
We can use the same in create case form as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGMT! I tested and everything is working as expected. Thank you for your patience with the review.
x-pack/plugins/cases/public/components/case_form_fields/custom_fields.test.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/configure_cases/index.tsx
Outdated
Show resolved
Hide resolved
💔 Build FailedFailed CI StepsMetrics [docs]
History
To update your PR or re-run it, just comment with: |
c511009
into
elastic:feat/case_templates
Summary
Merging into feature branch.
Implements create functionality #181864
Add template from case settings page.
How to test
Scenarios:
Flaky test runner here
Checklist
Delete any items that are not applicable to this PR.