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] Add custom fields: List type #194236

Open
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

Zacqary
Copy link
Contributor

@Zacqary Zacqary commented Sep 26, 2024

Summary

Closes #176491

Adds the List custom field type to Cases. Also makes some changes to the custom field configuration type system to handle the new features added in this field type.

The List field type creates a <select> dropdown with a set of options determined by the custom field's configuration. Options are defined as { key: UUID, label: String }.

When the user selects a value, it is saved to the case with the schema { key: Custom Field UUID, value: Option UUID }. The option's label is fetched at runtime by the UI from the custom field configuration, and displayed. This is a deviation from the research issue proposal, which specced a schema of { key: ${Field UUID}.{Option UUID}, label: Option Label }. Engineering this turned out to require major changes to the form UI library and the API transformation libraries, and it's a less drastic change to simply convert the key to a label when displaying the field.

Option labels can be renamed for free using this new schema, since the UUID is the only thing stored in case saved objects. We don't need to create a new issue to add renaming support.

This PR also allows List fields to be filtered. This required a change from using static filterOptions in custom field configurations to a dynamic getFilterOptions function. The Toggle field was updated to use this new dynamic function.

Screenshot 2024-09-26 at 5 33 26 PM Screenshot 2024-09-26 at 5 32 22 PM

Known Issues

Due to elastic/eui#8027 drag-and-drop on the new <OptionsField> doesn't correctly render the current draggable element inside the flyout. EUI is aiming to fix this before 8.16.

Screenshot 2024-09-26 at 5 42 38 PM

Checklist

@Zacqary Zacqary added release_note:enhancement Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v9.0.0 Feature:Cases Cases feature v8.16.0 backport:version Backport to applied version labels labels Sep 26, 2024
@obltmachine
Copy link

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@Zacqary
Copy link
Contributor Author

Zacqary commented Oct 1, 2024

/ci

@Zacqary
Copy link
Contributor Author

Zacqary commented Oct 2, 2024

/ci

@Zacqary Zacqary marked this pull request as ready for review October 2, 2024 14:41
@Zacqary Zacqary requested a review from a team as a code owner October 2, 2024 14:41
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

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

@Zacqary Zacqary enabled auto-merge (squash) October 2, 2024 14:41
@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 812 822 +10

Async chunks

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

id before after diff
cases 491.4KB 494.3KB +2.8KB

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.1KB 160.8KB +9.7KB

History

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels Feature:Cases Cases feature release_note:enhancement Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Cases] Custom fields: List type
4 participants