[ResponseOps][Alerting] Error when submit rule form when using AddFilterPopover in actions#194600
Conversation
|
Pinging @elastic/response-ops (Team:ResponseOps) |
…dd-filetr-popover
…opover' of github.com:guskovaue/kibana into MX-192847-error-when-submit-rule-form-with-add-filetr-popover
…dd-filetr-popover
| type: schema.maybe(schema.string()), | ||
| key: schema.maybe(schema.string()), | ||
| params: schema.maybe(schema.recordOf(schema.string(), schema.any())), // better type? | ||
| params: schema.maybe(schema.any()), |
There was a problem hiding this comment.
I'm not sure about this one, shouldn't we replicate the type instead of opening up?
There was a problem hiding this comment.
@cnasikas We talked about it. But you see, there is the type in kbn-es-query package. Maybe we can use it for creating params schema? But it looks huge and can change with time, so we'll not know. Maybe we can create some sort of test, which will correlate between type and schema?
There was a problem hiding this comment.
IMO, we should not persist with the filters as the schema is only related to the UI and is not needed for the backend or a consumer of the API. I am not sure we can efficiently catch up with all variants of the params schema. An alternative would be to do schema.maybe(schema.oneOf([schema.recordOf(schema.string(), schema.any()), schema.arrayOf(schema.recordOf(schema.string(), schema.any())])) but maybe it is not worth the effort. What do you both think?
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#7086[✅] x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/config.ts: 100/100 tests passed. |
…dd-filetr-popover
…dd-filetr-popover
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Page load bundle
History
To update your PR or re-run it, just comment with: cc @guskovaue |
|
Starting backport for target branches: 8.x |
…terPopover in actions (elastic#194600) Resolve: elastic#192847 When user try to save the rule which has a conditional action with a filter which contains AND or OR, it'll fail. Error raises when a new rule SO object is going to be created. Validation fails because schema is wrong. I fixed it in this PR. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios ### How to test 1. Go to Rules and try creating a new rule of any type 2. Add an action to the rule 3. Check the option If alert matches a query 4. Click the + icon to add a filter 5. Create a filter in the popover 6. Click AND or OR 7. Create another filter 8. Click Add filter 9. Try saving the rule 10. Saving should be successful (cherry picked from commit 02d0c98)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…AddFilterPopover in actions (#194600) (#195228) # Backport This will backport the following commits from `main` to `8.x`: - [[ResponseOps][Alerting] Error when submit rule form when using AddFilterPopover in actions (#194600)](#194600) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Julia","email":"iuliia.guskova@elastic.co"},"sourceCommit":{"committedDate":"2024-10-07T11:23:25Z","message":"[ResponseOps][Alerting] Error when submit rule form when using AddFilterPopover in actions (#194600)\n\nResolve: https://github.com/elastic/kibana/issues/192847\r\n\r\nWhen user try to save the rule which has a conditional action with a\r\nfilter which contains AND or OR, it'll fail.\r\nError raises when a new rule SO object is going to be created.\r\nValidation fails because schema is wrong.\r\nI fixed it in this PR.\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n\r\n### How to test\r\n\r\n1. Go to Rules and try creating a new rule of any type\r\n2. Add an action to the rule\r\n3. Check the option If alert matches a query\r\n4. Click the + icon to add a filter\r\n5. Create a filter in the popover\r\n6. Click AND or OR\r\n7. Create another filter\r\n8. Click Add filter\r\n9. Try saving the rule\r\n10. Saving should be successful","sha":"02d0c9852f0efb15b67c06e240e1525220a701ec","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","backport","Feature:Alerting","release_note:skip","Team:ResponseOps","v9.0.0","backport:prev-minor","v8.16.0"],"title":"[ResponseOps][Alerting] Error when submit rule form when using AddFilterPopover in actions","number":194600,"url":"https://github.com/elastic/kibana/pull/194600","mergeCommit":{"message":"[ResponseOps][Alerting] Error when submit rule form when using AddFilterPopover in actions (#194600)\n\nResolve: https://github.com/elastic/kibana/issues/192847\r\n\r\nWhen user try to save the rule which has a conditional action with a\r\nfilter which contains AND or OR, it'll fail.\r\nError raises when a new rule SO object is going to be created.\r\nValidation fails because schema is wrong.\r\nI fixed it in this PR.\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n\r\n### How to test\r\n\r\n1. Go to Rules and try creating a new rule of any type\r\n2. Add an action to the rule\r\n3. Check the option If alert matches a query\r\n4. Click the + icon to add a filter\r\n5. Create a filter in the popover\r\n6. Click AND or OR\r\n7. Create another filter\r\n8. Click Add filter\r\n9. Try saving the rule\r\n10. Saving should be successful","sha":"02d0c9852f0efb15b67c06e240e1525220a701ec"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/194600","number":194600,"mergeCommit":{"message":"[ResponseOps][Alerting] Error when submit rule form when using AddFilterPopover in actions (#194600)\n\nResolve: https://github.com/elastic/kibana/issues/192847\r\n\r\nWhen user try to save the rule which has a conditional action with a\r\nfilter which contains AND or OR, it'll fail.\r\nError raises when a new rule SO object is going to be created.\r\nValidation fails because schema is wrong.\r\nI fixed it in this PR.\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n\r\n### How to test\r\n\r\n1. Go to Rules and try creating a new rule of any type\r\n2. Add an action to the rule\r\n3. Check the option If alert matches a query\r\n4. Click the + icon to add a filter\r\n5. Create a filter in the popover\r\n6. Click AND or OR\r\n7. Create another filter\r\n8. Click Add filter\r\n9. Try saving the rule\r\n10. Saving should be successful","sha":"02d0c9852f0efb15b67c06e240e1525220a701ec"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Julia <iuliia.guskova@elastic.co>


Resolve: #192847
When user try to save the rule which has a conditional action with a filter which contains AND or OR, it'll fail.
Error raises when a new rule SO object is going to be created. Validation fails because schema is wrong.
I fixed it in this PR.
Checklist
How to test