[Response Ops] Es query rule "size" field re-initializes to 100 if set to 0 when editing#213636
[Response Ops] Es query rule "size" field re-initializes to 100 if set to 0 when editing#213636doakalexi merged 5 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/response-ops (Team:ResponseOps) |
pmuellr
left a comment
There was a problem hiding this comment.
LGTM, suggested a change that's valid (I hope), a little smaller, and catches nulls as well
| thresholdComparator: thresholdComparator ?? DEFAULT_VALUES.THRESHOLD_COMPARATOR, | ||
| size: size ? size : isServerless ? SERVERLESS_DEFAULT_VALUES.SIZE : DEFAULT_VALUES.SIZE, | ||
| size: | ||
| size !== undefined |
There was a problem hiding this comment.
I wonder if this test could be size != null, which would catch both null and undefined - for future-proofing in case the value becomes is null.
Looks like we can do that AND make this a little simpler:
size:
ruleParams.size ?? (isServerless ? SERVERLESS_DEFAULT_VALUES.SIZE : DEFAULT_VALUES.SIZE),
There was a problem hiding this comment.
That's a good idea, thank you! Updated in this commit c180f3f
| thresholdComparator: thresholdComparator ?? DEFAULT_VALUES.THRESHOLD_COMPARATOR, | ||
| size: size ? size : isServerless ? SERVERLESS_DEFAULT_VALUES.SIZE : DEFAULT_VALUES.SIZE, | ||
| size: | ||
| size !== undefined |
There was a problem hiding this comment.
same comment as above re: size != null
| : isServerless | ||
| ? SERVERLESS_DEFAULT_VALUES.SIZE | ||
| : DEFAULT_VALUES.SIZE, | ||
| size: |
There was a problem hiding this comment.
same comment as above re: size != null
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Async chunks
History
|
|
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/13863834377 |
…t to 0 when editing (elastic#213636) Resolves elastic#209427 ## Summary This PR fixes a bug when editing an es query rule with size set to 0. I also refactored the tests to use react testing library. ### Checklist Check the PR satisfies following conditions. - [ ] [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 ### To verify 1. Create an es query rule 2. Set the size to be 0 3. Save your rule 4. Edit your rule and verify that the size is set to 0 when you open the editor (cherry picked from commit 287eb3e)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…t to 0 when editing (elastic#213636) Resolves elastic#209427 ## Summary This PR fixes a bug when editing an es query rule with size set to 0. I also refactored the tests to use react testing library. ### Checklist Check the PR satisfies following conditions. - [ ] [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 ### To verify 1. Create an es query rule 2. Set the size to be 0 3. Save your rule 4. Edit your rule and verify that the size is set to 0 when you open the editor (cherry picked from commit 287eb3e)
… if set to 0 when editing (#213636) (#214848) # Backport This will backport the following commits from `main` to `8.x`: - [[Response Ops] Es query rule "size" field re-initializes to 100 if set to 0 when editing (#213636)](#213636) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Alexi Doak","email":"109488926+doakalexi@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-03-14T19:19:43Z","message":"[Response Ops] Es query rule \"size\" field re-initializes to 100 if set to 0 when editing (#213636)\n\nResolves https://github.com/elastic/kibana/issues/209427\n\n## Summary\n\nThis PR fixes a bug when editing an es query rule with size set to 0. I\nalso refactored the tests to use react testing library.\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n\n### To verify\n\n1. Create an es query rule\n2. Set the size to be 0\n3. Save your rule \n4. Edit your rule and verify that the size is set to 0 when you open the\neditor","sha":"287eb3e5c63fd7825993280c490f0dd9d774373a","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","backport:version","v9.1.0","v8.19.0"],"title":"[Response Ops] Es query rule \"size\" field re-initializes to 100 if set to 0 when editing","number":213636,"url":"https://github.com/elastic/kibana/pull/213636","mergeCommit":{"message":"[Response Ops] Es query rule \"size\" field re-initializes to 100 if set to 0 when editing (#213636)\n\nResolves https://github.com/elastic/kibana/issues/209427\n\n## Summary\n\nThis PR fixes a bug when editing an es query rule with size set to 0. I\nalso refactored the tests to use react testing library.\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n\n### To verify\n\n1. Create an es query rule\n2. Set the size to be 0\n3. Save your rule \n4. Edit your rule and verify that the size is set to 0 when you open the\neditor","sha":"287eb3e5c63fd7825993280c490f0dd9d774373a"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/213636","number":213636,"mergeCommit":{"message":"[Response Ops] Es query rule \"size\" field re-initializes to 100 if set to 0 when editing (#213636)\n\nResolves https://github.com/elastic/kibana/issues/209427\n\n## Summary\n\nThis PR fixes a bug when editing an es query rule with size set to 0. I\nalso refactored the tests to use react testing library.\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n\n### To verify\n\n1. Create an es query rule\n2. Set the size to be 0\n3. Save your rule \n4. Edit your rule and verify that the size is set to 0 when you open the\neditor","sha":"287eb3e5c63fd7825993280c490f0dd9d774373a"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
…t to 0 when editing (elastic#213636) Resolves elastic#209427 ## Summary This PR fixes a bug when editing an es query rule with size set to 0. I also refactored the tests to use react testing library. ### Checklist Check the PR satisfies following conditions. - [ ] [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 ### To verify 1. Create an es query rule 2. Set the size to be 0 3. Save your rule 4. Edit your rule and verify that the size is set to 0 when you open the editor
…t to 0 when editing (elastic#213636) Resolves elastic#209427 ## Summary This PR fixes a bug when editing an es query rule with size set to 0. I also refactored the tests to use react testing library. ### Checklist Check the PR satisfies following conditions. - [ ] [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 ### To verify 1. Create an es query rule 2. Set the size to be 0 3. Save your rule 4. Edit your rule and verify that the size is set to 0 when you open the editor
Resolves #209427
Summary
This PR fixes a bug when editing an es query rule with size set to 0. I also refactored the tests to use react testing library.
Checklist
Check the PR satisfies following conditions.
To verify