-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ram 145739 use bulk enable disable in UI (#145928)
Resolves: #145739 ## Summary In this PR I am enabling Enable and Disable in menu when Select all is chosen. And trigger new bulk enable/disable API when Enable/Disable option will be chosen. ### 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 Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
19413b7
commit c5f2072
Showing
16 changed files
with
847 additions
and
174 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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
31 changes: 31 additions & 0 deletions
31
x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/bulk_disable.ts
This file contains 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,31 @@ | ||
/* | ||
* 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 { HttpSetup } from '@kbn/core/public'; | ||
import { KueryNode } from '@kbn/es-query'; | ||
import { INTERNAL_BASE_ALERTING_API_PATH } from '../../constants'; | ||
import { BulkDisableResponse } from '../../../types'; | ||
|
||
export const bulkDisableRules = async ({ | ||
filter, | ||
ids, | ||
http, | ||
}: { | ||
filter?: KueryNode | null; | ||
ids?: string[]; | ||
http: HttpSetup; | ||
}): Promise<BulkDisableResponse> => { | ||
try { | ||
const body = JSON.stringify({ | ||
ids: ids?.length ? ids : undefined, | ||
...(filter ? { filter: JSON.stringify(filter) } : {}), | ||
}); | ||
|
||
return http.patch(`${INTERNAL_BASE_ALERTING_API_PATH}/rules/_bulk_disable`, { body }); | ||
} catch (e) { | ||
throw new Error(`Unable to parse bulk disable params: ${e}`); | ||
} | ||
}; |
31 changes: 31 additions & 0 deletions
31
x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/bulk_enable.ts
This file contains 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,31 @@ | ||
/* | ||
* 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 { HttpSetup } from '@kbn/core/public'; | ||
import { KueryNode } from '@kbn/es-query'; | ||
import { INTERNAL_BASE_ALERTING_API_PATH } from '../../constants'; | ||
import { BulkEnableResponse } from '../../../types'; | ||
|
||
export const bulkEnableRules = async ({ | ||
filter, | ||
ids, | ||
http, | ||
}: { | ||
filter?: KueryNode | null; | ||
ids?: string[]; | ||
http: HttpSetup; | ||
}): Promise<BulkEnableResponse> => { | ||
try { | ||
const body = JSON.stringify({ | ||
ids: ids?.length ? ids : undefined, | ||
...(filter ? { filter: JSON.stringify(filter) } : {}), | ||
}); | ||
|
||
return http.patch(`${INTERNAL_BASE_ALERTING_API_PATH}/rules/_bulk_enable`, { body }); | ||
} catch (e) { | ||
throw new Error(`Unable to parse bulk enable params: ${e}`); | ||
} | ||
}; |
This file contains 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 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.