-
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.
Browse files
Browse the repository at this point in the history
* add rule.reference * Fix Load more * Fix spacing * Fix loading on hist graph detections * add tooltip
- Loading branch information
Showing
17 changed files
with
287 additions
and
34 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
155 changes: 155 additions & 0 deletions
155
...legacy/plugins/siem/public/components/timeline/body/renderers/formatted_field_helpers.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,155 @@ | ||
/* | ||
* 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 { EuiLink, EuiFlexGroup, EuiFlexItem, EuiIcon, EuiToolTip } from '@elastic/eui'; | ||
import { isString, isEmpty } from 'lodash/fp'; | ||
import React from 'react'; | ||
|
||
import { DefaultDraggable } from '../../../draggables'; | ||
import { getEmptyTagValue } from '../../../empty_value'; | ||
import { getRuleDetailsUrl } from '../../../link_to/redirect_to_detection_engine'; | ||
import { TruncatableText } from '../../../truncatable_text'; | ||
|
||
import { isUrlInvalid } from '../../../../pages/detection_engine/rules/components/step_about_rule/helpers'; | ||
import endPointSvg from '../../../../utils/logo_endpoint/64_color.svg'; | ||
|
||
import * as i18n from './translations'; | ||
|
||
export const renderRuleName = ({ | ||
contextId, | ||
eventId, | ||
fieldName, | ||
linkValue, | ||
truncate, | ||
value, | ||
}: { | ||
contextId: string; | ||
eventId: string; | ||
fieldName: string; | ||
linkValue: string | null | undefined; | ||
truncate?: boolean; | ||
value: string | number | null | undefined; | ||
}) => { | ||
const ruleName = `${value}`; | ||
const ruleId = linkValue; | ||
|
||
const content = truncate ? <TruncatableText>{value}</TruncatableText> : value; | ||
|
||
return isString(value) && ruleName.length > 0 && ruleId != null ? ( | ||
<DefaultDraggable | ||
field={fieldName} | ||
id={`event-details-value-default-draggable-${contextId}-${eventId}-${fieldName}-${value}-${ruleId}`} | ||
tooltipContent={value} | ||
value={value} | ||
> | ||
<EuiLink href={getRuleDetailsUrl(ruleId)}>{content}</EuiLink> | ||
</DefaultDraggable> | ||
) : ( | ||
getEmptyTagValue() | ||
); | ||
}; | ||
|
||
export const renderEventModule = ({ | ||
contextId, | ||
eventId, | ||
fieldName, | ||
linkValue, | ||
truncate, | ||
value, | ||
}: { | ||
contextId: string; | ||
eventId: string; | ||
fieldName: string; | ||
linkValue: string | null | undefined; | ||
truncate?: boolean; | ||
value: string | number | null | undefined; | ||
}) => { | ||
const moduleName = `${value}`; | ||
const endpointRefUrl = linkValue; | ||
|
||
const content = truncate ? <TruncatableText>{value}</TruncatableText> : value; | ||
|
||
return isString(value) && moduleName.length > 0 ? ( | ||
<EuiFlexGroup | ||
gutterSize="none" | ||
alignItems="center" | ||
justifyContent={ | ||
endpointRefUrl != null && !isEmpty(endpointRefUrl) ? 'flexStart' : 'spaceBetween' | ||
} | ||
> | ||
<EuiFlexItem> | ||
<DefaultDraggable | ||
field={fieldName} | ||
id={`event-details-value-default-draggable-${contextId}-${eventId}-${fieldName}-${value}-${moduleName}`} | ||
tooltipContent={value} | ||
value={value} | ||
> | ||
{content} | ||
</DefaultDraggable> | ||
</EuiFlexItem> | ||
{endpointRefUrl != null && | ||
!isEmpty(endpointRefUrl) && | ||
!isUrlInvalid(endpointRefUrl) && | ||
endpointRefUrl.includes('/alerts/') && ( | ||
<EuiFlexItem grow={false}> | ||
<EuiToolTip | ||
data-test-subj="event-module-link-to-elastic-endpoint-security" | ||
content={ | ||
<> | ||
<p>{i18n.LINK_ELASTIC_ENDPOINT_SECURITY}</p> | ||
<p>{endpointRefUrl}</p> | ||
</> | ||
} | ||
> | ||
<EuiLink href={endpointRefUrl} target="_blank"> | ||
<EuiIcon type={endPointSvg} size="m" /> | ||
</EuiLink> | ||
</EuiToolTip> | ||
</EuiFlexItem> | ||
)} | ||
</EuiFlexGroup> | ||
) : ( | ||
getEmptyTagValue() | ||
); | ||
}; | ||
|
||
export const renderRulReference = ({ | ||
contextId, | ||
eventId, | ||
fieldName, | ||
linkValue, | ||
truncate, | ||
value, | ||
}: { | ||
contextId: string; | ||
eventId: string; | ||
fieldName: string; | ||
linkValue: string | null | undefined; | ||
truncate?: boolean; | ||
value: string | number | null | undefined; | ||
}) => { | ||
const referenceUrlName = `${value}`; | ||
|
||
const content = truncate ? <TruncatableText>{value}</TruncatableText> : value; | ||
|
||
return isString(value) && referenceUrlName.length > 0 ? ( | ||
<DefaultDraggable | ||
field={fieldName} | ||
id={`event-details-value-default-draggable-${contextId}-${eventId}-${fieldName}-${value}-${referenceUrlName}`} | ||
tooltipContent={value} | ||
value={value} | ||
> | ||
{!isUrlInvalid(referenceUrlName) && ( | ||
<EuiLink target="_blank" href={referenceUrlName}> | ||
{content} | ||
</EuiLink> | ||
)} | ||
{isUrlInvalid(referenceUrlName) && <>{content}</>} | ||
</DefaultDraggable> | ||
) : ( | ||
getEmptyTagValue() | ||
); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,6 +134,9 @@ export const timelineQuery = gql` | |
name | ||
ip | ||
} | ||
rule { | ||
reference | ||
} | ||
source { | ||
bytes | ||
ip | ||
|
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
Oops, something went wrong.