-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] Fix template's custom fields bugs #187591
[ResponseOps][Cases] Fix template's custom fields bugs #187591
Conversation
Pinging @elastic/response-ops-cases (Feature:Cases) |
Pinging @elastic/response-ops (Team:ResponseOps) |
…js-jankisalvi/kibana into templates-custom-fields-bug-fix
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.
Tested and it's working as expected 👍
Left some small comments.
x-pack/plugins/cases/public/components/configure_cases/index.test.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/configure_cases/index.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.
Tested and everything is working as expected. LGTM!
x-pack/plugins/cases/public/components/configure_cases/index.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/configure_cases/index.test.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/cases/public/components/configure_cases/index.tsx
Outdated
Show resolved
Hide resolved
@@ -436,8 +436,13 @@ export async function create( | |||
fieldName: 'customFields', | |||
}); | |||
|
|||
await validateTemplates({ | |||
const updatedTemplates = transformTemplateCustomFields({ |
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 was thinking that, only for the create scenario, it may be fine if we throw a bad request error because the user tries to create a configuration with invalid custom fields in templates. Wdyt?
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.
Updated create configuration scenario to throw error
- when templates don't have custom fields but request payload has custom fields.
- when templates have custom fields but request payload doesn't have custom fields.
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Async chunks
Page load bundle
History
|
## Summary Fixes elastic#187333 ## Testing behaviour: Issue 1: verify similar behaviour from API as well. 1. Create a template 2. Add new toggle custom field with default value as true 3. Go to create case, See that new toggle custom field has value: true 4. Select recently created template 5. Toggle custom field new custom field with it's default value Issue 2: verify similar behaviour from API as well. 1. Create a text custom field with default value 2. Create a template 3. Set text custom field value to empty 4. Save template 5. Go to create case 6. Select recently created template 7. See that text custom field value is updated as per template's custom field value (cherry picked from commit 6b0d628)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…187591) (#188135) # Backport This will backport the following commits from `main` to `8.15`: - [[ResponseOps][Cases] Fix template's custom fields bugs (#187591)](#187591) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Janki Salvi","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-07-11T16:13:19Z","message":"[ResponseOps][Cases] Fix template's custom fields bugs (#187591)\n\n## Summary\r\n\r\nFixes https://github.com/elastic/kibana/issues/187333\r\n\r\n## Testing behaviour: \r\nIssue 1: verify similar behaviour from API as well.\r\n\r\n1. Create a template\r\n2. Add new toggle custom field with default value as true\r\n3. Go to create case, See that new toggle custom field has value: true\r\n4. Select recently created template\r\n5. Toggle custom field new custom field with it's default value\r\n\r\nIssue 2: verify similar behaviour from API as well.\r\n1. Create a text custom field with default value\r\n2. Create a template\r\n3. Set text custom field value to empty\r\n4. Save template\r\n5. Go to create case\r\n6. Select recently created template\r\n7. See that text custom field value is updated as per template's custom\r\nfield value","sha":"6b0d62805352c391fc7bfdb47ff848c0a46080ee","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","Feature:Cases","v8.15.0","v8.16.0"],"title":"[ResponseOps][Cases] Fix template's custom fields bugs","number":187591,"url":"https://github.com/elastic/kibana/pull/187591","mergeCommit":{"message":"[ResponseOps][Cases] Fix template's custom fields bugs (#187591)\n\n## Summary\r\n\r\nFixes https://github.com/elastic/kibana/issues/187333\r\n\r\n## Testing behaviour: \r\nIssue 1: verify similar behaviour from API as well.\r\n\r\n1. Create a template\r\n2. Add new toggle custom field with default value as true\r\n3. Go to create case, See that new toggle custom field has value: true\r\n4. Select recently created template\r\n5. Toggle custom field new custom field with it's default value\r\n\r\nIssue 2: verify similar behaviour from API as well.\r\n1. Create a text custom field with default value\r\n2. Create a template\r\n3. Set text custom field value to empty\r\n4. Save template\r\n5. Go to create case\r\n6. Select recently created template\r\n7. See that text custom field value is updated as per template's custom\r\nfield value","sha":"6b0d62805352c391fc7bfdb47ff848c0a46080ee"}},"sourceBranch":"main","suggestedTargetBranches":["8.15"],"targetPullRequestStates":[{"branch":"8.15","label":"v8.15.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/187591","number":187591,"mergeCommit":{"message":"[ResponseOps][Cases] Fix template's custom fields bugs (#187591)\n\n## Summary\r\n\r\nFixes https://github.com/elastic/kibana/issues/187333\r\n\r\n## Testing behaviour: \r\nIssue 1: verify similar behaviour from API as well.\r\n\r\n1. Create a template\r\n2. Add new toggle custom field with default value as true\r\n3. Go to create case, See that new toggle custom field has value: true\r\n4. Select recently created template\r\n5. Toggle custom field new custom field with it's default value\r\n\r\nIssue 2: verify similar behaviour from API as well.\r\n1. Create a text custom field with default value\r\n2. Create a template\r\n3. Set text custom field value to empty\r\n4. Save template\r\n5. Go to create case\r\n6. Select recently created template\r\n7. See that text custom field value is updated as per template's custom\r\nfield value","sha":"6b0d62805352c391fc7bfdb47ff848c0a46080ee"}}]}] BACKPORT--> Co-authored-by: Janki Salvi <[email protected]>
Summary
Fixes #187333
Testing behaviour:
Issue 1: verify similar behaviour from API as well.
Issue 2: verify similar behaviour from API as well.