-
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] Show rule actions on Rule Details page (#158189)
**Resolves: #154879 ## Summary Adds a list of notification and response actions to the Rule Details page. <img width="1582" alt="Screenshot 2023-06-05 at 11 42 24" src="https://github.com/elastic/kibana/assets/15949146/afb749d4-734e-4049-bbe2-9168186c9863"> ### Checklist - [x] 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 - [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 - [x] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [x] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [x] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
- Loading branch information
1 parent
968d786
commit c191104
Showing
11 changed files
with
502 additions
and
13 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
29 changes: 29 additions & 0 deletions
29
...ugins/security_solution/public/detection_engine/rule_management/api/hooks/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,29 @@ | ||
/* | ||
* 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 CONNECTORS_FETCH_ERROR = i18n.translate( | ||
'xpack.securitySolution.detectionEngine.ruleDetails.actions.connectorsFetchError', | ||
{ | ||
defaultMessage: 'Failed to fetch connectors', | ||
} | ||
); | ||
|
||
export const CONNECTOR_TYPES_FETCH_ERROR = i18n.translate( | ||
'xpack.securitySolution.detectionEngine.ruleDetails.actions.connectorTypesFetchError', | ||
{ | ||
defaultMessage: 'Failed to fetch connector types', | ||
} | ||
); | ||
|
||
export const ACTIONS_FETCH_ERROR_DESCRIPTION = i18n.translate( | ||
'xpack.securitySolution.detectionEngine.ruleDetails.actions.actionsFetchErrorDescription', | ||
{ | ||
defaultMessage: 'Viewing actions is not available', | ||
} | ||
); |
46 changes: 46 additions & 0 deletions
46
...curity_solution/public/detection_engine/rule_management/api/hooks/use_fetch_connectors.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,46 @@ | ||
/* | ||
* 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 { useQuery } from '@tanstack/react-query'; | ||
import { BASE_ACTION_API_PATH } from '@kbn/actions-plugin/common'; | ||
import { useAppToasts } from '../../../../common/hooks/use_app_toasts'; | ||
import { fetchConnectors, fetchConnectorTypes } from '../api'; | ||
import * as i18n from './translations'; | ||
|
||
export const useFetchConnectors = () => { | ||
const { addError } = useAppToasts(); | ||
|
||
return useQuery( | ||
['GET', BASE_ACTION_API_PATH, 'connectors'], | ||
({ signal }) => fetchConnectors(signal), | ||
{ | ||
onError: (error) => { | ||
addError(error, { | ||
title: i18n.CONNECTORS_FETCH_ERROR, | ||
toastMessage: i18n.ACTIONS_FETCH_ERROR_DESCRIPTION, | ||
}); | ||
}, | ||
} | ||
); | ||
}; | ||
|
||
export const useFetchConnectorTypes = () => { | ||
const { addError } = useAppToasts(); | ||
|
||
return useQuery( | ||
['GET', BASE_ACTION_API_PATH, 'connector_types', 'siem'], | ||
({ signal }) => fetchConnectorTypes(signal), | ||
{ | ||
onError: (error) => { | ||
addError(error, { | ||
title: i18n.CONNECTOR_TYPES_FETCH_ERROR, | ||
toastMessage: i18n.ACTIONS_FETCH_ERROR_DESCRIPTION, | ||
}); | ||
}, | ||
} | ||
); | ||
}; |
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.