-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Create and Update cases with custom fields default values #174852
[Cases] Create and Update cases with custom fields default values #174852
Conversation
cd0aaaf
to
939df6b
Compare
b91ece6
to
b2f3dd9
Compare
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.
Great work 🚀. I left some comments.
x-pack/plugins/cases/public/components/custom_fields/translations.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/custom_fields/translations.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/custom_fields/text/create.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/custom_fields/text/create.test.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/case_view/components/custom_fields.test.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/case_view/components/custom_fields.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/case_view/components/custom_fields.test.tsx
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/custom_fields/text/edit.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/custom_fields/text/edit.test.tsx
Outdated
Show resolved
Hide resolved
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 looks good 👍 🎉
I found one bug regarding UI update:
- create
Required Toggle customField
withdefaultValue: true
- Go to an existing case and update any other customField,
- you can see the user action saying that
Required Toggle customField
is set totrue
- but the switch is stilloff
- click Back to cases
- navigate back to case and can see the toggle switch is On now
CF.default.value.toggle.mov
x-pack/plugins/cases/public/components/custom_fields/translations.ts
Outdated
Show resolved
Hide resolved
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.
Thank you for your patience with my comments!
💔 Build FailedFailed CI StepsMetrics [docs]
History
To update your PR or re-run it, just comment with: cc @adcoelho |
e8234b5
into
elastic:custom-fields-default-values
See #171747 for more info.
Summary
Merging into a feature branch.
This PR handles only the UI in the
Create
andUpdate
case pages.Create case
required: true
will have their default values pre-filled.required
custom field was created before this feature, the field will not be populated.Update case
This is only relevant if
required
custom fields have no value and we navigate to the edit case page.To reach this scenario do:
required: false
required: true
and define adefault value
How this is handled:
Demo video.
Screen.Recording.2024-01-18.at.17.37.39.mov
required
custom field has no value:No value is added
is displayed.Edit
button, the form is filled with thedefault value
(when it exists).Save
button will be enabled by default.This field was populated with the default value.
is shown.