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

[Security Solution][Tech Debt] Decoupled TGrid state part from Timelines under the security_solution store #141010

Merged
merged 129 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
76b587d
[Security Solution][Tech Debt] Decoupled TGrid state part from Timeli…
YulNaumenko Sep 19, 2022
eb51602
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Sep 19, 2022
210c91d
Unified usage of data table get by id selector
YulNaumenko Sep 20, 2022
6cc90bf
resolve conflict
YulNaumenko Sep 20, 2022
18c3544
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Sep 20, 2022
ff48750
Cleanup - removed not used code
YulNaumenko Sep 20, 2022
0ed3116
-
YulNaumenko Sep 20, 2022
eaffa3c
-
YulNaumenko Sep 20, 2022
96b347c
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Sep 21, 2022
fe3ed3c
Fixed add to timeline
YulNaumenko Sep 22, 2022
4c260f7
Merge branch 'security-solution-tgrid-own-state' of https://github.co…
YulNaumenko Sep 22, 2022
87cd4a7
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Sep 22, 2022
95d16e2
Fixed filter manager for useHoverActions by proper context usage for …
YulNaumenko Sep 22, 2022
b33832d
Merge branch 'security-solution-tgrid-own-state' of https://github.co…
YulNaumenko Sep 22, 2022
2cf396e
Merge remote-tracking branch 'upstream/main' into security-solution-t…
YulNaumenko Sep 23, 2022
634d1d3
Merge remote-tracking branch 'upstream/main' into security-solution-t…
YulNaumenko Sep 23, 2022
d5f3914
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Sep 23, 2022
6e014e1
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Sep 23, 2022
bb5374d
Fixed es lint
YulNaumenko Sep 23, 2022
dfe23f4
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Sep 23, 2022
a12d553
-
YulNaumenko Sep 23, 2022
2d7bf8f
TableIds to TableId
YulNaumenko Sep 23, 2022
9453cae
Fixed unit tests
YulNaumenko Sep 23, 2022
68777f6
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Sep 23, 2022
a179f60
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Sep 23, 2022
8760fda
Fixed tests
YulNaumenko Sep 23, 2022
05468a1
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Sep 23, 2022
3d12a6e
-
YulNaumenko Sep 26, 2022
f7fe786
fixed garphevent component
YulNaumenko Sep 26, 2022
f57ec43
FIxed details tests
YulNaumenko Sep 26, 2022
80e14e6
Added mock for cases test
YulNaumenko Sep 26, 2022
bf8d03c
Fixed store tests
YulNaumenko Sep 26, 2022
da9ef96
fixed mocks
YulNaumenko Sep 27, 2022
71d521a
fixed mocks
YulNaumenko Sep 27, 2022
94680ab
Cleaned up tgrid store from the timeline actions
YulNaumenko Sep 27, 2022
8d88101
Set back reduceReducers to handle ability addToTimelineButton, need t…
YulNaumenko Sep 27, 2022
5f508f6
Merge remote-tracking branch 'upstream/main' into security-solution-t…
YulNaumenko Sep 27, 2022
e1bafe3
fixed merge
YulNaumenko Sep 27, 2022
0e0a017
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Sep 27, 2022
d9ce583
fixed check types
YulNaumenko Sep 27, 2022
15d34ee
Fixed type checks
YulNaumenko Sep 27, 2022
463f1c7
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Sep 27, 2022
b1ecf5c
Fixed tests
YulNaumenko Sep 28, 2022
74648fb
Added snapshot
YulNaumenko Sep 28, 2022
af2b70f
Fixed toggleDetails for user and host
YulNaumenko Sep 28, 2022
959eb2c
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Sep 28, 2022
b6f0005
fixed tests
YulNaumenko Sep 28, 2022
52a68a3
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Sep 28, 2022
11be4d3
Fixed timelines tests
YulNaumenko Sep 28, 2022
5c418a1
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Sep 28, 2022
b2e78ff
FIxed tests
YulNaumenko Sep 28, 2022
e65054a
Fixed tests
YulNaumenko Sep 28, 2022
cbd70cb
Merge remote-tracking branch 'upstream/main' into security-solution-t…
YulNaumenko Sep 28, 2022
3d1d358
Fixed tests
YulNaumenko Sep 29, 2022
13398e7
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Sep 29, 2022
604e2ef
Fixed Jest tests
YulNaumenko Sep 29, 2022
d71118d
Merge remote-tracking branch 'origin/security-solution-tgrid-own-stat…
YulNaumenko Sep 29, 2022
feb1ce2
Fixed resolver bug
YulNaumenko Sep 29, 2022
01a468f
Merge remote-tracking branch 'upstream/main' into security-solution-t…
YulNaumenko Sep 29, 2022
f0a21ea
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Sep 29, 2022
ecee24d
FIxed miissing filterManager
YulNaumenko Sep 30, 2022
af8abc5
Merge remote-tracking branch 'origin/security-solution-tgrid-own-stat…
YulNaumenko Sep 30, 2022
975e7c7
Merge branch 'main' into security-solution-tgrid-own-state
kibanamachine Sep 30, 2022
2c0e0ba
moved tgrid store
YulNaumenko Sep 30, 2022
8d6cd9c
Reduced bundle size!
YulNaumenko Sep 30, 2022
8905897
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Sep 30, 2022
6270923
Fixed names
YulNaumenko Sep 30, 2022
5b4ab25
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Sep 30, 2022
54dcd62
Fixed tests
YulNaumenko Sep 30, 2022
7f7f237
Merge remote-tracking branch 'origin/security-solution-tgrid-own-stat…
YulNaumenko Sep 30, 2022
bb37e21
Removed test
YulNaumenko Sep 30, 2022
91adc87
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Sep 30, 2022
7d8586e
New securitySolution bundle size
YulNaumenko Sep 30, 2022
107c5f7
Merge remote-tracking branch 'origin/security-solution-tgrid-own-stat…
YulNaumenko Sep 30, 2022
5adff24
Merge branch 'main' into security-solution-tgrid-own-state
kibanamachine Sep 30, 2022
f1de842
Cleanup the store
YulNaumenko Oct 2, 2022
317c59c
Merge remote-tracking branch 'origin/security-solution-tgrid-own-stat…
YulNaumenko Oct 2, 2022
65396b7
More cleanup
YulNaumenko Oct 2, 2022
9698c7e
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Oct 2, 2022
45eb409
Removed footer
YulNaumenko Oct 3, 2022
3c8f970
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Oct 3, 2022
38761ca
removed excludedRowRendererIds
YulNaumenko Oct 3, 2022
7d17f11
Merge remote-tracking branch 'origin/security-solution-tgrid-own-stat…
YulNaumenko Oct 3, 2022
2784cba
Fixed typecheck
YulNaumenko Oct 3, 2022
1757bf0
remove tests changes
YulNaumenko Oct 3, 2022
9d71469
Cleaned up unused selectors
YulNaumenko Oct 3, 2022
fcf06b1
Removed savedObjectId from tgrid state
YulNaumenko Oct 4, 2022
2f1123e
Merge remote-tracking branch 'upstream/main' into security-solution-t…
YulNaumenko Oct 4, 2022
31742ef
Merge remote-tracking branch 'upstream/main' into security-solution-t…
YulNaumenko Oct 4, 2022
45d2c4e
fixed type check
YulNaumenko Oct 4, 2022
036b426
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Oct 4, 2022
07a98e2
Merge remote-tracking branch 'upstream/main' into security-solution-t…
YulNaumenko Oct 5, 2022
fc26c87
Merge remote-tracking branch 'origin/security-solution-tgrid-own-stat…
YulNaumenko Oct 5, 2022
d5baf27
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Oct 5, 2022
b9b23b6
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Oct 11, 2022
f7a43d7
Resolved the comments
YulNaumenko Oct 11, 2022
a9b03a7
Merge remote-tracking branch 'upstream/main' into security-solution-t…
YulNaumenko Oct 11, 2022
15fddf0
Fixed due to comments
YulNaumenko Oct 12, 2022
2c38a4f
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Oct 12, 2022
83a90dc
Fixed type checks
YulNaumenko Oct 12, 2022
c4cecde
Fixed tests
YulNaumenko Oct 12, 2022
3bceb56
Merge remote-tracking branch 'upstream/main' into security-solution-t…
YulNaumenko Oct 12, 2022
0279208
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Oct 12, 2022
f16250f
fixed merge issue
YulNaumenko Oct 12, 2022
41dd4c0
Merge remote-tracking branch 'origin/security-solution-tgrid-own-stat…
YulNaumenko Oct 12, 2022
e0cc1b7
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Oct 12, 2022
04b78e1
Move suricata-sid-db to lazy loaded modules
YulNaumenko Oct 12, 2022
cc58a14
Merge remote-tracking branch 'origin/security-solution-tgrid-own-stat…
YulNaumenko Oct 12, 2022
9be4f96
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Oct 12, 2022
c4130e4
Fixed test
YulNaumenko Oct 13, 2022
c46e04f
moved mitre helpers to async chunk
YulNaumenko Oct 13, 2022
68e009d
Fixed due to comments
YulNaumenko Oct 16, 2022
fa2b7e5
Fixed tests
YulNaumenko Oct 16, 2022
29d4f4a
Merge remote-tracking branch 'upstream/main' into security-solution-t…
YulNaumenko Oct 16, 2022
12360ae
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Oct 17, 2022
ebe5531
Renamed TableId.detectionsRulesDetailsPage -> TableId.alertsOnRuleDet…
YulNaumenko Oct 17, 2022
a3f91c1
Merge remote-tracking branch 'origin/security-solution-tgrid-own-stat…
YulNaumenko Oct 17, 2022
8618487
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Oct 17, 2022
d247e42
Fixed typecheck
YulNaumenko Oct 17, 2022
8d45155
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Oct 17, 2022
81e964e
Fixed test
YulNaumenko Oct 17, 2022
1203072
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Oct 17, 2022
7b3724b
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Oct 18, 2022
8bd25ce
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Oct 18, 2022
32e5061
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Oct 18, 2022
38a5406
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Oct 18, 2022
a632070
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Oct 18, 2022
59e2944
Merge branch 'main' into security-solution-tgrid-own-state
YulNaumenko Oct 18, 2022
667a7f7
Merge remote-tracking branch 'upstream/main' into security-solution-t…
YulNaumenko Oct 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pageLoadAssetSize:
screenshotting: 22870
searchprofiler: 67080
security: 65433
securitySolution: 273763
securitySolution: 66738
Copy link
Contributor

Choose a reason for hiding this comment

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

👏 👏 👏

Copy link
Contributor

Choose a reason for hiding this comment

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

🎉 🙌🏾

Copy link
Contributor

Choose a reason for hiding this comment

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

😻

sessionView: 77750
share: 71239
snapshotRestore: 79032
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ const requiredProperties: CellValueElementProps = {
},
isDraggable: false,
linkValues: [],
timelineId: '',
scopeId: '',
};
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) {

const onStateChange = useCallback(
(state: TGridState) => {
const pickedState = pick(state.timelineById['standalone-t-grid'], [
const pickedState = pick(state.tableById['standalone-t-grid'], [
'columns',
'sort',
'selectedEventIds',
Expand Down Expand Up @@ -259,7 +259,6 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) {
itemsPerPage,
itemsPerPageOptions: [10, 25, 50],
loadingText: translations.alertsTable.loadingTextLabel,
footerText: translations.alertsTable.footerTextLabel,
onStateChange,
query: {
query: kuery ?? '',
Expand Down
40 changes: 21 additions & 19 deletions x-pack/plugins/security_solution/common/types/timeline/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,34 +313,36 @@ export type TimelineWithoutExternalRefs = Omit<SavedTimeline, 'dataViewId' | 'sa
*/

export enum TimelineId {
active = 'timeline-1',
casePage = 'timeline-case',
Copy link
Contributor

Choose a reason for hiding this comment

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

I ran into this too with the alert details page. A future step would be separating the alert details flyout state from timeline since that's the only reason the case page even has this. We can prob add it to the backlog

test = 'timeline-test', // Reserved for testing purposes
}

export enum TableId {
usersPageEvents = 'users-page-events',
hostsPageEvents = 'hosts-page-events',
networkPageEvents = 'network-page-events',
hostsPageSessions = 'hosts-page-sessions-v2', // the v2 is to cache bust localstorage settings as default columns were reworked.
detectionsRulesDetailsPage = 'detections-rules-details-page',
detectionsPage = 'detections-page',
active = 'timeline-1',
casePage = 'timeline-case',
test = 'test', // Reserved for testing purposes
alertsOnRuleDetailsPage = 'alerts-rules-details-page',
alertsOnAlertsPage = 'alerts-page',
test = 'table-test', // Reserved for testing purposes
alternateTest = 'alternateTest',
rulePreview = 'rule-preview',
kubernetesPageSessions = 'kubernetes-page-sessions',
}

export const TimelineIdLiteralRt = runtimeTypes.union([
runtimeTypes.literal(TimelineId.usersPageEvents),
runtimeTypes.literal(TimelineId.hostsPageEvents),
runtimeTypes.literal(TimelineId.networkPageEvents),
runtimeTypes.literal(TimelineId.hostsPageSessions),
runtimeTypes.literal(TimelineId.detectionsRulesDetailsPage),
runtimeTypes.literal(TimelineId.detectionsPage),
runtimeTypes.literal(TimelineId.active),
runtimeTypes.literal(TimelineId.test),
runtimeTypes.literal(TimelineId.rulePreview),
runtimeTypes.literal(TimelineId.kubernetesPageSessions),
export const TableIdLiteralRt = runtimeTypes.union([
runtimeTypes.literal(TableId.usersPageEvents),
runtimeTypes.literal(TableId.hostsPageEvents),
runtimeTypes.literal(TableId.networkPageEvents),
runtimeTypes.literal(TableId.hostsPageSessions),
runtimeTypes.literal(TableId.alertsOnRuleDetailsPage),
runtimeTypes.literal(TableId.alertsOnAlertsPage),
runtimeTypes.literal(TableId.test),
runtimeTypes.literal(TableId.rulePreview),
runtimeTypes.literal(TableId.kubernetesPageSessions),
]);

export type TimelineIdLiteral = runtimeTypes.TypeOf<typeof TimelineIdLiteralRt>;
export type TableIdLiteral = runtimeTypes.TypeOf<typeof TableIdLiteralRt>;

export const TimelineSavedToReturnObjectRuntimeType = runtimeTypes.intersection([
SavedTimelineRuntimeType,
Expand Down Expand Up @@ -528,7 +530,7 @@ export type TimelineExpandedDetail = {

export type ToggleDetailPanel = TimelineExpandedDetailType & {
tabType?: TimelineTabs;
timelineId: string;
id: string;
};

export const pageInfoTimeline = runtimeTypes.type({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { TimelineId } from '../../../../common/types/timeline';
import { createStore } from '../../../common/store';
import { kibanaObservable } from '@kbn/timelines-plugin/public/mock';
import { sourcererPaths } from '../../../common/containers/sourcerer';
import { tGridReducer } from '@kbn/timelines-plugin/public';

jest.mock('react-router-dom', () => {
const actual = jest.requireActual('react-router-dom');
Expand Down Expand Up @@ -72,7 +73,13 @@ describe('global header', () => {
},
};
const { storage } = createSecuritySolutionStorageMock();
const store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
const store = createStore(
state,
SUB_PLUGINS_REDUCER,
{ dataTable: tGridReducer },
kibanaObservable,
storage
);

beforeEach(() => {
useVariationMock.mockReset();
Expand Down Expand Up @@ -169,7 +176,13 @@ describe('global header', () => {
},
},
};
const mockStore = createStore(mockstate, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
const mockStore = createStore(
mockstate,
SUB_PLUGINS_REDUCER,
{ dataTable: tGridReducer },
kibanaObservable,
storage
);

(useLocation as jest.Mock).mockReturnValue({ pathname: sourcererPaths[2] });

Expand Down
41 changes: 36 additions & 5 deletions x-pack/plugins/security_solution/public/app/home/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import type { TimelineUrl } from '../../timelines/store/timeline/model';
import { timelineDefaults } from '../../timelines/store/timeline/defaults';
import { URL_PARAM_KEY } from '../../common/hooks/use_url_state';
import { InputsModelId } from '../../common/store/inputs/constants';
import { tGridReducer } from '@kbn/timelines-plugin/public';

jest.mock('../../common/store/inputs/actions');

Expand Down Expand Up @@ -298,7 +299,13 @@ describe('HomePage', () => {
},
};

const mockStore = createStore(mockstate, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
const mockStore = createStore(
mockstate,
SUB_PLUGINS_REDUCER,
{ dataTable: tGridReducer },
kibanaObservable,
storage
);

render(
<TestProviders store={mockStore}>
Expand Down Expand Up @@ -452,7 +459,13 @@ describe('HomePage', () => {
};

const { storage } = createSecuritySolutionStorageMock();
const mockStore = createStore(mockstate, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
const mockStore = createStore(
mockstate,
SUB_PLUGINS_REDUCER,
{ dataTable: tGridReducer },
kibanaObservable,
storage
);

const TestComponent = () => (
<TestProviders store={mockStore}>
Expand Down Expand Up @@ -509,7 +522,13 @@ describe('HomePage', () => {
};

const { storage } = createSecuritySolutionStorageMock();
const mockStore = createStore(mockstate, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
const mockStore = createStore(
mockstate,
SUB_PLUGINS_REDUCER,
{ dataTable: tGridReducer },
kibanaObservable,
storage
);

const TestComponent = () => (
<TestProviders store={mockStore}>
Expand Down Expand Up @@ -569,7 +588,13 @@ describe('HomePage', () => {

it('it removes empty timeline state from URL', async () => {
const { storage } = createSecuritySolutionStorageMock();
const store = createStore(mockGlobalState, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
const store = createStore(
mockGlobalState,
SUB_PLUGINS_REDUCER,
{ dataTable: tGridReducer },
kibanaObservable,
storage
);

mockUseInitializeUrlParam(URL_PARAM_KEY.timeline, {
id: 'testSavedTimelineId',
Expand All @@ -596,7 +621,13 @@ describe('HomePage', () => {

it('it updates URL when timeline store changes', async () => {
const { storage } = createSecuritySolutionStorageMock();
const store = createStore(mockGlobalState, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
const store = createStore(
mockGlobalState,
SUB_PLUGINS_REDUCER,
{ dataTable: tGridReducer },
kibanaObservable,
storage
);
const savedObjectId = 'testTimelineId';

mockUseInitializeUrlParam(URL_PARAM_KEY.timeline, {
Expand Down
5 changes: 3 additions & 2 deletions x-pack/plugins/security_solution/public/app/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import type {
import type { RouteProps } from 'react-router-dom';
import type { AppMountParameters } from '@kbn/core/public';
import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public';
import type { TableState } from '@kbn/timelines-plugin/public';

import type { StartServices } from '../types';

/**
Expand All @@ -33,7 +35,6 @@ export interface RenderAppProps extends AppMountParameters {
import type { State, SubPluginsInitReducer } from '../common/store';
import type { Immutable } from '../../common/endpoint/types';
import type { AppAction } from '../common/store/actions';
import type { TimelineState } from '../timelines/store/timeline/types';

export { SecurityPageName } from '../../common/constants';

Expand All @@ -47,7 +48,7 @@ export type SecuritySubPluginRoutes = RouteProps[];

export interface SecuritySubPlugin {
routes: SecuritySubPluginRoutes;
storageTimelines?: Pick<TimelineState, 'timelineById'>;
storageDataTables?: Pick<TableState, 'tableById'>;
}

export type SecuritySubPluginKeyStore =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const TimelineDetailsPanel = () => {
entityType="events"
isFlyoutView
runtimeMappings={runtimeMappings}
timelineId={TimelineId.casePage}
scopeId={TimelineId.casePage}
/>
);
};
Expand All @@ -58,7 +58,7 @@ const CaseContainerComponent: React.FC = () => {
dispatch(
timelineActions.toggleDetailPanel({
panelView: 'eventDetail',
timelineId: TimelineId.casePage,
id: TimelineId.casePage,
params: {
eventId: alertId,
indexName: index,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type { State } from '../../../../store';
import { createStore } from '../../../../store';
import * as i18n from './translations';
import { useChartSettingsPopoverConfiguration } from '.';
import { tGridReducer } from '@kbn/timelines-plugin/public';

const mockHandleClick = jest.fn();

Expand All @@ -32,7 +33,13 @@ describe('useChartSettingsPopoverConfiguration', () => {

const state: State = mockGlobalState;
const { storage } = createSecuritySolutionStorageMock();
const store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
const store = createStore(
state,
SUB_PLUGINS_REDUCER,
{ dataTable: tGridReducer },
kibanaObservable,
storage
);
const wrapper = ({ children }: { children: React.ReactNode }) => (
<TestProviders store={store}>{children}</TestProviders>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export interface BarChartComponentProps {
barChart: ChartSeriesData[] | null | undefined;
configs?: ChartSeriesConfigs | undefined;
stackByField?: string;
timelineId?: string;
scopeId?: string;
visualizationActionsOptions?: VisualizationActionsProps;
}

Expand All @@ -178,7 +178,7 @@ export const BarChartComponent: React.FC<BarChartComponentProps> = ({
barChart,
configs,
stackByField,
timelineId,
scopeId,
visualizationActionsOptions,
}) => {
const { ref: measureRef, width, height } = useThrottledResizeObserver();
Expand All @@ -190,12 +190,12 @@ export const BarChartComponent: React.FC<BarChartComponentProps> = ({
dataProviderId: escapeDataProviderId(
`draggable-legend-item-${uuid.v4()}-${stackByField}-${d.key}`
),
timelineId,
scopeId,
field: stackByField,
value: d.key,
}))
: NO_LEGEND_DATA,
[barChart, stackByField, timelineId]
[barChart, stackByField, scopeId]
);

const yAxisTitle = get('yAxisTitle', configs);
Expand Down Expand Up @@ -243,7 +243,7 @@ export const BarChart = React.memo(
BarChartComponent,
(prevProps, nextProps) =>
prevProps.stackByField === nextProps.stackByField &&
prevProps.timelineId === nextProps.timelineId &&
prevProps.scopeId === nextProps.scopeId &&
deepEqual(prevProps.configs, nextProps.configs) &&
deepEqual(prevProps.barChart, nextProps.barChart)
);
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface LegendItem {
dataProviderId: string;
render?: (fieldValuePair?: { field: string; value: string | number }) => React.ReactNode;
field: string;
timelineId?: string;
scopeId?: string;
value: string | number;
count?: number;
}
Expand All @@ -47,7 +47,7 @@ const DraggableLegendItemComponent: React.FC<{
legendItem: LegendItem;
}> = ({ legendItem }) => {
const [defaultNumberFormat] = useUiSetting$<string>(DEFAULT_NUMBER_FORMAT);
const { color, count, dataProviderId, field, timelineId, value } = legendItem;
const { color, count, dataProviderId, field, scopeId, value } = legendItem;

return (
<EuiText size="xs">
Expand All @@ -72,7 +72,7 @@ const DraggableLegendItemComponent: React.FC<{
hideTopN={true}
id={dataProviderId}
isDraggable={false}
timelineId={timelineId}
scopeId={scopeId}
value={value}
>
{legendItem.render == null ? (
Expand Down
Loading