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] Create and Update cases with custom fields default values #174852

Conversation

adcoelho
Copy link
Contributor

@adcoelho adcoelho commented Jan 15, 2024

See #171747 for more info.

Summary

Merging into a feature branch.

This PR handles only the UI in the Create and Update case pages.

Create case

  • Custom fields where required: true will have their default values pre-filled.
  • If the 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:

  1. Create a text custom field where required: false
  2. Create a case and leave that field empty
  3. Change that custom field to required: true and define a default value
  4. Go to the edit case page

How this is handled:

Demo video.
Screen.Recording.2024-01-18.at.17.37.39.mov
  • If a single required custom field has no value:
    • No value is added is displayed.
    • When a user clicks the Edit button, the form is filled with the default value(when it exists).
    • The Save button will be enabled by default.
    • The help text This field was populated with the default value. is shown.
  • When there are multiple required custom fields without a value, editing one will save the others with their default value

@adcoelho adcoelho 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.13.0 labels Jan 15, 2024
@adcoelho adcoelho self-assigned this Jan 15, 2024
@adcoelho adcoelho force-pushed the create-update-case-default-value-UI branch from cd0aaaf to 939df6b Compare January 18, 2024 09:14
@adcoelho adcoelho force-pushed the create-update-case-default-value-UI branch from b91ece6 to b2f3dd9 Compare January 18, 2024 16:19
@adcoelho adcoelho marked this pull request as ready for review January 18, 2024 18:17
@adcoelho adcoelho requested a review from a team as a code owner January 18, 2024 18:17
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops-cases (Feature:Cases)

Copy link
Member

@cnasikas cnasikas left a 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.

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.

Code looks good 👍 🎉

I found one bug regarding UI update:

  • create Required Toggle customField with defaultValue: true
  • Go to an existing case and update any other customField,
  • you can see the user action saying that Required Toggle customField is set to true - but the switch is still off
  • click Back to cases
  • navigate back to case and can see the toggle switch is On now
CF.default.value.toggle.mov

Copy link
Member

@cnasikas cnasikas left a 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!

@kibana-ci
Copy link
Collaborator

💔 Build Failed

Failed CI Steps

Metrics [docs]

‼️ ERROR: no builds found for mergeBase sha [3c87fce]

History

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

cc @adcoelho

@adcoelho adcoelho merged commit e8234b5 into elastic:custom-fields-default-values Jan 24, 2024
18 of 19 checks passed
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.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants