-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[RAM] Add bulk action to Untrack selected alerts #167579
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
Merged
Merged
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
3d5ff27
Add bulk_untrack API
Zacqary e5ac9ec
Add bulk action for untracking alerts
Zacqary f5b6a81
Clear task state after bulk untrack
Zacqary 177f954
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine f793562
Fix jest
Zacqary 1d6ad2e
Fix typecheck
Zacqary b4c691c
Fix alert table test
Zacqary b4d6e09
Add permissions check for untracked action
Zacqary 652b96a
Merge remote-tracking branch 'origin/bulkaction-164059' into bulkacti…
Zacqary 596f24a
Fix typecheck
Zacqary bb39962
Add test for bulkUntrackAlerts method
Zacqary 1664888
Remove duplicate bulk untrack hook
Zacqary 834c4cb
Move setAlertsToUntracked test to own file
Zacqary 8391391
Add call snapshots to tests
Zacqary 14a4fa2
Fix i18n
Zacqary 32c5207
Check for empty ruleIds and uuids in setAlertsToUntracked
Zacqary f65925d
Add untrack call to delete rule api
Zacqary b151266
Fix jest
Zacqary ee620f7
Merge remote-tracking branch 'upstream/main' into bulkaction-164059
Zacqary 3050920
Remove untrack alert action from recovered alerts
Zacqary 90760a5
Throw error when only recovered alerts are bulk untracked
Zacqary eb12625
Filter untracked alerts out of active bucket on alert summary
Zacqary c22fbdb
Switch bulk untrack permission to cases update
Zacqary baf4aa4
Remove client-side permissions checks
Zacqary 732c7ae
Add auth check for untracking alerts
Zacqary a804a2e
Add comment
Zacqary 3c9aef8
Merge remote-tracking branch 'upstream/main' into bulkaction-164059
Zacqary 8f95088
Commit suggestions
Zacqary 00e9aad
Revert "Filter untracked alerts out of active bucket on alert summary"
Zacqary b2843ca
Update tests
Zacqary 5d1f040
Fix jest
Zacqary bf887b8
Merge remote-tracking branch 'upstream/main' into bulkaction-164059
Zacqary ed10945
Add o11y permissions check to bulk actions
Zacqary c506384
API integration test
JiaweiWu 7b2b491
Fix jest
Zacqary d7a65f5
Merge branch 'bulkaction-164059' of https://github.com/Zacqary/kibana…
Zacqary c15286b
Merge remote-tracking branch 'upstream/main' into bulkaction-164059
Zacqary 80c19e8
Add tests for removing expected uuids from task state
Zacqary 3e6c478
Fix snapshot
Zacqary 21f1dbf
delete alert even with conflict
XavierM ac63b3e
Merge branch 'bulkaction-164059' of github.com:Zacqary/kibana into bu…
XavierM 740a8b6
fix FTR
XavierM c0728bb
Fix untracking rules from bulk delete API
Zacqary 36780c3
Update permissions
Zacqary 31d27b2
Update permissions
Zacqary 50cb9da
Merge branch 'bulkaction-164059' of https://github.com/Zacqary/kibana…
Zacqary 171b0a6
Add error handling for bulk updater
Zacqary cd98921
Add bulkUpdateState test
Zacqary 2c6d1f2
Merge branch 'main' into bulkaction-164059
XavierM be2de2b
Add ensureAuthorized tests for setAlertsToUntracked
Zacqary e62a1f1
Merge branch 'bulkaction-164059' of https://github.com/Zacqary/kibana…
Zacqary 2a7b1a9
rules/_bulk_untrack -> alerts/_bulk_untrack
Zacqary 25114b3
Add conflicts: proceed to failing test
Zacqary b85edd2
add conflicts: "proceed"
XavierM File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
x-pack/plugins/alerting/common/routes/rule/apis/bulk_untrack/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| export { bulkUntrackBodySchema } from './schemas/latest'; | ||
| export { bulkUntrackBodySchema as bulkUntrackBodySchemaV1 } from './schemas/v1'; | ||
|
|
||
| export type { BulkUntrackRequestBody } from './types/latest'; | ||
| export type { BulkUntrackRequestBody as BulkUntrackRequestBodyV1 } from './types/v1'; |
7 changes: 7 additions & 0 deletions
7
x-pack/plugins/alerting/common/routes/rule/apis/bulk_untrack/schemas/latest.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
| export { bulkUntrackBodySchema } from './v1'; |
13 changes: 13 additions & 0 deletions
13
x-pack/plugins/alerting/common/routes/rule/apis/bulk_untrack/schemas/v1.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import { schema } from '@kbn/config-schema'; | ||
|
|
||
| export const bulkUntrackBodySchema = schema.object({ | ||
| indices: schema.arrayOf(schema.string()), | ||
| alert_uuids: schema.arrayOf(schema.string()), | ||
| }); |
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/alerting/common/routes/rule/apis/bulk_untrack/types/latest.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| export type { BulkUntrackRequestBody } from './v1'; |
10 changes: 10 additions & 0 deletions
10
x-pack/plugins/alerting/common/routes/rule/apis/bulk_untrack/types/v1.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
| import type { TypeOf } from '@kbn/config-schema'; | ||
| import { bulkUntrackBodySchemaV1 } from '..'; | ||
|
|
||
| export type BulkUntrackRequestBody = TypeOf<typeof bulkUntrackBodySchemaV1>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'm unsure that this method actually belongs in
AlertsServicerather thanAlertsClient, because it interacts with and updates alert data. However, we want to make it available without being connected to a Rule (which is a prerequisite for creating anAlertsClient), and it also doesn't actually need a corresponding Rule to operate.Not sure if there's a specific design goal re: Service vs. Client that I'm violating here with this, but it was the most expedient way I could think of to get this to work.
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.
This is probably fine for now. The initial intent was for the
AlertServiceto handle all of the framework level resource installation that's required to write alerts for a rule and thenAlertsClientto be the way for the alerting task runner to interact with those alerts. As you point out, there are use cases for users interacting directly with alerts. In the future, we may want to consolidate all of those interactions into a separate client but this is fine for now.