-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] Add a missing domain tag to Endpoint Exceptions A…
…PI (#193019) **Addresses:** #183375 This PR adds a missing domain tag to Endpoint Exceptions API. The rest API endpoints got their tags in #189621. (cherry picked from commit 09374ad)
- Loading branch information
Showing
95 changed files
with
1,934 additions
and
872 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
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
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
79 changes: 79 additions & 0 deletions
79
x-pack/plugins/security_solution/public/common/test/eui/combobox.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,79 @@ | ||
/* | ||
* 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 { act, fireEvent, waitFor } from '@testing-library/react'; | ||
|
||
export function showEuiComboBoxOptions(comboBoxToggleButton: HTMLElement): Promise<void> { | ||
fireEvent.click(comboBoxToggleButton); | ||
|
||
return waitFor(() => { | ||
const listWithOptionsElement = document.querySelector('[role="listbox"]'); | ||
const emptyListElement = document.querySelector('.euiComboBoxOptionsList__empty'); | ||
|
||
expect(listWithOptionsElement || emptyListElement).toBeInTheDocument(); | ||
}); | ||
} | ||
|
||
type SelectEuiComboBoxOptionParameters = | ||
| { | ||
comboBoxToggleButton: HTMLElement; | ||
optionIndex: number; | ||
optionText?: undefined; | ||
} | ||
| { | ||
comboBoxToggleButton: HTMLElement; | ||
optionText: string; | ||
optionIndex?: undefined; | ||
}; | ||
|
||
export function selectEuiComboBoxOption({ | ||
comboBoxToggleButton, | ||
optionIndex, | ||
optionText, | ||
}: SelectEuiComboBoxOptionParameters): Promise<void> { | ||
return act(async () => { | ||
await showEuiComboBoxOptions(comboBoxToggleButton); | ||
|
||
const options = Array.from( | ||
document.querySelectorAll('[data-test-subj*="comboBoxOptionsList"] [role="option"]') | ||
); | ||
|
||
if (typeof optionText === 'string') { | ||
const optionToSelect = options.find((option) => option.textContent === optionText); | ||
|
||
if (optionToSelect) { | ||
fireEvent.click(optionToSelect); | ||
} else { | ||
throw new Error( | ||
`Could not find option with text "${optionText}". Available options: ${options | ||
.map((option) => option.textContent) | ||
.join(', ')}` | ||
); | ||
} | ||
} else { | ||
fireEvent.click(options[optionIndex]); | ||
} | ||
}); | ||
} | ||
|
||
export function selectFirstEuiComboBoxOption({ | ||
comboBoxToggleButton, | ||
}: { | ||
comboBoxToggleButton: HTMLElement; | ||
}): Promise<void> { | ||
return selectEuiComboBoxOption({ comboBoxToggleButton, optionIndex: 0 }); | ||
} | ||
|
||
export function clearEuiComboBoxSelection({ | ||
clearButton, | ||
}: { | ||
clearButton: HTMLElement; | ||
}): Promise<void> { | ||
return act(async () => { | ||
fireEvent.click(clearButton); | ||
}); | ||
} |
64 changes: 64 additions & 0 deletions
64
...ine/rule_creation/components/alert_suppression_edit/components/alert_suppression_edit.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,64 @@ | ||
/* | ||
* 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, { memo } from 'react'; | ||
import { EuiPanel, EuiText, EuiToolTip } from '@elastic/eui'; | ||
import type { DataViewFieldBase } from '@kbn/es-query'; | ||
import { useFormData } from '../../../../../shared_imports'; | ||
import { MissingFieldsStrategySelector } from './missing_fields_strategy_selector'; | ||
import { SuppressionDurationSelector } from './suppression_duration_selector'; | ||
import { SuppressionFieldsSelector } from './suppression_fields_selector'; | ||
import { ALERT_SUPPRESSION_FIELDS_FIELD_NAME } from '../constants/fields'; | ||
|
||
interface AlertSuppressionEditProps { | ||
suppressibleFields: DataViewFieldBase[]; | ||
labelAppend?: React.ReactNode; | ||
disabled?: boolean; | ||
disabledText?: string; | ||
warningText?: string; | ||
} | ||
|
||
export const AlertSuppressionEdit = memo(function AlertSuppressionEdit({ | ||
suppressibleFields, | ||
labelAppend, | ||
disabled, | ||
disabledText, | ||
warningText, | ||
}: AlertSuppressionEditProps): JSX.Element { | ||
const [{ [ALERT_SUPPRESSION_FIELDS_FIELD_NAME]: suppressionFields }] = useFormData<{ | ||
[ALERT_SUPPRESSION_FIELDS_FIELD_NAME]: string[]; | ||
}>({ | ||
watch: ALERT_SUPPRESSION_FIELDS_FIELD_NAME, | ||
}); | ||
const hasSelectedFields = suppressionFields?.length > 0; | ||
const content = ( | ||
<> | ||
<SuppressionFieldsSelector | ||
suppressibleFields={suppressibleFields} | ||
labelAppend={labelAppend} | ||
disabled={disabled} | ||
/> | ||
{warningText && ( | ||
<EuiText size="xs" color="warning" data-test-subj="alertSuppressionWarning"> | ||
{warningText} | ||
</EuiText> | ||
)} | ||
<EuiPanel paddingSize="m" hasShadow={false}> | ||
<SuppressionDurationSelector disabled={disabled || !hasSelectedFields} /> | ||
<MissingFieldsStrategySelector disabled={disabled || !hasSelectedFields} /> | ||
</EuiPanel> | ||
</> | ||
); | ||
|
||
return disabled && disabledText ? ( | ||
<EuiToolTip position="right" content={disabledText}> | ||
{content} | ||
</EuiToolTip> | ||
) : ( | ||
content | ||
); | ||
}); |
Oops, something went wrong.