forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] Editing rules independently of source data (elast…
- Loading branch information
Showing
13 changed files
with
566 additions
and
108 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
...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,53 @@ | ||
/* | ||
* 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, EuiSpacer, EuiText } 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)} | ||
<EuiSpacer size="s" /> | ||
<ul> | ||
{errors.map((validationError, idx) => { | ||
return ( | ||
<li key={idx}> | ||
<EuiText>{validationError}</EuiText> | ||
</li> | ||
); | ||
})} | ||
</ul> | ||
</> | ||
</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 }, | ||
}); |
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.