Skip to content

Commit a62cf99

Browse files
authored
[SIEM] [TIMELINE] Only add endpoint logo when on event.module === endgame (#56263) (#56269)
* only add endpoint logo when on event.module === endgame * fix filter for value
1 parent fe642ff commit a62cf99

File tree

2 files changed

+38
-27
lines changed

2 files changed

+38
-27
lines changed

x-pack/legacy/plugins/siem/public/components/page/add_filter_to_global_search_bar/helpers.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,36 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
export const createFilter = (key: string, value: string | null | undefined) =>
8-
value != null
7+
import { esFilters } from '../../../../../../../../src/plugins/data/public';
8+
9+
export const createFilter = (
10+
key: string,
11+
value: string[] | string | null | undefined
12+
): esFilters.Filter => {
13+
const queryValue = value != null ? (Array.isArray(value) ? value[0] : value) : null;
14+
return queryValue != null
915
? {
1016
meta: {
1117
alias: null,
1218
negate: false,
1319
disabled: false,
1420
type: 'phrase',
1521
key,
16-
value,
22+
value: queryValue,
1723
params: {
18-
query: value,
24+
query: queryValue,
1925
},
2026
},
2127
query: {
2228
match: {
2329
[key]: {
24-
query: value,
30+
query: queryValue,
2531
type: 'phrase',
2632
},
2733
},
2834
},
2935
}
30-
: {
36+
: ({
3137
exists: {
3238
field: key,
3339
},
@@ -39,4 +45,5 @@ export const createFilter = (key: string, value: string | null | undefined) =>
3945
type: 'exists',
4046
value: 'exists',
4147
},
42-
};
48+
} as esFilters.Filter);
49+
};

x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/formatted_field_helpers.tsx

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ export const renderRuleName = ({
5252
);
5353
};
5454

55+
const canYouAddEndpointLogo = (moduleName: string, endpointUrl: string | null | undefined) =>
56+
moduleName.trim().toLocaleLowerCase() === 'endgame' &&
57+
endpointUrl != null &&
58+
!isEmpty(endpointUrl) &&
59+
!isUrlInvalid(endpointUrl) &&
60+
endpointUrl.includes('/alerts/');
61+
5562
export const renderEventModule = ({
5663
contextId,
5764
eventId,
@@ -90,26 +97,23 @@ export const renderEventModule = ({
9097
{content}
9198
</DefaultDraggable>
9299
</EuiFlexItem>
93-
{endpointRefUrl != null &&
94-
!isEmpty(endpointRefUrl) &&
95-
!isUrlInvalid(endpointRefUrl) &&
96-
endpointRefUrl.includes('/alerts/') && (
97-
<EuiFlexItem grow={false}>
98-
<EuiToolTip
99-
data-test-subj="event-module-link-to-elastic-endpoint-security"
100-
content={
101-
<>
102-
<p>{i18n.LINK_ELASTIC_ENDPOINT_SECURITY}</p>
103-
<p>{endpointRefUrl}</p>
104-
</>
105-
}
106-
>
107-
<EuiLink href={endpointRefUrl} target="_blank">
108-
<EuiIcon type={endPointSvg} size="m" />
109-
</EuiLink>
110-
</EuiToolTip>
111-
</EuiFlexItem>
112-
)}
100+
{endpointRefUrl != null && canYouAddEndpointLogo(moduleName, endpointRefUrl) && (
101+
<EuiFlexItem grow={false}>
102+
<EuiToolTip
103+
data-test-subj="event-module-link-to-elastic-endpoint-security"
104+
content={
105+
<>
106+
<p>{i18n.LINK_ELASTIC_ENDPOINT_SECURITY}</p>
107+
<p>{endpointRefUrl}</p>
108+
</>
109+
}
110+
>
111+
<EuiLink href={endpointRefUrl} target="_blank">
112+
<EuiIcon type={endPointSvg} size="m" />
113+
</EuiLink>
114+
</EuiToolTip>
115+
</EuiFlexItem>
116+
)}
113117
</EuiFlexGroup>
114118
) : (
115119
getEmptyTagValue()

0 commit comments

Comments
 (0)