diff --git a/x-pack/plugins/security_solution/public/timelines/components/create_field_button/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/create_field_button/index.tsx index 088c37d36c1674..75e5b59df1ffa0 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/create_field_button/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/create_field_button/index.tsx @@ -15,7 +15,7 @@ import { useKibana } from '../../../common/lib/kibana'; import * as i18n from './translations'; import { CreateFieldComponentType, TimelineId } from '../../../../../timelines/common'; -import { tGridActions } from '../../../../../timelines/public'; +import { upsertColumn } from '../../../../../timelines/public'; import { useDataView } from '../../../common/containers/source/use_data_view'; import { SourcererScopeName } from '../../../common/store/sourcerer/model'; import { sourcererSelectors } from '../../../common/store'; @@ -59,7 +59,7 @@ export const CreateFieldButton = React.memo( // Add the new field to the event table dispatch( - tGridActions.upsertColumn({ + upsertColumn({ column: { columnHeaderType: defaultColumnHeaderType, id: field.name, diff --git a/x-pack/plugins/security_solution/public/timelines/components/formatted_ip/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/formatted_ip/index.test.tsx index f5086fd1a83da4..80fdd6dfc7dd4d 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/formatted_ip/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/formatted_ip/index.test.tsx @@ -44,6 +44,17 @@ jest.mock('../../../common/components/drag_and_drop/draggable_wrapper', () => { }; }); +jest.mock('../../store/timeline', () => { + const original = jest.requireActual('../../store/timeline'); + return { + ...original, + timelineActions: { + ...original.timelineActions, + toggleDetailPanel: jest.fn(), + }, + }; +}); + describe('FormattedIp', () => { const props = { value: '192.168.1.1', @@ -53,16 +64,13 @@ describe('FormattedIp', () => { fieldName: 'host.ip', }; - let toggleDetailPanel: jest.SpyInstance; let toggleExpandedDetail: jest.SpyInstance; beforeAll(() => { - toggleDetailPanel = jest.spyOn(timelineActions, 'toggleDetailPanel'); toggleExpandedDetail = jest.spyOn(activeTimeline, 'toggleExpandedDetail'); }); afterEach(() => { - toggleDetailPanel.mockClear(); toggleExpandedDetail.mockClear(); }); test('should render ip address', () => { @@ -98,7 +106,7 @@ describe('FormattedIp', () => { wrapper.find('[data-test-subj="network-details"]').first().simulate('click'); await waitFor(() => { - expect(toggleDetailPanel).not.toHaveBeenCalled(); + expect(timelineActions.toggleDetailPanel).not.toHaveBeenCalled(); expect(toggleExpandedDetail).not.toHaveBeenCalled(); }); }); @@ -120,7 +128,7 @@ describe('FormattedIp', () => { wrapper.find('[data-test-subj="network-details"]').first().simulate('click'); await waitFor(() => { - expect(toggleDetailPanel).toHaveBeenCalledWith({ + expect(timelineActions.toggleDetailPanel).toHaveBeenCalledWith({ panelView: 'networkDetail', params: { flowTarget: 'source', @@ -176,7 +184,7 @@ describe('FormattedIp', () => { wrapper.find('[data-test-subj="network-details"]').first().simulate('click'); await waitFor(() => { - expect(toggleDetailPanel).toHaveBeenCalledWith({ + expect(timelineActions.toggleDetailPanel).toHaveBeenCalledWith({ panelView: 'networkDetail', params: { flowTarget: 'source', diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/host_name.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/host_name.test.tsx index bf92417c8023a1..6f2f6c28ecfbe9 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/host_name.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/host_name.test.tsx @@ -40,6 +40,17 @@ jest.mock('../../../../../common/components/draggables', () => ({ DefaultDraggable: () =>
, })); +jest.mock('../../../../store/timeline', () => { + const original = jest.requireActual('../../../../store/timeline'); + return { + ...original, + timelineActions: { + ...original.timelineActions, + toggleDetailPanel: jest.fn(), + }, + }; +}); + describe('HostName', () => { const props = { fieldName: 'host.name', @@ -49,16 +60,13 @@ describe('HostName', () => { value: 'Mock Host', }; - let toggleDetailPanel: jest.SpyInstance; let toggleExpandedDetail: jest.SpyInstance; beforeAll(() => { - toggleDetailPanel = jest.spyOn(timelineActions, 'toggleDetailPanel'); toggleExpandedDetail = jest.spyOn(activeTimeline, 'toggleExpandedDetail'); }); afterEach(() => { - toggleDetailPanel.mockClear(); toggleExpandedDetail.mockClear(); }); test('should render host name', () => { @@ -96,7 +104,7 @@ describe('HostName', () => { wrapper.find('[data-test-subj="host-details-button"]').first().simulate('click'); await waitFor(() => { - expect(toggleDetailPanel).not.toHaveBeenCalled(); + expect(timelineActions.toggleDetailPanel).not.toHaveBeenCalled(); expect(toggleExpandedDetail).not.toHaveBeenCalled(); }); }); @@ -118,7 +126,7 @@ describe('HostName', () => { wrapper.find('[data-test-subj="host-details-button"]').first().simulate('click'); await waitFor(() => { - expect(toggleDetailPanel).toHaveBeenCalledWith({ + expect(timelineActions.toggleDetailPanel).toHaveBeenCalledWith({ panelView: 'hostDetail', params: { hostName: props.value, @@ -172,7 +180,7 @@ describe('HostName', () => { wrapper.find('[data-test-subj="host-details-button"]').first().simulate('click'); await waitFor(() => { - expect(toggleDetailPanel).toHaveBeenCalledWith({ + expect(timelineActions.toggleDetailPanel).toHaveBeenCalledWith({ panelView: 'hostDetail', params: { hostName: props.value, diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/actions.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/actions.ts index 2264e62d6bed75..fc13d163c1883e 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/actions.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/actions.ts @@ -24,9 +24,7 @@ import type { TimelinePersistInput, SerializedFilterQuery, } from '../../../../common/types/timeline'; -import { tGridActions } from '../../../../../timelines/public'; -import { ResolveTimelineConfig } from '../../components/open_timeline/types'; -export const { +export { applyDeltaToColumnWidth, clearEventsDeleted, clearEventsLoading, @@ -46,7 +44,8 @@ export const { updateItemsPerPageOptions, updateSort, upsertColumn, -} = tGridActions; +} from '../../../../../timelines/public'; +import { ResolveTimelineConfig } from '../../components/open_timeline/types'; const actionCreator = actionCreatorFactory('x-pack/security_solution/local/timeline'); diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/selectors.ts b/x-pack/plugins/security_solution/public/timelines/store/timeline/selectors.ts index f46b55bcd33455..0dd898f1c4ab9b 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/selectors.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/timeline/selectors.ts @@ -7,14 +7,12 @@ import { createSelector } from 'reselect'; -import { tGridSelectors } from '../../../../../timelines/public'; +export { getManageTimelineById } from '../../../../../timelines/public'; import { State } from '../../../common/store/types'; import { TimelineModel } from './model'; import { AutoSavedWarningMsg, InsertTimeline, TimelineById } from './types'; -export const { getManageTimelineById } = tGridSelectors; - const selectTimelineById = (state: State): TimelineById => state.timeline.timelineById; const selectAutoSaveMsg = (state: State): AutoSavedWarningMsg => state.timeline.autoSavedWarningMsg; diff --git a/x-pack/plugins/timelines/common/index.ts b/x-pack/plugins/timelines/common/index.ts index 004742c3ee3d4d..0002dd6eb14327 100644 --- a/x-pack/plugins/timelines/common/index.ts +++ b/x-pack/plugins/timelines/common/index.ts @@ -5,14 +5,82 @@ * 2.0. */ -// TODO: https://github.com/elastic/kibana/issues/110904 -/* eslint-disable @kbn/eslint/no_export_all */ +// Careful of exporting anything from this file as any file(s) you export here will cause your page bundle size to increase. +// If you're using functions/types/etc... internally or within integration tests it's best to import directly from their paths +// than expose the functions/types/etc... here. You should _only_ expose functions/types/etc... that need to be shared with other plugins here. + +// When you do have to add things here you might want to consider creating a package to share with +// other plugins instead as packages are easier to break down and you do not have to carry the cost of extra plugin weight on +// first download since the other plugins/areas of your code can directly pull from the package in their async imports. +// See: https://docs.elastic.dev/kibana-dev-docs/key-concepts/platform-intro#public-plugin-api export { DELETED_SECURITY_SOLUTION_DATA_VIEW } from './constants'; -export * from './types'; -export * from './search_strategy'; -export * from './utils/accessibility'; +export type { + ActionProps, + AlertWorkflowStatus, + CellValueElementProps, + CreateFieldComponentType, + ColumnId, + ColumnRenderer, + ColumnHeaderType, + ColumnHeaderOptions, + ControlColumnProps, + DataProvidersAnd, + DataProvider, + GenericActionRowCellRenderProps, + HeaderActionProps, + HeaderCellRender, + QueryOperator, + QueryMatch, + RowCellRender, + RowRenderer, + SetEventsDeleted, + SetEventsLoading, +} from './types'; + +export { IS_OPERATOR, EXISTS_OPERATOR, DataProviderType, TimelineId } from './types'; + +export type { + BeatFields, + BrowserField, + BrowserFields, + CursorType, + DocValueFields, + EqlOptionsData, + EqlOptionsSelected, + FieldsEqlOptions, + FieldInfo, + IndexField, + IndexFieldsStrategyRequest, + IndexFieldsStrategyResponse, + LastTimeDetails, + TimelineNonEcsData, + Inspect, + SortField, + TimerangeInput, + TimelineEdges, + TimelineItem, + TimelineEventsAllStrategyResponse, + TimelineEventsAllRequestOptions, + TimelineEventsDetailsItem, + TimelineEventsDetailsStrategyResponse, + TimelineEventsDetailsRequestOptions, + TimelineEventsLastEventTimeStrategyResponse, + TimelineEventsLastEventTimeRequestOptions, + TimelineEqlRequestOptions, + TimelineEqlResponse, + TimelineKpiStrategyRequest, + TimelineKpiStrategyResponse, + TotalValue, + PaginationInputPaginated, +} from './search_strategy'; -export const PLUGIN_ID = 'timelines'; -export const PLUGIN_NAME = 'timelines'; +export { + Direction, + EntityType, + LastEventIndexKey, + EMPTY_BROWSER_FIELDS, + EMPTY_DOCVALUE_FIELD, + EMPTY_INDEX_FIELDS, +} from './search_strategy'; diff --git a/x-pack/plugins/timelines/common/types/timeline/cells/index.ts b/x-pack/plugins/timelines/common/types/timeline/cells/index.ts index c2f785d54c5d84..32c28dfb7adf7f 100644 --- a/x-pack/plugins/timelines/common/types/timeline/cells/index.ts +++ b/x-pack/plugins/timelines/common/types/timeline/cells/index.ts @@ -7,7 +7,7 @@ import { EuiDataGridCellValueElementProps } from '@elastic/eui'; import type { Filter } from '@kbn/es-query'; -import { RowRenderer } from '../../..'; +import { RowRenderer } from '../../../types'; import { Ecs } from '../../../ecs'; import { BrowserFields, TimelineNonEcsData } from '../../../search_strategy'; import { ColumnHeaderOptions } from '../columns'; diff --git a/x-pack/plugins/timelines/public/components/actions/timeline/cases/add_to_case_action.tsx b/x-pack/plugins/timelines/public/components/actions/timeline/cases/add_to_case_action.tsx index c734442d5a77bd..f634e460844e83 100644 --- a/x-pack/plugins/timelines/public/components/actions/timeline/cases/add_to_case_action.tsx +++ b/x-pack/plugins/timelines/public/components/actions/timeline/cases/add_to_case_action.tsx @@ -8,11 +8,11 @@ import React, { memo, useMemo, useCallback } from 'react'; import { useDispatch } from 'react-redux'; import { CaseStatuses, StatusAll, CasesContextValue } from '../../../../../../cases/common'; -import { TimelineItem } from '../../../../../common/'; +import { TimelineItem } from '../../../../../common/search_strategy'; import { useAddToCase, normalizedEventFields } from '../../../../hooks/use_add_to_case'; import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; import { TimelinesStartServices } from '../../../../types'; -import { tGridActions } from '../../../../'; +import { setOpenAddToExistingCase, setOpenAddToNewCase } from '../../../../store/t_grid/actions'; export interface AddToCaseActionProps { event?: TimelineItem; @@ -68,8 +68,7 @@ const AddToCaseActionComponent: React.FC = ({ updateCase: onCaseSuccess, userCanCrud: casePermissions?.crud ?? false, owner: [owner], - onClose: () => - dispatch(tGridActions.setOpenAddToExistingCase({ id: eventId, isOpen: false })), + onClose: () => dispatch(setOpenAddToExistingCase({ id: eventId, isOpen: false })), }; }, [ casePermissions?.crud, @@ -84,7 +83,7 @@ const AddToCaseActionComponent: React.FC = ({ ]); const closeCaseFlyoutOpen = useCallback(() => { - dispatch(tGridActions.setOpenAddToNewCase({ id: eventId, isOpen: false })); + dispatch(setOpenAddToNewCase({ id: eventId, isOpen: false })); }, [dispatch, eventId]); const createCaseFlyoutProps = useMemo(() => { diff --git a/x-pack/plugins/timelines/public/components/drag_and_drop/helpers.ts b/x-pack/plugins/timelines/public/components/drag_and_drop/helpers.ts index c32241cb876c40..237618594fedbe 100644 --- a/x-pack/plugins/timelines/public/components/drag_and_drop/helpers.ts +++ b/x-pack/plugins/timelines/public/components/drag_and_drop/helpers.ts @@ -10,8 +10,10 @@ import { KEYBOARD_DRAG_OFFSET, getFieldIdFromDraggable } from '@kbn/securitysolu import { Dispatch } from 'redux'; import { isString, keyBy } from 'lodash/fp'; -import { stopPropagationAndPreventDefault, TimelineId } from '../../../common'; -import type { BrowserField, BrowserFields, ColumnHeaderOptions } from '../../../common'; +import { stopPropagationAndPreventDefault } from '../../../common/utils/accessibility'; +import { TimelineId } from '../../../common/types'; +import type { BrowserField, BrowserFields } from '../../../common/search_strategy'; +import type { ColumnHeaderOptions } from '../../../common/types'; import { tGridActions } from '../../store/t_grid'; import { DEFAULT_COLUMN_MIN_WIDTH } from '../t_grid/body/constants'; diff --git a/x-pack/plugins/timelines/public/components/drag_and_drop/index.tsx b/x-pack/plugins/timelines/public/components/drag_and_drop/index.tsx index 65ec238ea4d402..33c568ed0231ce 100644 --- a/x-pack/plugins/timelines/public/components/drag_and_drop/index.tsx +++ b/x-pack/plugins/timelines/public/components/drag_and_drop/index.tsx @@ -17,7 +17,8 @@ import React, { useCallback } from 'react'; import { DropResult, DragDropContext, BeforeCapture } from 'react-beautiful-dnd'; import { useDispatch } from 'react-redux'; -import type { ColumnHeaderOptions, BrowserFields } from '../../../common'; +import type { BrowserFields } from '../../../common/search_strategy'; +import type { ColumnHeaderOptions } from '../../../common/types'; import { useAddToTimelineSensor } from '../../hooks/use_add_to_timeline'; import { addFieldToTimelineColumns, getTimelineIdFromColumnDroppableId } from './helpers'; diff --git a/x-pack/plugins/timelines/public/components/hover_actions/actions/add_to_timeline.tsx b/x-pack/plugins/timelines/public/components/hover_actions/actions/add_to_timeline.tsx index b3ff8c9533cbea..0ab5cb09565516 100644 --- a/x-pack/plugins/timelines/public/components/hover_actions/actions/add_to_timeline.tsx +++ b/x-pack/plugins/timelines/public/components/hover_actions/actions/add_to_timeline.tsx @@ -11,12 +11,13 @@ import { DraggableId } from 'react-beautiful-dnd'; import { useDispatch } from 'react-redux'; import { isEmpty } from 'lodash'; -import { DataProvider, stopPropagationAndPreventDefault, TimelineId } from '../../../../common'; +import { stopPropagationAndPreventDefault } from '../../../../common/utils/accessibility'; +import { DataProvider, TimelineId } from '../../../../common/types'; import { TooltipWithKeyboardShortcut } from '../../tooltip_with_keyboard_shortcut'; import { getAdditionalScreenReaderOnlyContext } from '../utils'; import { useAddToTimeline } from '../../../hooks/use_add_to_timeline'; import { HoverActionComponentProps } from './types'; -import { tGridActions } from '../../..'; +import { addProviderToTimeline } from '../../../store/t_grid/actions'; import { useAppToasts } from '../../../hooks/use_app_toasts'; import * as i18n from './translations'; @@ -74,7 +75,7 @@ const AddToTimelineButton: React.FC = React.memo( addDataProvider.forEach((provider) => { if (provider) { dispatch( - tGridActions.addProviderToTimeline({ + addProviderToTimeline({ id: TimelineId.active, dataProvider: provider, }) diff --git a/x-pack/plugins/timelines/public/components/hover_actions/actions/column_toggle.tsx b/x-pack/plugins/timelines/public/components/hover_actions/actions/column_toggle.tsx index c7936c6b17aaf2..9a6c3b51e3f6c1 100644 --- a/x-pack/plugins/timelines/public/components/hover_actions/actions/column_toggle.tsx +++ b/x-pack/plugins/timelines/public/components/hover_actions/actions/column_toggle.tsx @@ -9,7 +9,7 @@ import React, { useCallback, useEffect, useMemo } from 'react'; import { EuiContextMenuItem, EuiButtonEmpty, EuiButtonIcon, EuiToolTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { stopPropagationAndPreventDefault } from '../../../../common'; +import { stopPropagationAndPreventDefault } from '../../../../common/utils/accessibility'; import { TooltipWithKeyboardShortcut } from '../../tooltip_with_keyboard_shortcut'; import { getAdditionalScreenReaderOnlyContext } from '../utils'; import { defaultColumnHeaderType } from '../../t_grid/body/column_headers/default_headers'; diff --git a/x-pack/plugins/timelines/public/components/hover_actions/actions/copy.tsx b/x-pack/plugins/timelines/public/components/hover_actions/actions/copy.tsx index 0c1f8fbacd2214..3c4b7379188b97 100644 --- a/x-pack/plugins/timelines/public/components/hover_actions/actions/copy.tsx +++ b/x-pack/plugins/timelines/public/components/hover_actions/actions/copy.tsx @@ -10,7 +10,7 @@ import copy from 'copy-to-clipboard'; import React, { useCallback, useEffect, useMemo, useRef } from 'react'; import { i18n } from '@kbn/i18n'; -import { stopPropagationAndPreventDefault } from '../../../../common'; +import { stopPropagationAndPreventDefault } from '../../../../common/utils/accessibility'; import { WithCopyToClipboard } from '../../clipboard/with_copy_to_clipboard'; import { HoverActionComponentProps } from './types'; import { COPY_TO_CLIPBOARD_BUTTON_CLASS_NAME } from '../../clipboard'; diff --git a/x-pack/plugins/timelines/public/components/hover_actions/actions/filter_for_value.tsx b/x-pack/plugins/timelines/public/components/hover_actions/actions/filter_for_value.tsx index 7b8ecdb0f582fd..8e46f99ab45430 100644 --- a/x-pack/plugins/timelines/public/components/hover_actions/actions/filter_for_value.tsx +++ b/x-pack/plugins/timelines/public/components/hover_actions/actions/filter_for_value.tsx @@ -9,7 +9,7 @@ import React, { useCallback, useEffect, useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiButtonIcon, EuiToolTip } from '@elastic/eui'; -import { stopPropagationAndPreventDefault } from '../../../../common'; +import { stopPropagationAndPreventDefault } from '../../../../common/utils/accessibility'; import { TooltipWithKeyboardShortcut } from '../../tooltip_with_keyboard_shortcut'; import { createFilter, getAdditionalScreenReaderOnlyContext } from '../utils'; import { HoverActionComponentProps, FilterValueFnArgs } from './types'; diff --git a/x-pack/plugins/timelines/public/components/hover_actions/actions/filter_out_value.tsx b/x-pack/plugins/timelines/public/components/hover_actions/actions/filter_out_value.tsx index b4867936588ef4..818ef37748c850 100644 --- a/x-pack/plugins/timelines/public/components/hover_actions/actions/filter_out_value.tsx +++ b/x-pack/plugins/timelines/public/components/hover_actions/actions/filter_out_value.tsx @@ -9,7 +9,7 @@ import React, { useCallback, useEffect, useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiButtonIcon, EuiToolTip } from '@elastic/eui'; -import { stopPropagationAndPreventDefault } from '../../../../common'; +import { stopPropagationAndPreventDefault } from '../../../../common/utils/accessibility'; import { TooltipWithKeyboardShortcut } from '../../tooltip_with_keyboard_shortcut'; import { createFilter, getAdditionalScreenReaderOnlyContext } from '../utils'; import { HoverActionComponentProps, FilterValueFnArgs } from './types'; diff --git a/x-pack/plugins/timelines/public/components/hover_actions/actions/overflow.tsx b/x-pack/plugins/timelines/public/components/hover_actions/actions/overflow.tsx index aa582504f4f716..ffd68a8c5efbfc 100644 --- a/x-pack/plugins/timelines/public/components/hover_actions/actions/overflow.tsx +++ b/x-pack/plugins/timelines/public/components/hover_actions/actions/overflow.tsx @@ -17,7 +17,7 @@ import { } from '@elastic/eui'; import styled from 'styled-components'; -import { stopPropagationAndPreventDefault } from '../../../../common'; +import { stopPropagationAndPreventDefault } from '../../../../common/utils/accessibility'; import { TooltipWithKeyboardShortcut } from '../../tooltip_with_keyboard_shortcut'; import { getAdditionalScreenReaderOnlyContext } from '../utils'; import { HoverActionComponentProps } from './types'; diff --git a/x-pack/plugins/timelines/public/components/stateful_event_context.ts b/x-pack/plugins/timelines/public/components/stateful_event_context.ts new file mode 100644 index 00000000000000..830a28a3c34e2b --- /dev/null +++ b/x-pack/plugins/timelines/public/components/stateful_event_context.ts @@ -0,0 +1,11 @@ +/* + * 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 { createContext } from 'react'; +import { StatefulEventContextType } from '../types'; + +export const StatefulEventContext = createContext(null); diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/header/helpers.ts b/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/header/helpers.ts index b764c6d5eb96cc..7a3cad47bdcba3 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/header/helpers.ts +++ b/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/header/helpers.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { Direction } from '../../../../../../common'; -import type { ColumnHeaderOptions } from '../../../../../../common'; +import { Direction } from '../../../../../../common/search_strategy'; +import type { ColumnHeaderOptions } from '../../../../../../common/types'; import { assertUnreachable } from '../../../../../../common/utility_types'; import { Sort, SortDirection } from '../../sort'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/helpers.test.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/helpers.test.tsx index b174eb8cc76c4f..9de28b870aadb8 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/helpers.test.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/body/column_headers/helpers.test.tsx @@ -23,7 +23,7 @@ import { DEFAULT_DATE_COLUMN_MIN_WIDTH, } from '../constants'; import { mockBrowserFields } from '../../../../mock/browser_fields'; -import { ColumnHeaderOptions } from '../../../../../common'; +import { ColumnHeaderOptions } from '../../../../../common/types'; window.matchMedia = jest.fn().mockImplementation((query) => { return { diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.test.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.test.tsx index 56d2df3754fa80..aa46ba8976363b 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.test.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.test.tsx @@ -6,7 +6,7 @@ */ import { render, fireEvent } from '@testing-library/react'; -import { ActionProps, HeaderActionProps, TimelineTabs } from '../../../../../common'; +import { ActionProps, HeaderActionProps, TimelineTabs } from '../../../../../common/types'; import { HeaderCheckBox, RowCheckBox } from './checkbox'; import React from 'react'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.tsx index 6feb972b9a8134..77a761edebd49d 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/checkbox.tsx @@ -8,7 +8,7 @@ import { EuiCheckbox, EuiLoadingSpinner } from '@elastic/eui'; import React, { useCallback } from 'react'; import { ALERT_RULE_PRODUCER } from '@kbn/rule-data-utils'; -import { ActionProps, HeaderActionProps } from '../../../../../common'; +import type { ActionProps, HeaderActionProps } from '../../../../../common/types'; import * as i18n from './translations'; export const RowCheckBox = ({ diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/index.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/index.tsx index dbf7fc9b99cff5..b11bdd2b54c228 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/index.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/body/control_columns/index.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { ControlColumnProps } from '../../../../../common'; +import type { ControlColumnProps } from '../../../../../common/types'; import { HeaderCheckBox, RowCheckBox } from './checkbox'; export const checkBoxControlColumn: ControlColumnProps = { diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/events/stateful_row_renderer/index.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/events/stateful_row_renderer/index.tsx index 43a6284946b6ad..31b1963a24edd7 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/events/stateful_row_renderer/index.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/body/events/stateful_row_renderer/index.tsx @@ -13,7 +13,7 @@ import { ARIA_COLINDEX_ATTRIBUTE, ARIA_ROWINDEX_ATTRIBUTE, getRowRendererClassName, -} from '../../../../../../common'; +} from '../../../../../../common/utils/accessibility'; import { useStatefulEventFocus } from '../use_stateful_event_focus'; import * as i18n from '../translations'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/events/use_stateful_event_focus/index.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/events/use_stateful_event_focus/index.tsx index d39015995daa0b..2710b8c4636235 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/events/use_stateful_event_focus/index.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/body/events/use_stateful_event_focus/index.tsx @@ -6,8 +6,13 @@ */ import React, { useCallback, useState, useMemo } from 'react'; -import { focusColumn, isArrowDownOrArrowUp, isArrowUp, isEscape } from '../../../../../../common'; -import type { OnColumnFocused } from '../../../../../../common'; +import { + focusColumn, + isArrowDownOrArrowUp, + isArrowUp, + isEscape, +} from '../../../../../../common/utils/accessibility'; +import type { OnColumnFocused } from '../../../../../../common/utils/accessibility'; type FocusOwnership = 'not-owned' | 'owned'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/helpers.test.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/helpers.test.tsx index 3ce066e02731ef..56388b16b1b664 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/helpers.test.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/body/helpers.test.tsx @@ -7,7 +7,7 @@ import { omit } from 'lodash/fp'; -import { ColumnHeaderOptions } from '../../../../common'; +import { ColumnHeaderOptions } from '../../../../common/types'; import { Ecs } from '../../../../common/ecs'; import { allowSorting, diff --git a/x-pack/plugins/timelines/public/components/t_grid/body/index.tsx b/x-pack/plugins/timelines/public/components/t_grid/body/index.tsx index 8ed848a44c25b4..bed3290f4d3102 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/body/index.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/body/index.tsx @@ -68,7 +68,8 @@ import type { BrowserFields } from '../../../../common/search_strategy/index_fie import type { OnRowSelected, OnSelectAll } from '../types'; import type { Refetch } from '../../../store/t_grid/inputs'; import { getPageRowIndex } from '../../../../common/utils/pagination'; -import { StatefulEventContext, StatefulFieldsBrowser } from '../../../'; +import { StatefulEventContext } from '../../../components/stateful_event_context'; +import { StatefulFieldsBrowser } from '../../../components/t_grid/toolbar/fields_browser'; import { tGridActions, TGridModel, tGridSelectors, TimelineState } from '../../../store/t_grid'; import { useDeepEqualSelector } from '../../../hooks/use_selector'; import { RowAction } from './row_action'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/event_rendered_view/index.tsx b/x-pack/plugins/timelines/public/components/t_grid/event_rendered_view/index.tsx index ea823630fe0059..c2e686c92471be 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/event_rendered_view/index.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/event_rendered_view/index.tsx @@ -27,7 +27,8 @@ import styled from 'styled-components'; import { useUiSetting } from '../../../../../../../src/plugins/kibana_react/public'; -import type { BrowserFields, RowRenderer, TimelineItem } from '../../../../common'; +import type { BrowserFields, TimelineItem } from '../../../../common/search_strategy'; +import type { RowRenderer } from '../../../../common/types'; import { RuleName } from '../../rule_name'; import { isEventBuildingBlockType } from '../body/helpers'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/helpers.tsx b/x-pack/plugins/timelines/public/components/t_grid/helpers.tsx index caf97bdba7daeb..6d738c49e5b6bf 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/helpers.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/helpers.tsx @@ -15,7 +15,7 @@ import { getTableSkipFocus, handleSkipFocus, stopPropagationAndPreventDefault, -} from '../../../common'; +} from '../../../common/utils/accessibility'; import type { BrowserFields } from '../../../common/search_strategy/index_fields'; import { DataProviderType, EXISTS_OPERATOR } from '../../../common/types/timeline'; import type { DataProvider, DataProvidersAnd } from '../../../common/types/timeline'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/bulk_actions/alert_status_bulk_actions.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/bulk_actions/alert_status_bulk_actions.tsx index 8a3662d7cbe559..0fde09f555e00a 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/bulk_actions/alert_status_bulk_actions.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/bulk_actions/alert_status_bulk_actions.tsx @@ -13,7 +13,7 @@ import type { SetEventsDeleted, OnUpdateAlertStatusSuccess, OnUpdateAlertStatusError, -} from '../../../../../common'; +} from '../../../../../common/types'; import type { Refetch } from '../../../../store/t_grid/inputs'; import { tGridActions, TGridModel, tGridSelectors, TimelineState } from '../../../../store/t_grid'; import { BulkActions } from './'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/categories_pane.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/categories_pane.tsx index bac0a2eceda0cc..ffb93aee11b556 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/categories_pane.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/categories_pane.tsx @@ -13,8 +13,8 @@ import { DATA_COLINDEX_ATTRIBUTE, DATA_ROWINDEX_ATTRIBUTE, onKeyDownFocusHandler, -} from '../../../../../common'; -import type { BrowserFields } from '../../../../../common'; +} from '../../../../../common/utils/accessibility'; +import type { BrowserFields } from '../../../../../common/search_strategy'; import { getCategoryColumns } from './category_columns'; import { CATEGORIES_PANE_CLASS_NAME, TABLE_HEIGHT } from './helpers'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/category.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/category.tsx index 1b6194bff0f90d..3130c46aa06843 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/category.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/category.tsx @@ -14,8 +14,9 @@ import { DATA_COLINDEX_ATTRIBUTE, DATA_ROWINDEX_ATTRIBUTE, onKeyDownFocusHandler, -} from '../../../../../common'; -import type { BrowserFields, OnUpdateColumns } from '../../../../../common'; +} from '../../../../../common/utils/accessibility'; +import type { BrowserFields } from '../../../../../common/search_strategy'; +import type { OnUpdateColumns } from '../../../../../common/types'; import { CategoryTitle } from './category_title'; import { getFieldColumns } from './field_items'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/category_columns.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/category_columns.tsx index 3c3d644edbd08b..0fdf71ff5ffe1a 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/category_columns.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/category_columns.tsx @@ -27,7 +27,8 @@ import { import * as i18n from './translations'; import { tGridSelectors } from '../../../../store/t_grid'; import { getColumnsWithTimestamp } from '../../../utils/helpers'; -import type { OnUpdateColumns, BrowserFields } from '../../../../../common'; +import type { BrowserFields } from '../../../../../common/search_strategy'; +import type { OnUpdateColumns } from '../../../../../common/types'; const CategoryName = styled.span<{ bold: boolean }>` .euiText { diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/category_title.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/category_title.tsx index 2296b4c855d424..0858f30a352463 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/category_title.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/category_title.tsx @@ -9,7 +9,8 @@ import { EuiFlexGroup, EuiFlexItem, EuiScreenReaderOnly, EuiTitle } from '@elast import React from 'react'; import { CountBadge, getFieldBrowserCategoryTitleClassName, getFieldCount } from './helpers'; -import type { BrowserFields, OnUpdateColumns } from '../../../../../common'; +import type { BrowserFields } from '../../../../../common/search_strategy'; +import type { OnUpdateColumns } from '../../../../../common/types'; import { ViewAllButton } from './category_columns'; import * as i18n from './translations'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/field_browser.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/field_browser.tsx index b7f72e66b1a872..b16dc4b7171cc8 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/field_browser.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/field_browser.tsx @@ -21,12 +21,13 @@ import React, { useEffect, useCallback, useRef, useMemo } from 'react'; import styled from 'styled-components'; import { useDispatch } from 'react-redux'; -import type { - BrowserFields, - ColumnHeaderOptions, - CreateFieldComponentType, -} from '../../../../../common'; -import { isEscape, isTab, stopPropagationAndPreventDefault } from '../../../../../common'; +import type { BrowserFields } from '../../../../../common/search_strategy'; +import type { ColumnHeaderOptions, CreateFieldComponentType } from '../../../../../common/types'; +import { + isEscape, + isTab, + stopPropagationAndPreventDefault, +} from '../../../../../common/utils/accessibility'; import { CategoriesPane } from './categories_pane'; import { FieldsPane } from './fields_pane'; import { Search } from './search'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/field_items.test.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/field_items.test.tsx index 789aeeeb187fdd..a4c830c3d8808a 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/field_items.test.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/field_items.test.tsx @@ -16,7 +16,7 @@ import { Category } from './category'; import { getFieldColumns, getFieldItems } from './field_items'; import { FIELDS_PANE_WIDTH } from './helpers'; import { useMountAppended } from '../../../utils/use_mount_appended'; -import { ColumnHeaderOptions } from '../../../../../common'; +import { ColumnHeaderOptions } from '../../../../../common/types'; const selectedCategoryId = 'base'; const selectedCategoryFields = mockBrowserFields[selectedCategoryId].fields; diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/field_items.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/field_items.tsx index 8015be2bcc857e..a979e209bf64aa 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/field_items.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/field_items.tsx @@ -19,7 +19,8 @@ import styled from 'styled-components'; import { getEmptyValue } from '../../../empty_value'; import { getExampleText, getIconFromType } from '../../../utils/helpers'; -import type { ColumnHeaderOptions, BrowserField } from '../../../../../common'; +import type { BrowserField } from '../../../../../common/search_strategy'; +import type { ColumnHeaderOptions } from '../../../../../common/types'; import { defaultColumnHeaderType } from '../../body/column_headers/default_headers'; import { DEFAULT_COLUMN_MIN_WIDTH } from '../../body/constants'; import { TruncatableText } from '../../../truncatable_text'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/fields_pane.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/fields_pane.tsx index 11ad3b881b6374..5345475a025018 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/fields_pane.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/fields_pane.tsx @@ -15,7 +15,8 @@ import { getFieldItems } from './field_items'; import { FIELDS_PANE_WIDTH, TABLE_HEIGHT } from './helpers'; import * as i18n from './translations'; -import type { BrowserFields, ColumnHeaderOptions, OnUpdateColumns } from '../../../../../common'; +import type { BrowserFields } from '../../../../../common/search_strategy'; +import type { ColumnHeaderOptions, OnUpdateColumns } from '../../../../../common/types'; import { tGridActions } from '../../../../store/t_grid'; const NoFieldsPanel = styled.div` diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/helpers.test.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/helpers.test.tsx index ee7d0a334ed23b..75166bba5b1111 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/helpers.test.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/helpers.test.tsx @@ -16,7 +16,7 @@ import { getFieldCount, filterBrowserFieldsByFieldName, } from './helpers'; -import { BrowserFields } from '../../../../../common'; +import { BrowserFields } from '../../../../../common/search_strategy'; const timelineId = 'test'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/helpers.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/helpers.tsx index 552c228363e49b..5406940aab3e9c 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/helpers.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/helpers.tsx @@ -13,9 +13,9 @@ import { elementOrChildrenHasFocus, skipFocusInContainerTo, stopPropagationAndPreventDefault, -} from '../../../../../public'; +} from '../../../../../common/utils/accessibility'; import { TimelineId } from '../../../../../public/types'; -import type { BrowserField, BrowserFields } from '../../../../../common'; +import type { BrowserField, BrowserFields } from '../../../../../common/search_strategy'; import { defaultHeaders } from '../../../../store/t_grid/defaults'; import { DEFAULT_CATEGORY_NAME } from '../../body/column_headers/default_headers'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/search.tsx b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/search.tsx index f0f8c80fb0b850..935952fbf37e00 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/search.tsx +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/search.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { EuiFieldSearch, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui'; import styled from 'styled-components'; -import type { BrowserFields } from '../../../../../common'; +import type { BrowserFields } from '../../../../../common/search_strategy'; import { getFieldBrowserSearchInputClassName, getFieldCount } from './helpers'; diff --git a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/types.ts b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/types.ts index b4dd1ffb4b45a4..bcf7287950624f 100644 --- a/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/types.ts +++ b/x-pack/plugins/timelines/public/components/t_grid/toolbar/fields_browser/types.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { CreateFieldComponentType } from '../../../../../common'; +import { CreateFieldComponentType } from '../../../../../common/types'; import type { BrowserFields } from '../../../../../common/search_strategy/index_fields'; import type { ColumnHeaderOptions } from '../../../../../common/types/timeline/columns'; diff --git a/x-pack/plugins/timelines/public/components/utils/helpers.ts b/x-pack/plugins/timelines/public/components/utils/helpers.ts index 23f92c119d5744..64bc328c97b050 100644 --- a/x-pack/plugins/timelines/public/components/utils/helpers.ts +++ b/x-pack/plugins/timelines/public/components/utils/helpers.ts @@ -6,7 +6,8 @@ */ import { getOr, isEmpty, uniqBy } from 'lodash/fp'; -import { BrowserField, BrowserFields, ColumnHeaderOptions } from '../../../common'; +import type { BrowserField, BrowserFields } from '../../../common/search_strategy'; +import { ColumnHeaderOptions } from '../../../common/types'; import { defaultHeaders } from '../t_grid/body/column_headers/default_headers'; import { DEFAULT_COLUMN_MIN_WIDTH } from '../t_grid/body/constants'; diff --git a/x-pack/plugins/timelines/public/container/index.tsx b/x-pack/plugins/timelines/public/container/index.tsx index 28e4a5ffda4af1..0c748320bd0e42 100644 --- a/x-pack/plugins/timelines/public/container/index.tsx +++ b/x-pack/plugins/timelines/public/container/index.tsx @@ -12,7 +12,11 @@ import { useCallback, useEffect, useRef, useState } from 'react'; import { useDispatch } from 'react-redux'; import { Subscription } from 'rxjs'; import { MappingRuntimeFields } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { tGridActions } from '..'; +import { + clearEventsLoading, + clearEventsDeleted, + setTimelineUpdatedAt, +} from '../store/t_grid/actions'; import type { DataPublicPluginStart } from '../../../../../src/plugins/data/public'; import { isCompleteResponse, isErrorResponse } from '../../../../../src/plugins/data/common'; @@ -143,8 +147,8 @@ export const useTimelineEvents = ({ const clearSignalsState = useCallback(() => { if (id != null && detectionsTimelineIds.some((timelineId) => timelineId === id)) { - dispatch(tGridActions.clearEventsLoading({ id })); - dispatch(tGridActions.clearEventsDeleted({ id })); + dispatch(clearEventsLoading({ id })); + dispatch(clearEventsDeleted({ id })); } }, [dispatch, id]); @@ -165,7 +169,7 @@ export const useTimelineEvents = ({ const setUpdated = useCallback( (updatedAt: number) => { - dispatch(tGridActions.setTimelineUpdatedAt({ id, updated: updatedAt })); + dispatch(setTimelineUpdatedAt({ id, updated: updatedAt })); }, [dispatch, id] ); diff --git a/x-pack/plugins/timelines/public/container/source/index.tsx b/x-pack/plugins/timelines/public/container/source/index.tsx index f13e48d82ac80d..e5a84b3ee9d106 100644 --- a/x-pack/plugins/timelines/public/container/source/index.tsx +++ b/x-pack/plugins/timelines/public/container/source/index.tsx @@ -18,7 +18,7 @@ import { IndexField, IndexFieldsStrategyRequest, IndexFieldsStrategyResponse, -} from '../../../common'; +} from '../../../common/search_strategy'; import * as i18n from './translations'; import type { DataPublicPluginStart } from '../../../../../../src/plugins/data/public'; diff --git a/x-pack/plugins/timelines/public/container/use_update_alerts.ts b/x-pack/plugins/timelines/public/container/use_update_alerts.ts index b5d76f2fe324a9..0638425564a70e 100644 --- a/x-pack/plugins/timelines/public/container/use_update_alerts.ts +++ b/x-pack/plugins/timelines/public/container/use_update_alerts.ts @@ -9,7 +9,7 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { CoreStart } from '../../../../../src/core/public'; import { useKibana } from '../../../../../src/plugins/kibana_react/public'; -import { AlertStatus } from '../../../timelines/common'; +import type { AlertStatus } from '../../../timelines/common/types'; import { DETECTION_ENGINE_SIGNALS_STATUS_URL, RAC_ALERTS_BULK_UPDATE_URL, diff --git a/x-pack/plugins/timelines/public/hooks/use_add_to_case.ts b/x-pack/plugins/timelines/public/hooks/use_add_to_case.ts index 730243c4f12197..bd6ac89acbfb92 100644 --- a/x-pack/plugins/timelines/public/hooks/use_add_to_case.ts +++ b/x-pack/plugins/timelines/public/hooks/use_add_to_case.ts @@ -11,7 +11,7 @@ import { ALERT_RULE_NAME, ALERT_RULE_UUID } from '@kbn/rule-data-utils/technical import { useKibana } from '../../../../../src/plugins/kibana_react/public'; import { Case, SubCase } from '../../../cases/common'; import { TimelinesStartServices } from '../types'; -import { TimelineItem } from '../../common/'; +import { TimelineItem } from '../../common/search_strategy'; import { tGridActions } from '../store/t_grid'; import { useDeepEqualSelector } from './use_selector'; import { createUpdateSuccessToaster } from '../components/actions/timeline/cases/helpers'; diff --git a/x-pack/plugins/timelines/public/index.ts b/x-pack/plugins/timelines/public/index.ts index 2329d0a1bebf4c..bfbd498eb5be03 100644 --- a/x-pack/plugins/timelines/public/index.ts +++ b/x-pack/plugins/timelines/public/index.ts @@ -5,29 +5,46 @@ * 2.0. */ -// TODO: https://github.com/elastic/kibana/issues/110904 -/* eslint-disable @kbn/eslint/no_export_all */ +// Careful of exporting anything from this file as any file(s) you export here will cause your page bundle size to increase. +// If you're using functions/types/etc... internally or within integration tests it's best to import directly from their paths +// than expose the functions/types/etc... here. You should _only_ expose functions/types/etc... that need to be shared with other plugins here. -import { createContext } from 'react'; +// When you do have to add things here you might want to consider creating a package to share with +// other plugins instead as packages are easier to break down and you do not have to carry the cost of extra plugin weight on +// first download since the other plugins/areas of your code can directly pull from the package in their async imports. +// See: https://docs.elastic.dev/kibana-dev-docs/key-concepts/platform-intro#public-plugin-api import { TimelinesPlugin } from './plugin'; -import type { StatefulEventContextType } from './types'; -export * as tGridActions from './store/t_grid/actions'; -export * as tGridSelectors from './store/t_grid/selectors'; -export type { - Inspect, - SortField, - TimerangeInput, - PaginationInputPaginated, - DocValueFields, - CursorType, - TotalValue, -} from '../common/search_strategy/common'; -export { Direction } from '../common/search_strategy/common'; + +export { + upsertColumn, + applyDeltaToColumnWidth, + updateColumnOrder, + updateColumnWidth, + toggleDetailPanel, + removeColumn, + updateIsLoading, + updateColumns, + updateItemsPerPage, + updateItemsPerPageOptions, + updateSort, + setSelected, + clearSelected, + setEventsLoading, + clearEventsLoading, + setEventsDeleted, + clearEventsDeleted, + initializeTGridSettings, + setTGridSelectAll, +} from './store/t_grid/actions'; + +export { getManageTimelineById } from './store/t_grid/selectors'; + export { tGridReducer } from './store/t_grid/reducer'; -export type { TGridModelForTimeline, TimelineState, TimelinesUIStart } from './types'; +export type { TimelinesUIStart, TGridModelForTimeline, TimelineState } from './types'; export type { TGridType, SortDirection, State as TGridState, TGridModel } from './types'; export type { OnColumnFocused } from '../common/utils/accessibility'; + export { ARIA_COLINDEX_ATTRIBUTE, ARIA_ROWINDEX_ATTRIBUTE, @@ -47,27 +64,25 @@ export { getRowRendererClassName, getTableSkipFocus, handleSkipFocus, - onFocusReFocusDraggable, onKeyDownFocusHandler, - skipFocusInContainerTo, stopPropagationAndPreventDefault, } from '../common/utils/accessibility'; -export { getPageRowIndex } from '../common/utils/pagination'; + export { addFieldToTimelineColumns, getTimelineIdFromColumnDroppableId, } from './components/drag_and_drop/helpers'; + export { getActionsColumnWidth } from './components/t_grid/body/column_headers/helpers'; export { DEFAULT_ACTION_BUTTON_WIDTH } from './components/t_grid/body/constants'; -export { StatefulFieldsBrowser } from './components/t_grid/toolbar/fields_browser'; export { useStatusBulkActionItems } from './hooks/use_status_bulk_action_items'; +export { getPageRowIndex } from '../common/utils/pagination'; + // This exports static code and TypeScript types, // as well as, Kibana Platform `plugin()` initializer. export function plugin() { return new TimelinesPlugin(); } -export const StatefulEventContext = createContext(null); +export { StatefulEventContext } from './components/stateful_event_context'; export { TimelineContext } from './components/t_grid/shared'; - -export type { CreateFieldComponentType } from '../common'; diff --git a/x-pack/plugins/timelines/public/mock/global_state.ts b/x-pack/plugins/timelines/public/mock/global_state.ts index 8bdd190cc85199..46457e5dec1459 100644 --- a/x-pack/plugins/timelines/public/mock/global_state.ts +++ b/x-pack/plugins/timelines/public/mock/global_state.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Direction } from '../../common'; +import { Direction } from '../../common/search_strategy'; import { TimelineState } from '../types'; import { defaultHeaders } from './header'; diff --git a/x-pack/plugins/timelines/public/mock/t_grid.tsx b/x-pack/plugins/timelines/public/mock/t_grid.tsx index d1ec16d0be5364..a9a48eccf19c55 100644 --- a/x-pack/plugins/timelines/public/mock/t_grid.tsx +++ b/x-pack/plugins/timelines/public/mock/t_grid.tsx @@ -11,7 +11,7 @@ import { TGridIntegratedProps } from '../components/t_grid/integrated'; import { mockBrowserFields, mockDocValueFields, mockRuntimeMappings } from './browser_fields'; import { mockDataProviders } from './mock_data_providers'; import { mockTimelineData } from './mock_timeline_data'; -import { ColumnHeaderOptions, TimelineId } from '../../common'; +import { ColumnHeaderOptions, TimelineId } from '../../common/types'; import { mockIndexNames, mockIndexPattern } from './index_pattern'; import { EventRenderedViewProps } from '../components/t_grid/event_rendered_view'; diff --git a/x-pack/plugins/timelines/public/store/t_grid/helpers.test.tsx b/x-pack/plugins/timelines/public/store/t_grid/helpers.test.tsx index 1e1fbe290a1156..a29a1179463928 100644 --- a/x-pack/plugins/timelines/public/store/t_grid/helpers.test.tsx +++ b/x-pack/plugins/timelines/public/store/t_grid/helpers.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { SortColumnTimeline } from '../../../common'; +import { SortColumnTimeline } from '../../../common/types'; import { tGridDefaults } from './defaults'; import { setInitializeTgridSettings, diff --git a/x-pack/plugins/timelines/public/store/t_grid/types.ts b/x-pack/plugins/timelines/public/store/t_grid/types.ts index 0bc3f0d66f1e29..e7dbe5321bc803 100644 --- a/x-pack/plugins/timelines/public/store/t_grid/types.ts +++ b/x-pack/plugins/timelines/public/store/t_grid/types.ts @@ -6,7 +6,7 @@ */ import { Storage } from '../../../../../../src/plugins/kibana_utils/public'; -import type { ColumnHeaderOptions } from '../../../common'; +import type { ColumnHeaderOptions } from '../../../common/types'; import type { TGridModel, TGridModelSettings } from './model'; export type { TGridModel }; diff --git a/x-pack/plugins/timelines/public/types.ts b/x-pack/plugins/timelines/public/types.ts index 9c42f941ee03bd..ddecac02be705d 100644 --- a/x-pack/plugins/timelines/public/types.ts +++ b/x-pack/plugins/timelines/public/types.ts @@ -18,13 +18,13 @@ import type { UseDraggableKeyboardWrapper, UseDraggableKeyboardWrapperProps, } from './components'; -export type { SortDirection } from '../common'; +export type { SortDirection } from '../common/types'; import type { TGridIntegratedProps } from './components/t_grid/integrated'; import type { TGridStandaloneProps } from './components/t_grid/standalone'; import type { UseAddToTimelineProps, UseAddToTimeline } from './hooks/use_add_to_timeline'; import { HoverActionsConfig } from './components/hover_actions/index'; import type { AddToCaseActionProps } from './components/actions/timeline/cases/add_to_case_action'; -import { TimelineTabs } from '../common'; +import { TimelineTabs } from '../common/types'; export * from './store/t_grid'; export interface TimelinesUIStart { getHoverActions: () => HoverActionsConfig; diff --git a/x-pack/plugins/timelines/server/search_strategy/index_fields/index.ts b/x-pack/plugins/timelines/server/search_strategy/index_fields/index.ts index 7e2c03486d8903..60caf1768192a8 100644 --- a/x-pack/plugins/timelines/server/search_strategy/index_fields/index.ts +++ b/x-pack/plugins/timelines/server/search_strategy/index_fields/index.ts @@ -15,14 +15,13 @@ import { SearchStrategyDependencies, } from '../../../../../../src/plugins/data/server'; -// TODO cleanup path +import { DELETED_SECURITY_SOLUTION_DATA_VIEW } from '../../../common/constants'; import { IndexFieldsStrategyResponse, IndexField, IndexFieldsStrategyRequest, BeatFields, - DELETED_SECURITY_SOLUTION_DATA_VIEW, -} from '../../../common'; +} from '../../../common/search_strategy'; import { StartPlugins } from '../../types'; import type { FieldSpec } from '../../../../../../src/plugins/data_views/common'; diff --git a/x-pack/plugins/timelines/server/search_strategy/timeline/eql/__mocks__/index.ts b/x-pack/plugins/timelines/server/search_strategy/timeline/eql/__mocks__/index.ts index ea212f07f442b4..a4c8803a758d50 100644 --- a/x-pack/plugins/timelines/server/search_strategy/timeline/eql/__mocks__/index.ts +++ b/x-pack/plugins/timelines/server/search_strategy/timeline/eql/__mocks__/index.ts @@ -6,7 +6,7 @@ */ import type { EqlSearchStrategyResponse } from '../../../../../../../../src/plugins/data/common'; -import { EqlSearchResponse } from '../../../../../common'; +import { EqlSearchResponse } from '../../../../../common/search_strategy'; export const sequenceResponse = { rawResponse: { diff --git a/x-pack/plugins/timelines/server/search_strategy/timeline/eql/helpers.ts b/x-pack/plugins/timelines/server/search_strategy/timeline/eql/helpers.ts index 50ef2ccd0293f3..57ba55120bf4b1 100644 --- a/x-pack/plugins/timelines/server/search_strategy/timeline/eql/helpers.ts +++ b/x-pack/plugins/timelines/server/search_strategy/timeline/eql/helpers.ts @@ -8,8 +8,12 @@ import { isEmpty } from 'lodash/fp'; import type { EqlSearchStrategyResponse } from '../../../../../../../src/plugins/data/common'; import { DEFAULT_MAX_TABLE_QUERY_SIZE } from '../../../../common/constants'; -import { EqlSearchResponse, EqlSequence, EventHit } from '../../../../common'; -import { TimelineEdges } from '../../../../common/search_strategy'; +import { + EqlSearchResponse, + EqlSequence, + EventHit, + TimelineEdges, +} from '../../../../common/search_strategy'; import { TimelineEqlRequestOptions, TimelineEqlResponse, diff --git a/x-pack/plugins/timelines/server/search_strategy/timeline/eql/index.ts b/x-pack/plugins/timelines/server/search_strategy/timeline/eql/index.ts index b1ffab871fb8bc..5ea8fefff7acb7 100644 --- a/x-pack/plugins/timelines/server/search_strategy/timeline/eql/index.ts +++ b/x-pack/plugins/timelines/server/search_strategy/timeline/eql/index.ts @@ -15,7 +15,7 @@ import { EqlSearchStrategyResponse, EQL_SEARCH_STRATEGY, } from '../../../../../../../src/plugins/data/common'; -import { EqlSearchResponse } from '../../../../common'; +import { EqlSearchResponse } from '../../../../common/search_strategy'; import { TimelineEqlRequestOptions, TimelineEqlResponse,