-
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.
[SIEM][Detection Engine] Fix StepDescription value in StepRuleActions (…
- Loading branch information
1 parent
68432da
commit 533b481
Showing
6 changed files
with
82 additions
and
6 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
x-pack/plugins/siem/public/alerts/components/rules/description_step/actions_description.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,35 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { startCase } from 'lodash/fp'; | ||
import { AlertAction } from '../../../../../../alerting/common'; | ||
|
||
const ActionsDescription = ({ actions }: { actions: AlertAction[] }) => { | ||
if (!actions.length) return null; | ||
|
||
return ( | ||
<ul> | ||
{actions.map((action, index) => ( | ||
<li key={index}>{getActionTypeName(action.actionTypeId)}</li> | ||
))} | ||
</ul> | ||
); | ||
}; | ||
|
||
export const buildActionsDescription = (actions: AlertAction[], title: string) => ({ | ||
title: actions.length ? title : '', | ||
description: <ActionsDescription actions={actions} />, | ||
}); | ||
|
||
const getActionTypeName = (actionTypeId: AlertAction['actionTypeId']) => { | ||
if (!actionTypeId) return ''; | ||
const actionType = actionTypeId.split('.')[1]; | ||
|
||
if (!actionType) return ''; | ||
|
||
return startCase(actionType); | ||
}; |
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
17 changes: 17 additions & 0 deletions
17
x-pack/plugins/siem/public/alerts/components/rules/description_step/throttle_description.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,17 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { find } from 'lodash/fp'; | ||
import { THROTTLE_OPTIONS, DEFAULT_THROTTLE_OPTION } from '../throttle_select_field'; | ||
|
||
export const buildThrottleDescription = (value = DEFAULT_THROTTLE_OPTION.value, title: string) => { | ||
const throttleOption = find(['value', value], THROTTLE_OPTIONS); | ||
|
||
return { | ||
title, | ||
description: throttleOption ? throttleOption.text : value, | ||
}; | ||
}; |
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