-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security Solution] Editing rules independently of source data (#180407) #191487
Merged
e40pud
merged 10 commits into
elastic:main
from
e40pud:security/feature/180407-save-rules
Aug 30, 2024
+898
−138
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
010088d
[Security Solution] Editing rules independently of source data (#180407)
e40pud 4ee535f
Fix tests
e40pud d19001b
Merge branch 'main' into security/feature/180407-save-rules
elasticmachine 7b2616a
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine 94e879b
Merge branch 'main' into security/feature/180407-save-rules
elasticmachine b907087
Simplify confirmation modal description
e40pud a76369e
Update x-pack/plugins/security_solution/public/detection_engine/rule_…
e40pud 07a60cf
Merge branch 'main' into security/feature/180407-save-rules
elasticmachine 3c42ada
Merge branch 'main' into security/feature/180407-save-rules
elasticmachine 2cfbf72
Review feedback
e40pud 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
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
41 changes: 41 additions & 0 deletions
41
...blic/detection_engine/rule_creation_ui/components/save_with_errors_confirmation/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,41 @@ | ||
/* | ||
* 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 React from 'react'; | ||
|
||
import { EuiConfirmModal } from '@elastic/eui'; | ||
|
||
import * as i18n from './translations'; | ||
|
||
interface SaveWithErrorsModalProps { | ||
errors: string[]; | ||
onCancel: () => void; | ||
onConfirm: () => void; | ||
} | ||
|
||
const SaveWithErrorsModalComponent = ({ | ||
errors, | ||
onCancel, | ||
onConfirm, | ||
}: SaveWithErrorsModalProps) => { | ||
return ( | ||
<EuiConfirmModal | ||
data-test-subj="save-with-errors-confirmation-modal" | ||
title={i18n.SAVE_WITH_ERRORS_MODAL_TITLE} | ||
onCancel={onCancel} | ||
onConfirm={onConfirm} | ||
cancelButtonText={i18n.SAVE_WITH_ERRORS_CANCEL_BUTTON} | ||
confirmButtonText={i18n.SAVE_WITH_ERRORS_CONFIRM_BUTTON} | ||
defaultFocusedButton="confirm" | ||
> | ||
<>{i18n.SAVE_WITH_ERRORS_MODAL_MESSAGE(errors.length)}</> | ||
</EuiConfirmModal> | ||
); | ||
}; | ||
|
||
export const SaveWithErrorsModal = React.memo(SaveWithErrorsModalComponent); | ||
SaveWithErrorsModal.displayName = 'SaveWithErrorsModal'; |
36 changes: 36 additions & 0 deletions
36
...etection_engine/rule_creation_ui/components/save_with_errors_confirmation/translations.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,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 { i18n } from '@kbn/i18n'; | ||
|
||
export const SAVE_WITH_ERRORS_MODAL_TITLE = i18n.translate( | ||
'xpack.securitySolution.detectionEngine.createRule.saveWithErrorsModalTitle', | ||
{ | ||
defaultMessage: 'This rule has validation errors', | ||
} | ||
); | ||
|
||
export const SAVE_WITH_ERRORS_CANCEL_BUTTON = i18n.translate( | ||
'xpack.securitySolution.detectionEngine.createRule.saveWithErrorsCancelButton', | ||
{ | ||
defaultMessage: 'Cancel', | ||
} | ||
); | ||
|
||
export const SAVE_WITH_ERRORS_CONFIRM_BUTTON = i18n.translate( | ||
'xpack.securitySolution.detectionEngine.createRule.saveWithErrorsConfirmButton', | ||
{ | ||
defaultMessage: 'Confirm', | ||
} | ||
); | ||
|
||
export const SAVE_WITH_ERRORS_MODAL_MESSAGE = (errorsCount: number) => | ||
i18n.translate('xpack.securitySolution.detectionEngine.createRule.saveWithErrorsModalMessage', { | ||
defaultMessage: | ||
'This rule has {errorsCount} validation {errorsCount, plural, one {error} other {errors}} which can lead to failed rule executions, save anyway?', | ||
values: { errorsCount }, | ||
}); |
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.
@e40pud
is this fine user that user sees some error, but can't go to Definition tab or see error itself?
I imagine it will be a case until full support of prebuilt rule editing will be released.
But before that, it can affect Serverless releases
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.
What you see right now is the current behaviour on both ESS and Serverless. Users are unable to modify prebuilt rules. They have to duplicate prebuilt rules right now to be able to adjust rule's properties.
The whole "rule customization" effort will allow user to do that without duplication.
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 am aware, prebuilt rule can't be modified.
It's the fact that we show user step is invalid without showing actual error and additional information how that can affect rule's behavior.
Is there a way for user in this situation to see actual error?
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.
As discussed here is the ticket to discuss this behaviour #191832