Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SIEM] [TIMELINE] Only add endpoint logo when on event.module === endgame #56263

Merged
merged 2 commits into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,36 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const createFilter = (key: string, value: string | null | undefined) =>
value != null
import { esFilters } from '../../../../../../../../src/plugins/data/public';

export const createFilter = (
key: string,
value: string[] | string | null | undefined
): esFilters.Filter => {
const queryValue = value != null ? (Array.isArray(value) ? value[0] : value) : null;
return queryValue != null
? {
meta: {
alias: null,
negate: false,
disabled: false,
type: 'phrase',
key,
value,
value: queryValue,
params: {
query: value,
query: queryValue,
},
},
query: {
match: {
[key]: {
query: value,
query: queryValue,
type: 'phrase',
},
},
},
}
: {
: ({
exists: {
field: key,
},
Expand All @@ -39,4 +45,5 @@ export const createFilter = (key: string, value: string | null | undefined) =>
type: 'exists',
value: 'exists',
},
};
} as esFilters.Filter);
};
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ export const renderRuleName = ({
);
};

const canYouAddEndpointLogo = (moduleName: string, endpointUrl: string | null | undefined) =>
moduleName.trim().toLocaleLowerCase() === 'endgame' &&
endpointUrl != null &&
!isEmpty(endpointUrl) &&
!isUrlInvalid(endpointUrl) &&
endpointUrl.includes('/alerts/');

export const renderEventModule = ({
contextId,
eventId,
Expand Down Expand Up @@ -90,26 +97,23 @@ export const renderEventModule = ({
{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>
)}
{endpointRefUrl != null && canYouAddEndpointLogo(moduleName, endpointRefUrl) && (
<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()
Expand Down