Skip to content
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 @@ -8,7 +8,7 @@ import { EuiIcon } from '@elastic/eui';
import { transparentize } from 'polished';
import React from 'react';
import { AutocompleteSuggestion } from 'ui/autocomplete_providers';

import styled from 'styled-components';
import euiStyled from '../../../../../common/eui_styled_components';

interface SuggestionItemProps {
Expand Down Expand Up @@ -64,7 +64,7 @@ const SuggestionItemField = euiStyled.div`
padding: ${props => props.theme.eui.euiSizeXS};
`;

const SuggestionItemIconField = SuggestionItemField.extend<{ suggestionType: string }>`
const SuggestionItemIconField = styled(SuggestionItemField)<{ suggestionType: string }>`
background-color: ${props =>
transparentize(0.9, getEuiIconColor(props.theme, props.suggestionType))};
color: ${props => getEuiIconColor(props.theme, props.suggestionType)};
Expand All @@ -73,12 +73,12 @@ const SuggestionItemIconField = SuggestionItemField.extend<{ suggestionType: str
width: ${props => props.theme.eui.euiSizeXL};
`;

const SuggestionItemTextField = SuggestionItemField.extend`
const SuggestionItemTextField = styled(SuggestionItemField)`
flex: 2 0 0;
font-family: ${props => props.theme.eui.euiCodeFontFamily};
`;

const SuggestionItemDescriptionField = SuggestionItemField.extend`
const SuggestionItemDescriptionField = styled(SuggestionItemField)`
flex: 3 0 0;

p {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,10 @@ export const getColumns = ({
},
{
field: 'valuesConcatenated',
name: i18n.BLANK,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrew-goldstein does this look ok to you? i think this is a hidden (1px) column, so I just put a blank name as it is a required prop

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this looks good. The contents of this field are not rendered. It exists to allow filtering on multiple values like IP addresses, when those values are encoded as an array instead of a string. I ran this branch locally and verified that filtering continues to work for hosts that have multiple IP addresses, i.e. siem-es.

render: () => null,
sortable: false,
truncateText: true,
render: () => null,
width: '1px',
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export const DESCRIPTION = i18n.translate('xpack.siem.eventDetails.description',
defaultMessage: 'Description',
});

export const BLANK = i18n.translate('xpack.siem.eventDetails.blank', {
defaultMessage: ' ',
});

export const PLACEHOLDER = i18n.translate('xpack.siem.eventDetails.filter.placeholder', {
defaultMessage: 'Filter by Field, Value, or Description...',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@
import { entityToKql, entitiesToKql, addEntitiesToKql } from './add_entities_to_kql';

describe('add_entities_to_kql', () => {
// Suppress warnings about invalid RISON as this is what we are testing
/* eslint-disable no-console */
const originalError = console.log;
beforeAll(() => {
console.log = jest.fn();
});

afterAll(() => {
console.log = originalError;
});
describe('#entityToKql', () => {
test('returns empty string with no entity names defined and an empty entity string', () => {
const entity = entityToKql([], '');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@

import { replaceKqlQueryLocationForHostPage } from './replace_kql_query_location_for_host_page';

// Suppress warnings about invalid RISON as this is what we are testing
/* eslint-disable no-console */
const originalError = console.log;
describe('replace_kql_query_location_for_host_page', () => {
beforeAll(() => {
console.log = jest.fn();
});

afterAll(() => {
console.log = originalError;
});
test('replaces host details and type details for a page', () => {
const replacement = replaceKqlQueryLocationForHostPage(
'(filterQuery:(expression:\'process.name: "some-name"\',kind:kuery),queryLocation:hosts.details,type:details)'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@
*/

import { replaceKqlQueryLocationForNetworkPage } from './replace_kql_query_location_for_network_page';

// Suppress warnings about invalid RISON as this is what we are testing
/* eslint-disable no-console */
const originalError = console.log;
describe('replace_kql_query_location_for_host_page', () => {
beforeAll(() => {
console.log = jest.fn();
});

afterAll(() => {
console.log = originalError;
});
test('replaces host details and type details for a page', () => {
const replacement = replaceKqlQueryLocationForNetworkPage(
'(filterQuery:(expression:\'process.name: "some-name"\',kind:kuery),queryLocation:network.details,type:details)'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@
import { decodeRison, isRisonObject, isRegularString } from './rison_helpers';

describe('rison_helpers', () => {
// Suppress warnings about invalid RISON as this is what we are testing
/* eslint-disable no-console */
const originalError = console.log;
describe('#decodeRison', () => {
beforeAll(() => {
console.log = jest.fn();
});

afterAll(() => {
console.log = originalError;
});
test('returns null if given a bad value for RISON', () => {
const expected = decodeRison('some invalid value');
expect(expected).toEqual(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiButtonIcon, EuiToolTip } from '@elastic/eui';
import { EuiButtonIcon, EuiToolTip, EuiIcon } from '@elastic/eui';
import * as React from 'react';
import styled from 'styled-components';

import { ACTION_COLUMN_WIDTH, PositionedIcon } from './common_styles';
import { DeleteTimelines, OnOpenTimeline, OpenTimelineResult } from '../types';
import { DeleteTimelineModalButton } from '../delete_timeline_modal';

import * as i18n from '../translations';

const HeaderIcon = styled(EuiIcon)`
position: relative;
left: 9px;
`;

/**
* Returns the action columns (e.g. delete, open duplicate timeline)
*/
Expand All @@ -26,7 +32,12 @@ export const getActionsColumns = ({
showDeleteAction: boolean;
}) => {
const deleteTimelineColumn = {
align: 'center',
align: 'right',
name: (
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrew-goldstein does this look ok to you? it adds a header icon to these columns

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you be willing to check with @MichaelMarcialis to see how feels about this change, since it's a departure from the wireframe shown in the screenshot below?

timelines-page

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, missed my window to respond. I'll have a look at the change when I pull in master on my local.

<EuiToolTip content={i18n.DELETE}>
<HeaderIcon data-test-subj="delete-header-icon" size="s" color="subdued" type="trash" />
</EuiToolTip>
),
field: 'savedObjectId',
render: (savedObjectId: string, { title }: OpenTimelineResult) => (
<PositionedIcon>
Expand All @@ -42,7 +53,12 @@ export const getActionsColumns = ({
};

const openAsDuplicateColumn = {
align: 'center',
align: 'right',
name: (
<EuiToolTip content={i18n.OPEN_AS_DUPLICATE}>
<HeaderIcon data-test-subj="duplicate-header-icon" size="s" color="subdued" type="copy" />
</EuiToolTip>
),
field: 'savedObjectId',
render: (savedObjectId: string, timelineResult: OpenTimelineResult) => (
<PositionedIcon>
Expand Down
Loading