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

[8.17] [Security Solution] Fix timeline dynamic batching (#204034) #205676

Open
wants to merge 4 commits into
base: 8.17
Choose a base branch
from
Open
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 @@ -72,8 +72,8 @@ export type OnColumnRemoved = (columnId: ColumnId) => void;

export type OnColumnResized = ({ columnId, delta }: { columnId: ColumnId; delta: number }) => void;

/** Invoked when a user clicks to load more item */
export type OnFetchMoreRecords = (nextPage: number) => void;
/** Invoked when a user clicks to load next batch */
export type OnFetchMoreRecords = VoidFunction;

/** Invoked when a user checks/un-checks a row */
export type OnRowSelected = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { mockTimelineData } from './mock_timeline_data';

const mockEvents = structuredClone(mockTimelineData);

/*
* This helps to mock `data.search.search` method to mock the timeline data
* */
export const getMockTimelineSearchSubscription = () => {
const mockSearchWithArgs = jest.fn();

const mockTimelineSearchSubscription = jest.fn().mockImplementation((args) => {
mockSearchWithArgs(args);
return {
subscribe: jest.fn().mockImplementation(({ next }) => {
const start = args.pagination.activePage * args.pagination.querySize;
const end = start + args.pagination.querySize;
const timelineOut = setTimeout(() => {
next({
isRunning: false,
isPartial: false,
inspect: {
dsl: [],
response: [],
},
edges: mockEvents.map((item) => ({ node: item })).slice(start, end),
pageInfo: {
activePage: args.pagination.activePage,
querySize: args.pagination.querySize,
},
rawResponse: {},
totalCount: mockEvents.length,
});
}, 50);
return {
unsubscribe: jest.fn(() => {
clearTimeout(timelineOut);
}),
};
}),
};
});

return { mockTimelineSearchSubscription, mockSearchWithArgs };
};

This file was deleted.

Loading