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] Inject/apply KQL changed in refresh button #45065

Merged
merged 9 commits into from
Sep 11, 2019
Merged
Show file tree
Hide file tree
Changes from 7 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 @@ -5,7 +5,7 @@
*/

import { EuiTabbedContent, EuiTabbedContentTab } from '@elastic/eui';
import React, { useContext } from 'react';
import React from 'react';
import styled from 'styled-components';

import { BrowserFields } from '../../containers/source';
Expand All @@ -16,7 +16,7 @@ import { OnUpdateColumns } from '../timeline/events';
import { EventFieldsBrowser } from './event_fields_browser';
import { JsonView } from './json_view';
import * as i18n from './translations';
import { TimelineWidthContext } from '../timeline/timeline_context';
import { useTimelineWidthContext } from '../timeline/timeline_context';

export type View = 'table-view' | 'json-view';

Expand Down Expand Up @@ -51,7 +51,7 @@ export const EventDetails = React.memo<Props>(
timelineId,
toggleColumn,
}) => {
const width = useContext(TimelineWidthContext);
const width = useTimelineWidthContext();
const tabs: EuiTabbedContentTab[] = [
{
id: 'table-view',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ import { DataProvider } from '../timeline/data_providers/data_provider';
import { OnChangeItemsPerPage } from '../timeline/events';
import { Footer, footerHeight } from '../timeline/footer';
import { combineQueries } from '../timeline/helpers';
import { TimelineRefetch } from '../timeline/refetch_timeline';
import { isCompactFooter } from '../timeline/timeline';
import { TimelineContext, TimelineWidthContext } from '../timeline/timeline_context';
import { ManageTimelineContext } from '../timeline/timeline_context';

import { EventsViewerHeader } from './events_viewer_header';

Expand Down Expand Up @@ -115,7 +114,6 @@ export const EventsViewer = React.memo<Props>(
style={{ height: '0px', width: '100%' }}
/>
</WrappedByAutoSizer>

{combinedQueries != null ? (
<TimelineQuery
fields={columnsHeader.map(c => c.id)}
Expand All @@ -138,46 +136,44 @@ export const EventsViewer = React.memo<Props>(
refetch,
totalCount = 0,
}) => (
<TimelineRefetch loading={loading} id={id} inspect={inspect} refetch={refetch}>
<>
<EventsViewerHeader
id={id}
showInspect={showInspect}
totalCount={totalCount}
/>

<div data-test-subj="events-container" style={{ width: `${width}px` }}>
<TimelineContext.Provider value={loading}>
<TimelineWidthContext.Provider value={width}>
<StatefulBody
browserFields={browserFields}
data={events}
id={id}
isEventViewer={true}
height={height}
sort={sort}
toggleColumn={toggleColumn}
/>
<Footer
compact={isCompactFooter(width)}
getUpdatedAt={getUpdatedAt}
hasNextPage={getOr(false, 'hasNextPage', pageInfo)!}
height={footerHeight}
isEventViewer={true}
isLive={isLive}
isLoading={loading}
itemsCount={events.length}
itemsPerPage={itemsPerPage}
itemsPerPageOptions={itemsPerPageOptions}
onChangeItemsPerPage={onChangeItemsPerPage}
onLoadMore={loadMore}
nextCursor={getOr(null, 'endCursor.value', pageInfo)!}
serverSideEventCount={totalCount}
tieBreaker={getOr(null, 'endCursor.tiebreaker', pageInfo)}
/>
</TimelineWidthContext.Provider>
</TimelineContext.Provider>
<ManageTimelineContext loading={loading} width={width}>
<StatefulBody
browserFields={browserFields}
data={events}
id={id}
isEventViewer={true}
height={height}
sort={sort}
toggleColumn={toggleColumn}
/>
<Footer
compact={isCompactFooter(width)}
getUpdatedAt={getUpdatedAt}
hasNextPage={getOr(false, 'hasNextPage', pageInfo)!}
height={footerHeight}
isEventViewer={true}
isLive={isLive}
isLoading={loading}
itemsCount={events.length}
itemsPerPage={itemsPerPage}
itemsPerPageOptions={itemsPerPageOptions}
onChangeItemsPerPage={onChangeItemsPerPage}
onLoadMore={loadMore}
nextCursor={getOr(null, 'endCursor.value', pageInfo)!}
serverSideEventCount={totalCount}
tieBreaker={getOr(null, 'endCursor.tiebreaker', pageInfo)}
/>
</ManageTimelineContext>
</div>
</TimelineRefetch>
</>
)}
</TimelineQuery>
) : null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import { EuiFlexGroup, EuiPanel } from '@elastic/eui';
import * as React from 'react';
import styled from 'styled-components';

import { useContext } from 'react';
import { Note } from '../../../lib/note';
import { AddNote } from '../add_note';
import { AssociateNote, GetNewNoteId, UpdateNote } from '../helpers';
import { NoteCard } from '../note_card';
import { TimelineWidthContext } from '../../timeline/timeline_context';
import { useTimelineWidthContext } from '../../timeline/timeline_context';

const AddNoteContainer = styled.div``;

Expand All @@ -30,7 +29,7 @@ interface NoteCardsCompProps {
}

const NoteCardsComp = React.memo<NoteCardsCompProps>(({ children }) => {
const width = useContext(TimelineWidthContext);
const width = useTimelineWidthContext();

// Passing the styles directly to the component because the width is
// being calculated and is recommended by Styled Components for performance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ describe('SIEM Super Date Picker', () => {
const wrapperFixedEuiFieldSearch = wrapper.find(
'input[data-test-subj="superDatePickerRefreshIntervalInput"]'
);

wrapperFixedEuiFieldSearch.simulate('change', { target: { value: '2' } });
wrapper.update();

Expand Down Expand Up @@ -456,7 +457,7 @@ describe('SIEM Super Date Picker', () => {
},
];
const props2 = mapStateToProps(clone, { id: 'global' });
expect(props1.refetch).not.toBe(props2.refetch);
expect(props1.queries).not.toBe(props2.queries);
});
});
});
Expand Down
Loading