-
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.
[Security Solution] Rule Updates in bulk with conflicts (#196776)
Resolves: #180589 ## Summary - Handles bulk updating of rules with conflicts in the Rule Upgrades table. See detailed requirements implemented in ticket linked above. - Changes default `pick_version` of both the `/upgrade/_perform` endpoint, and of the request payloads for that endpoint from the frontend, from `TARGET` to `MERGED`, when the `isPrebuiltRulesCustomizationEnabled` is `true`. - **Also:** handles issue in `/upgrade/_perform` endpoint with the `index` and `data_view_id` fields. See file: `x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/api/perform_rule_upgrade/diffable_rule_fields_mappings.ts`. **See demo video:** https://www.loom.com/share/90d94d2a8f16442b9a43a425eeab6697 **New copy in warning modal** <img width="1660" alt="image" src="https://github.com/user-attachments/assets/85632192-142a-4e12-b396-1eb2320ca3f4"> **Newly added tooltips:** ![image](https://github.com/user-attachments/assets/7ada117e-57a7-4699-ad08-312c734586d9) ![image](https://github.com/user-attachments/assets/c8ed80ac-c1c3-48f1-8f8e-2433415a6772) ![image](https://github.com/user-attachments/assets/d77ed6f0-5d65-4933-9012-f6cd153a9350) ### Checklist Delete any items that are not applicable to this PR. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels) - [ ] This will appear in the **Release Notes** and follow the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: Nastasha Solomon <[email protected]> Co-authored-by: Dmitrii <[email protected]>
- Loading branch information
1 parent
961796d
commit 99160f5
Showing
24 changed files
with
555 additions
and
163 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
File renamed without changes.
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
49 changes: 0 additions & 49 deletions
49
...engine/rule_management/api/hooks/prebuilt_rules/use_perform_all_rules_upgrade_mutation.ts
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
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
36 changes: 36 additions & 0 deletions
36
...ponents/rules_table/upgrade_prebuilt_rules_table/modals/upgrade_conflicts_modal/index.tsx
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,36 @@ | ||
/* | ||
* 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 { EuiConfirmModal, EuiText } from '@elastic/eui'; | ||
import React, { memo } from 'react'; | ||
import * as i18n from './translations'; | ||
|
||
export interface UpgradeConflictsModalProps { | ||
onCancel: ( | ||
event?: React.KeyboardEvent<HTMLDivElement> | React.MouseEvent<HTMLButtonElement> | ||
) => void; | ||
onConfirm?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void; | ||
} | ||
|
||
const UpgradeConflictsModalComponent = ({ onCancel, onConfirm }: UpgradeConflictsModalProps) => { | ||
return ( | ||
<EuiConfirmModal | ||
title={i18n.UPGRADE_CONFLICTS_MODAL_TITLE} | ||
onCancel={onCancel} | ||
onConfirm={onConfirm} | ||
cancelButtonText={i18n.UPGRADE_CONFLICTS_MODAL_CANCEL} | ||
confirmButtonText={i18n.UPGRADE_CONFLICTS_MODAL_CONFIRM} | ||
buttonColor="primary" | ||
defaultFocusedButton="confirm" | ||
data-test-subj="upgradeConflictsModal" | ||
> | ||
<EuiText>{i18n.UPGRADE_CONFLICTS_MODAL_BODY}</EuiText> | ||
</EuiConfirmModal> | ||
); | ||
}; | ||
|
||
export const UpgradeConflictsModal = memo(UpgradeConflictsModalComponent); |
37 changes: 37 additions & 0 deletions
37
.../rules_table/upgrade_prebuilt_rules_table/modals/upgrade_conflicts_modal/translations.tsx
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,37 @@ | ||
/* | ||
* 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 { i18n } from '@kbn/i18n'; | ||
|
||
export const UPGRADE_CONFLICTS_MODAL_TITLE = i18n.translate( | ||
'xpack.securitySolution.detectionEngine.upgradeConflictsModal.messageTitle', | ||
{ | ||
defaultMessage: 'Update rules without conflicts?', | ||
} | ||
); | ||
|
||
export const UPGRADE_CONFLICTS_MODAL_CANCEL = i18n.translate( | ||
'xpack.securitySolution.detectionEngine.upgradeConflictsModal.cancelTitle', | ||
{ | ||
defaultMessage: 'Cancel', | ||
} | ||
); | ||
|
||
export const UPGRADE_CONFLICTS_MODAL_CONFIRM = i18n.translate( | ||
'xpack.securitySolution.detectionEngine.upgradeConflictsModal.confirmTitle', | ||
{ | ||
defaultMessage: 'Update rules without conflicts', | ||
} | ||
); | ||
|
||
export const UPGRADE_CONFLICTS_MODAL_BODY = i18n.translate( | ||
'xpack.securitySolution.detectionEngine.upgradeConflictsModal.affectedJobsTitle', | ||
{ | ||
defaultMessage: | ||
"Some of the selected rules have conflicts and, for that reason, won't be updated. Resolve the conflicts to properly update the rules.", | ||
} | ||
); |
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.