mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
* only add endpoint logo when on event.module === endgame * fix filter for value
This commit is contained in:
parent
cd41d4ec72
commit
63e435c866
2 changed files with 38 additions and 27 deletions
|
@ -4,8 +4,14 @@
|
|||
* 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,
|
||||
|
@ -13,21 +19,21 @@ export const createFilter = (key: string, value: string | null | undefined) =>
|
|||
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,
|
||||
},
|
||||
|
@ -39,4 +45,5 @@ export const createFilter = (key: string, value: string | null | undefined) =>
|
|||
type: 'exists',
|
||||
value: 'exists',
|
||||
},
|
||||
};
|
||||
} as esFilters.Filter);
|
||||
};
|
||||
|
|
|
@ -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,
|
||||
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue