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] Decompose Timelines TGrid component and moved to security_solution #140151

Merged
Merged
Show file tree
Hide file tree
Changes from 119 commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
0ec0282
Rebuild T-Grid layers
YulNaumenko Aug 26, 2022
9e8731e
-
YulNaumenko Aug 26, 2022
3c92729
Moved useTimelineEvents
YulNaumenko Sep 7, 2022
cf24c16
Merge remote-tracking branch 'upstream/main' into timelines-tgrid-dec…
YulNaumenko Sep 7, 2022
5eb7981
-
YulNaumenko Sep 8, 2022
c10487a
Merge remote-tracking branch 'upstream/main' into timelines-tgrid-dec…
YulNaumenko Oct 18, 2022
503d4d2
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Oct 19, 2022
71fc629
Merge remote-tracking branch 'upstream/main' into timelines-tgrid-dec…
YulNaumenko Oct 19, 2022
260f5b4
Moved events viewer and integrated
YulNaumenko Oct 20, 2022
100f09c
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Oct 20, 2022
b6bc376
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Oct 20, 2022
077b617
Moved the table body
YulNaumenko Oct 20, 2022
1a446c2
-
YulNaumenko Oct 20, 2022
103c4c8
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Oct 20, 2022
43506dc
Moved store for data table to security_solution
YulNaumenko Oct 20, 2022
d619243
Merge remote-tracking branch 'origin/timelines-tgrid-decompose-layers…
YulNaumenko Oct 20, 2022
160a35c
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Oct 20, 2022
910feca
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Oct 20, 2022
ad6b139
Fixed data_table links
YulNaumenko Oct 20, 2022
1602ee0
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Oct 20, 2022
12a5870
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Oct 20, 2022
85b1db0
FIxed types
YulNaumenko Oct 22, 2022
44e50e9
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Oct 22, 2022
6f88d6b
Merge remote-tracking branch 'upstream/main' into timelines-tgrid-dec…
YulNaumenko Oct 25, 2022
532ad9b
Merge remote-tracking branch 'origin/timelines-tgrid-decompose-layers…
YulNaumenko Oct 25, 2022
b829b6d
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Oct 25, 2022
916806e
Moved and grouped the types
YulNaumenko Oct 26, 2022
e3a2854
-
YulNaumenko Oct 26, 2022
87c8b1a
Merge remote-tracking branch 'origin/timelines-tgrid-decompose-layers…
YulNaumenko Oct 26, 2022
15ee420
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Oct 26, 2022
fdae09c
Fixed event renderer
YulNaumenko Oct 27, 2022
521f30a
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Oct 27, 2022
9bdf9f1
-
YulNaumenko Oct 27, 2022
2f41ba5
Merge remote-tracking branch 'origin/timelines-tgrid-decompose-layers…
YulNaumenko Oct 27, 2022
af87402
mode drag and drop
YulNaumenko Oct 27, 2022
ffa2cf6
-
YulNaumenko Oct 27, 2022
88bc08e
Fixed filters
YulNaumenko Oct 31, 2022
0373af1
Merge remote-tracking branch 'upstream/main' into timelines-tgrid-dec…
YulNaumenko Oct 31, 2022
d2b06c8
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Oct 31, 2022
24dc14e
Removed duplicated mocks
YulNaumenko Oct 31, 2022
b70b058
Merge remote-tracking branch 'origin/timelines-tgrid-decompose-layers…
YulNaumenko Oct 31, 2022
fa166e3
-
YulNaumenko Oct 31, 2022
7952340
fixed tgrid reducer path
YulNaumenko Oct 31, 2022
efa5964
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Oct 31, 2022
15b6179
-
YulNaumenko Oct 31, 2022
af31e0e
fixed translations
YulNaumenko Oct 31, 2022
144b7d5
Merge remote-tracking branch 'upstream/main' into timelines-tgrid-dec…
YulNaumenko Oct 31, 2022
2e117e2
-
YulNaumenko Oct 31, 2022
de06554
Merge remote-tracking branch 'upstream/main' into timelines-tgrid-dec…
YulNaumenko Oct 31, 2022
8dd06e2
-
YulNaumenko Oct 31, 2022
4ba7610
-
YulNaumenko Oct 31, 2022
17f1588
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Oct 31, 2022
0fd8e74
fixed preview
YulNaumenko Nov 1, 2022
cb509ed
Fixed rule preview
YulNaumenko Nov 1, 2022
5695725
Merge remote-tracking branch 'upstream/main' into timelines-tgrid-dec…
YulNaumenko Nov 1, 2022
1390bc5
removed inspect duplication
YulNaumenko Nov 1, 2022
ff02cd9
-
YulNaumenko Nov 2, 2022
1a079b2
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Nov 2, 2022
01a5328
fixed tests
YulNaumenko Nov 2, 2022
f26fac0
-
YulNaumenko Nov 2, 2022
869ae92
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Nov 2, 2022
ca9fd2f
fixed labels
YulNaumenko Nov 2, 2022
c978118
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Nov 2, 2022
5719060
-
YulNaumenko Nov 3, 2022
b3f49b1
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Nov 3, 2022
1955be3
Moved types
YulNaumenko Nov 3, 2022
56296c4
Merge remote-tracking branch 'origin/timelines-tgrid-decompose-layers…
YulNaumenko Nov 3, 2022
31145ff
added tests
YulNaumenko Nov 3, 2022
9a602a3
tgrid to dataTable renaming
YulNaumenko Nov 3, 2022
5260619
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine Nov 3, 2022
330c575
fixed types
YulNaumenko Nov 3, 2022
bc847cd
Merge remote-tracking branch 'origin/timelines-tgrid-decompose-layers…
YulNaumenko Nov 3, 2022
55c3545
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Nov 3, 2022
c9d7f8f
modified drad and drop
YulNaumenko Nov 4, 2022
bc6f3b9
Event rendered view as stateless
YulNaumenko Nov 6, 2022
0db58b4
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Nov 7, 2022
3aae772
-
YulNaumenko Nov 8, 2022
a738412
Merge remote-tracking branch 'upstream/main' into timelines-tgrid-dec…
YulNaumenko Nov 11, 2022
096c04f
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Nov 11, 2022
56df471
Fixed merge conflicts
YulNaumenko Nov 11, 2022
da6b0be
Merge remote-tracking branch 'origin/timelines-tgrid-decompose-layers…
YulNaumenko Nov 11, 2022
cd9a224
Merge remote-tracking branch 'upstream/main' into timelines-tgrid-dec…
YulNaumenko Nov 18, 2022
bf01ef3
Fixed types
YulNaumenko Nov 19, 2022
517a157
FIxed type checks
YulNaumenko Nov 19, 2022
01dadd4
fixed table
YulNaumenko Nov 19, 2022
1571c62
FIxed tests
YulNaumenko Nov 21, 2022
a1e281c
Moved code to right top menu
YulNaumenko Nov 22, 2022
c074b58
-
YulNaumenko Nov 22, 2022
cef5047
Fixed details
YulNaumenko Nov 22, 2022
0ba3147
Merge remote-tracking branch 'upstream/main' into timelines-tgrid-dec…
YulNaumenko Nov 22, 2022
7552174
fixed errors
YulNaumenko Nov 22, 2022
bb34bdd
fixed tests subj
YulNaumenko Nov 27, 2022
2502ca1
Fixed styles
YulNaumenko Nov 27, 2022
766c8fe
Removed legacy table store mock
YulNaumenko Nov 27, 2022
ce2c4d5
-
YulNaumenko Nov 27, 2022
488b902
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine Nov 27, 2022
d62a59d
-
YulNaumenko Nov 27, 2022
2674695
fixed styles
YulNaumenko Nov 28, 2022
9dc8434
Merge remote-tracking branch 'origin/timelines-tgrid-decompose-layers…
YulNaumenko Nov 28, 2022
d4ec045
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Nov 28, 2022
715b3c3
Fixed checkbox visibility
YulNaumenko Nov 28, 2022
df43a00
Fixed tests
YulNaumenko Nov 28, 2022
cd5177d
fixed types
YulNaumenko Nov 28, 2022
b29dcc2
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Nov 28, 2022
5d54480
fixed test
YulNaumenko Nov 29, 2022
c924c7d
Merge remote-tracking branch 'upstream/main' into timelines-tgrid-dec…
YulNaumenko Nov 29, 2022
6c97408
Merge remote-tracking branch 'origin/timelines-tgrid-decompose-layers…
YulNaumenko Nov 29, 2022
8fd903c
fixed snapshot
YulNaumenko Nov 29, 2022
fb59e52
-
YulNaumenko Nov 29, 2022
6b2b5c7
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Nov 29, 2022
9559973
Fixed timestamp for eventrendered view
YulNaumenko Nov 29, 2022
0394d27
Merge remote-tracking branch 'origin/timelines-tgrid-decompose-layers…
YulNaumenko Nov 29, 2022
4186d21
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Nov 29, 2022
212cf1f
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Nov 29, 2022
13d9e58
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Nov 29, 2022
6ce4107
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Nov 30, 2022
45807c4
cleaned up spaces
YulNaumenko Nov 30, 2022
1859834
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Nov 30, 2022
0785cea
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Dec 1, 2022
90c9693
Moved some missing apm tracking parts
YulNaumenko Dec 2, 2022
f353a4e
Fixed due to comments
YulNaumenko Dec 2, 2022
19ffeb7
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Dec 2, 2022
f94ff58
Fixed suppression type check
YulNaumenko Dec 2, 2022
6471f9b
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Dec 2, 2022
68e048e
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
kibanamachine Dec 5, 2022
000e7bf
fixed the type check
YulNaumenko Dec 5, 2022
0c76216
Fixed due to comments
YulNaumenko Dec 5, 2022
c2c1883
Merge branch 'main' into timelines-tgrid-decompose-layers-part1
YulNaumenko Dec 5, 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
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ describe('ObservabilityActions component', () => {
},
data: inventoryThresholdAlert as unknown as TimelineNonEcsData[],
observabilityRuleTypeRegistry: createObservabilityRuleTypeRegistryMock(),
setEventsDeleted: jest.fn(),
setFlyoutAlert: jest.fn(),
id: pageId,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import React, { useMemo, useState, useCallback } from 'react';

import { CaseAttachmentsWithoutOwner } from '@kbn/cases-plugin/public';
import { CommentType } from '@kbn/cases-plugin/common';
import type { ActionProps } from '@kbn/timelines-plugin/common';
import { Ecs } from '@kbn/timelines-plugin/common/ecs';
import { TimelineNonEcsData } from '@kbn/timelines-plugin/common';
import { isAlertDetailsEnabledPerApp } from '../../../utils/is_alert_details_enabled';
import { useKibana } from '../../../utils/kibana_react';
import { useGetUserCasesPermissions } from '../../../hooks/use_get_user_cases_permissions';
Expand All @@ -32,15 +33,15 @@ import { ObservabilityRuleTypeRegistry } from '../../..';
import { ALERT_DETAILS_PAGE_ID } from '../../alert_details/types';
import { ConfigSchema } from '../../../plugin';

export type ObservabilityActionsProps = Pick<
ActionProps,
'data' | 'eventId' | 'ecsData' | 'setEventsDeleted'
> & {
export interface ObservabilityActionsProps {
data: TimelineNonEcsData[];
Copy link
Contributor

Choose a reason for hiding this comment

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

This more for any observability folks reading this, but I think we should move away from using this format and using the raw SearchHit or a more generalized agreed upon Kibana wide formatting. All this is, is a formatted fields response https://github.com/elastic/kibana/blob/main/x-pack/plugins/timelines/server/search_strategy/timeline/factory/helpers/format_timeline_data.ts#L52-L56 and I think it adds an unnecessary layer of complexity at times since there's really nothing Timeline specific about it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, but I don't know which type Observability team prefer here.

Copy link
Contributor

Choose a reason for hiding this comment

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

@XavierM as you're the author of the TimelineNonEcsData interface, perhaps you have a suggestion as to what a better type here would be for Observability purposes?

Copy link
Contributor

Choose a reason for hiding this comment

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

In the new alert table, we are deprecating this type but we had to keep it for security solution since a lot of functionality is working around this data/type. We need to figure out, how we are going to fully deprecated on your side. However, o11y and stack should not use it.

ecsData: Ecs;
eventId: string;
setFlyoutAlert: React.Dispatch<React.SetStateAction<TopAlert | undefined>>;
observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry;
id?: string;
config: ConfigSchema;
};
}

export function ObservabilityActions({
data,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const buildData = (alerts: EcsFieldsResponse): ObservabilityActionsProps['data']
[]
);
};
const fakeSetEventsDeleted = () => [];
export const getRowActions = (
observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry,
config: ConfigSchema
Expand All @@ -35,7 +34,6 @@ export const getRowActions = (
ecsData={{ _id: alert._id, _index: alert._index }}
id={id}
observabilityRuleTypeRegistry={observabilityRuleTypeRegistry}
setEventsDeleted={fakeSetEventsDeleted}
setFlyoutAlert={setFlyoutAlert}
config={config}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest to stick to the approach proposed in #138600 and organize these common files around subdomains, e.g. it could be security_solution/common/timelines, security_solution/common/session_view, etc. I would start moving away from organizing code around kinds of code or patterns, at least at higher levels of the folder tree. I'm talking about folders like types, components, containers, hooks, etc.

Also, for this specific folder bulk_actions it's not immediately clear what bulk actions are meant here. We have bulk actions for the rules in the Rules table and it doesn't look like something related to that. So it would be great if these bulk actions were living within a subdomain that would set the missing context.

* 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 type { TimelineItem } from '../../search_strategy';
export interface CustomBulkAction {
key: string;
label: string;
disableOnQuery?: boolean;
disabledLabel?: string;
onClick: (items?: TimelineItem[]) => void;
['data-test-subj']?: string;
}

export type CustomBulkActionProp = Omit<CustomBulkAction, 'onClick'> & {
onClick: (eventIds: string[]) => void;
};
49 changes: 49 additions & 0 deletions x-pack/plugins/security_solution/common/types/data_table/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* 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 * as runtimeTypes from 'io-ts';

export enum Direction {
asc = 'asc',
desc = 'desc',
}

export type SortDirectionTable = 'none' | 'asc' | 'desc' | Direction;
export interface SortColumnTable {
columnId: string;
columnType: string;
esTypes?: string[];
sortDirection: SortDirectionTable;
}

export type { TableById } from '../../../public/common/store/data_table/types';

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.
alertsOnRuleDetailsPage = 'alerts-rules-details-page',
alertsOnAlertsPage = 'alerts-page',
test = 'table-test', // Reserved for testing purposes
alternateTest = 'alternateTest',
rulePreview = 'rule-preview',
kubernetesPageSessions = 'kubernetes-page-sessions',
}

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 TableIdLiteral = runtimeTypes.TypeOf<typeof TableIdLiteralRt>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* 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 type { FlowTargetSourceDest } from '../../search_strategy';
import type { TimelineTabs } from '../timeline';

// eslint-disable-next-line @typescript-eslint/no-explicit-any
type EmptyObject = Record<any, never>;
YulNaumenko marked this conversation as resolved.
Show resolved Hide resolved

export type ExpandedEventType =
| {
panelView?: 'eventDetail';
params?: {
eventId: string;
indexName: string;
refetch?: () => void;
};
}
| EmptyObject;

export type ExpandedHostType =
| {
panelView?: 'hostDetail';
params?: {
hostName: string;
};
}
| EmptyObject;

export type ExpandedNetworkType =
| {
panelView?: 'networkDetail';
params?: {
ip: string;
flowTarget: FlowTargetSourceDest;
};
}
| EmptyObject;

export type ExpandedUserType =
| {
panelView?: 'userDetail';
params?: {
userName: string;
};
}
| EmptyObject;

export type ExpandedDetailType =
| ExpandedEventType
| ExpandedHostType
| ExpandedNetworkType
| ExpandedUserType;

export type ExpandedDetailTimeline = {
[tab in TimelineTabs]?: ExpandedDetailType;
};

export type ExpandedDetail = Partial<Record<string, ExpandedDetailType>>;
175 changes: 175 additions & 0 deletions x-pack/plugins/security_solution/common/types/header_actions/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
/*
* 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 type {
EuiDataGridCellValueElementProps,
EuiDataGridColumn,
EuiDataGridColumnCellActionProps,
EuiDataGridControlColumn,
} from '@elastic/eui';
import type { IFieldSubType } from '@kbn/es-query';
import type { FieldBrowserOptions } from '@kbn/triggers-actions-ui-plugin/public';
import type { ComponentType, JSXElementConstructor, ReactNode } from 'react';
import type { OnRowSelected, SetEventsDeleted, SetEventsLoading } from '..';
import type { Ecs } from '../../ecs';
import type { BrowserFields, TimelineNonEcsData } from '../../search_strategy';
import type { SortColumnTable } from '../data_table';

export type ColumnHeaderType = 'not-filtered' | 'text-filter';

/** Uniquely identifies a column */
export type ColumnId = string;

/**
* A `DataTableCellAction` function accepts `data`, where each row of data is
* represented as a `TimelineNonEcsData[]`. For example, `data[0]` would
* contain a `TimelineNonEcsData[]` with the first row of data.
*
* A `DataTableCellAction` returns a function that has access to all the
* `EuiDataGridColumnCellActionProps`, _plus_ access to `data`,
* which enables code like the following example to be written:
*
* Example:
* ```
* ({ data }: { data: TimelineNonEcsData[][] }) => ({ rowIndex, columnId, Component }) => {
* const value = getMappedNonEcsValue({
* data: data[rowIndex], // access a specific row's values
* fieldName: columnId,
* });
*
* return (
* <Component onClick={() => alert(`row ${rowIndex} col ${columnId} has value ${value}`)} iconType="heart">
* {'Love it'}
* </Component>
* );
* };
* ```
*/
export type DataTableCellAction = ({
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this here and x-pack/plugins/timelines/common/types/timeline/actions/index.ts ?

Copy link
Contributor Author

@YulNaumenko YulNaumenko Dec 2, 2022

Choose a reason for hiding this comment

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

Yes, due to the usage by hover actions of ColumnHeaderOptions we still need to keep this code duplication. But since HoverActions tech debt will be done we can remove it.

browserFields,
data,
ecsData,
header,
pageSize,
scopeId,
closeCellPopover,
}: {
browserFields: BrowserFields;
/** each row of data is represented as one TimelineNonEcsData[] */
data: TimelineNonEcsData[][];
ecsData: Ecs[];
header?: ColumnHeaderOptions;
pageSize: number;
scopeId: string;
closeCellPopover?: () => void;
}) => (props: EuiDataGridColumnCellActionProps) => ReactNode;

/** The specification of a column header */
export type ColumnHeaderOptions = Pick<
Copy link
Contributor

Choose a reason for hiding this comment

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

Same for this type as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By the reason I've mentioned above - we need this type for hover actions and Observability still use it by some reason.

EuiDataGridColumn,
| 'actions'
| 'defaultSortDirection'
| 'display'
| 'displayAsText'
| 'id'
| 'initialWidth'
| 'isSortable'
| 'schema'
> & {
aggregatable?: boolean;
dataTableCellActions?: DataTableCellAction[];
category?: string;
columnHeaderType: ColumnHeaderType;
description?: string | null;
esTypes?: string[];
example?: string | number | null;
format?: string;
linkField?: string;
placeholder?: string;
subType?: IFieldSubType;
type?: string;
};
export interface HeaderActionProps {
width: number;
browserFields: BrowserFields;
columnHeaders: ColumnHeaderOptions[];
fieldBrowserOptions?: FieldBrowserOptions;
isEventViewer?: boolean;
isSelectAllChecked: boolean;
onSelectAll: ({ isSelected }: { isSelected: boolean }) => void;
showEventsSelect: boolean;
showSelectAllCheckbox: boolean;
sort: SortColumnTable[];
tabType: string;
timelineId: string;
}

export type HeaderCellRender = ComponentType | ComponentType<HeaderActionProps>;

type GenericActionRowCellRenderProps = Pick<
EuiDataGridCellValueElementProps,
'rowIndex' | 'columnId'
>;

export type RowCellRender =
| JSXElementConstructor<GenericActionRowCellRenderProps>
| ((props: GenericActionRowCellRenderProps) => JSX.Element)
| JSXElementConstructor<ActionProps>
| ((props: ActionProps) => JSX.Element);

export interface ActionProps {
action?: RowCellRender;
ariaRowindex: number;
checked: boolean;
columnId: string;
columnValues: string;
data: TimelineNonEcsData[];
disabled?: boolean;
ecsData: Ecs;
eventId: string;
eventIdToNoteIds?: Readonly<Record<string, string[]>>;
index: number;
isEventPinned?: boolean;
isEventViewer?: boolean;
loadingEventIds: Readonly<string[]>;
onEventDetailsPanelOpened: () => void;
onRowSelected: OnRowSelected;
onRuleChange?: () => void;
refetch?: () => void;
rowIndex: number;
setEventsDeleted: SetEventsDeleted;
setEventsLoading: SetEventsLoading;
showCheckboxes: boolean;
showNotes?: boolean;
tabType?: string;
timelineId: string;
toggleShowNotes?: () => void;
width?: number;
}

interface AdditionalControlColumnProps {
ariaRowindex: number;
actionsColumnWidth: number;
columnValues: string;
checked: boolean;
onRowSelected: OnRowSelected;
eventId: string;
id: string;
columnId: string;
loadingEventIds: Readonly<string[]>;
onEventDetailsPanelOpened: () => void;
showCheckboxes: boolean;
// Override these type definitions to support either a generic custom component or the one used in security_solution today.
headerCellRender: HeaderCellRender;
rowCellRender: RowCellRender;
}

export type ControlColumnProps = Omit<
EuiDataGridControlColumn,
keyof AdditionalControlColumnProps
> &
Partial<AdditionalControlColumnProps>;
14 changes: 14 additions & 0 deletions x-pack/plugins/security_solution/common/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,18 @@
* 2.0.
*/

import type { Status } from '../detection_engine/schemas/common';

export * from './timeline';
export * from './data_table';
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for splitting up the types like this. Much cleaner!

export * from './detail_panel';
export * from './header_actions';
export * from './session_view';
export * from './bulk_actions';

export const FILTER_OPEN: Status = 'open';
export const FILTER_CLOSED: Status = 'closed';
export const FILTER_ACKNOWLEDGED: Status = 'acknowledged';

export type SetEventsLoading = (params: { eventIds: string[]; isLoading: boolean }) => void;
export type SetEventsDeleted = (params: { eventIds: string[]; isDeleted: boolean }) => void;
Loading