Bulk operations support gap_range#221078
Conversation
|
/ci |
|
/ci |
|
/ci |
|
/ci |
gap_range
|
/ci |
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
There was a problem hiding this comment.
I verified that the code is OK and tests verify it correctly, however I left some comments for some small improvements and adding some tests.
I verified that functionality works fine. I installed 4 rules. I made the 2 of them have gaps. When I select "show only with gaps", and run bulk action "duplicate", only the 2 rules with gaps are duplicated.
Please address my comments @nkhristinin and then I will approve.
Video from verification:
Screen.Recording.2025-05-30.at.12.16.59.mov
...detection_engine/rule_management_ui/components/rules_table/bulk_actions/use_bulk_actions.tsx
Show resolved
Hide resolved
...e/rule_management_ui/components/rules_table/bulk_actions/utils/prepare_search_params.test.ts
Show resolved
Hide resolved
| const MAX_RULES_TO_BULK_EDIT = 2000; | ||
| const MAX_ROUTE_CONCURRENCY = 5; | ||
|
|
||
| const validateBulkAction = (body: PerformRulesBulkActionRequestBody) => { |
There was a problem hiding this comment.
Let's add some typing:
type ValidationError = { body: string; statusCode: number };
const validateBulkAction = (
body: PerformRulesBulkActionRequestBody
): ValidationError | undefined => {
| body: `Both gaps_range_start and gaps_range_end must be provided together.`, | ||
| statusCode: 400, | ||
| }; | ||
| } |
There was a problem hiding this comment.
And return undefined explicitly at the bottom:
return undefined; // ✅ valid input
There was a problem hiding this comment.
@nkhristinin thank you for implementing my remarks. I reviewed the code again and I am approving. Good job.
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
|
Starting backport for target branches: 8.18, 8.19, 9.0 https://github.com/elastic/kibana/actions/runs/15556333623 |
💚 Build Succeeded
Metrics [docs]Async chunks
History
|
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
## Bulk operations support `gap_range` [issue](elastic#220772) ### Bug If a user has 100 rules in total and 20 of them have gaps: - They click "Show only with gaps" — the UI shows just those 20. - They hit "Select all" — it says 20 rules are selected. - But when they perform a bulk action, it ends up applying to **all 100 rules**, not just the 20 with gaps. This happens because the bulk action uses a query that doesn't include gap info, so it ends up targeting everything. ### Fix We now support passing `gaps_range_start` and `gaps_range_end` along with the bulk action. On the API side: - If a query is sent, we use the gap range to find the actual list of rule IDs with gaps. - Then we apply the bulk action only to those rules. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
|
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
## Bulk operations support `gap_range` [issue](elastic#220772) ### Bug If a user has 100 rules in total and 20 of them have gaps: - They click "Show only with gaps" — the UI shows just those 20. - They hit "Select all" — it says 20 rules are selected. - But when they perform a bulk action, it ends up applying to **all 100 rules**, not just the 20 with gaps. This happens because the bulk action uses a query that doesn't include gap info, so it ends up targeting everything. ### Fix We now support passing `gaps_range_start` and `gaps_range_end` along with the bulk action. On the API side: - If a query is sent, we use the gap range to find the actual list of rule IDs with gaps. - Then we apply the bulk action only to those rules. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
|
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
## Bulk operations support `gap_range` [issue](elastic#220772) ### Bug If a user has 100 rules in total and 20 of them have gaps: - They click "Show only with gaps" — the UI shows just those 20. - They hit "Select all" — it says 20 rules are selected. - But when they perform a bulk action, it ends up applying to **all 100 rules**, not just the 20 with gaps. This happens because the bulk action uses a query that doesn't include gap info, so it ends up targeting everything. ### Fix We now support passing `gaps_range_start` and `gaps_range_end` along with the bulk action. On the API side: - If a query is sent, we use the gap range to find the actual list of rule IDs with gaps. - Then we apply the bulk action only to those rules. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
|
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
1 similar comment
|
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
# Backport This will backport the following commits from `main` to `8.19`: - [Bulk operations support `gap_range` (#221078)](#221078) <!--- Backport version: 10.0.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Khristinin Nikita","email":"nikita.khristinin@elastic.co"},"sourceCommit":{"committedDate":"2025-06-10T09:52:32Z","message":"Bulk operations support `gap_range` (#221078)\n\n## Bulk operations support `gap_range`\n\n[issue](https://github.com/elastic/kibana/issues/220772)\n### Bug \nIf a user has 100 rules in total and 20 of them have gaps:\n- They click \"Show only with gaps\" — the UI shows just those 20.\n- They hit \"Select all\" — it says 20 rules are selected.\n- But when they perform a bulk action, it ends up applying to **all 100\nrules**, not just the 20 with gaps.\n\nThis happens because the bulk action uses a query that doesn't include\ngap info, so it ends up targeting everything.\n\n### Fix \nWe now support passing `gaps_range_start` and `gaps_range_end` along\nwith the bulk action.\n\nOn the API side:\n- If a query is sent, we use the gap range to find the actual list of\nrule IDs with gaps.\n- Then we apply the bulk action only to those rules.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"4703f7629eb86c1b76297209d244c3aa2e6d5de6","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport missing","backport:prev-minor","backport:version","v8.18.3"],"title":"Bulk operations support `gap_range`","number":221078,"url":"https://github.com/elastic/kibana/pull/221078","mergeCommit":{"message":"Bulk operations support `gap_range` (#221078)\n\n## Bulk operations support `gap_range`\n\n[issue](https://github.com/elastic/kibana/issues/220772)\n### Bug \nIf a user has 100 rules in total and 20 of them have gaps:\n- They click \"Show only with gaps\" — the UI shows just those 20.\n- They hit \"Select all\" — it says 20 rules are selected.\n- But when they perform a bulk action, it ends up applying to **all 100\nrules**, not just the 20 with gaps.\n\nThis happens because the bulk action uses a query that doesn't include\ngap info, so it ends up targeting everything.\n\n### Fix \nWe now support passing `gaps_range_start` and `gaps_range_end` along\nwith the bulk action.\n\nOn the API side:\n- If a query is sent, we use the gap range to find the actual list of\nrule IDs with gaps.\n- Then we apply the bulk action only to those rules.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"4703f7629eb86c1b76297209d244c3aa2e6d5de6"}},"sourceBranch":"main","suggestedTargetBranches":["8.18"],"targetPullRequestStates":[{"branch":"8.18","label":"v8.18.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Bulk operations support
gap_rangeissue
Bug
If a user has 100 rules in total and 20 of them have gaps:
This happens because the bulk action uses a query that doesn't include gap info, so it ends up targeting everything.
Fix
We now support passing
gaps_range_startandgaps_range_endalong with the bulk action.On the API side: