Skip to content

Commit

Permalink
Merge branch 'main' into de-8-13/enable-additional-connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaliidm authored May 9, 2024
2 parents beee520 + ed14baf commit f655fe8
Show file tree
Hide file tree
Showing 124 changed files with 3,443 additions and 5,647 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -1432,6 +1432,7 @@ x-pack/test/security_solution_cypress/cypress/tasks/expandable_flyout @elastic/
/x-pack/test/security_solution_cypress/cypress/tasks/hosts @elastic/security-threat-hunting-explore
/x-pack/test/security_solution_cypress/cypress/tasks/network @elastic/security-threat-hunting-explore

/x-pack/plugins/security_solution/public/app/actions @elastic/security-threat-hunting-explore
/x-pack/plugins/security_solution/public/common/components/guided_onboarding_tour @elastic/security-threat-hunting-explore
/x-pack/plugins/security_solution/public/common/components/charts @elastic/security-threat-hunting-explore
/x-pack/plugins/security_solution/public/detections/components/alerts_table/grouping_settings @elastic/security-threat-hunting-explore
Expand Down
9 changes: 9 additions & 0 deletions packages/kbn-cell-actions/actions/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export * from '../src/actions';
9 changes: 9 additions & 0 deletions packages/kbn-cell-actions/actions/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export * from '../src/actions/utils';
6 changes: 5 additions & 1 deletion packages/kbn-cell-actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
* Side Public License, v 1.
*/

export * from './src';
export * from './src/types';

export * from './src/context';
export * from './src/components';
export * from './src/hooks';
20 changes: 20 additions & 0 deletions packages/kbn-cell-actions/src/actions/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export * from './types';

export { createCellActionFactory } from './factory';

export { createCopyToClipboardActionFactory } from './copy_to_clipboard';
export {
createFilterInActionFactory,
createFilterOutActionFactory,
addFilterIn,
addFilterOut,
addExistsFilter,
} from './filter';
22 changes: 20 additions & 2 deletions packages/kbn-cell-actions/src/actions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
* Side Public License, v 1.
*/

import { SerializableRecord } from '@kbn/utility-types';
import { SerializableArray } from '@kbn/utility-types/src/serializable';
import type { SerializableRecord } from '@kbn/utility-types';
import type { SerializableArray } from '@kbn/utility-types/src/serializable';
import type { CellAction } from '../types';

export type DefaultActionsSupportedValue = string[] | number[] | boolean[];

Expand All @@ -17,3 +18,20 @@ export type NonNullableSerializable =
| boolean
| SerializableArray
| SerializableRecord;

/**
* Cell action factory template with optional `id`.
* The id override is required when using the action factory so it
* can be omitted in the original action creator
*/
export type CellActionTemplate<C extends CellAction = CellAction> = Omit<C, 'id'>;
/**
* Action factory extend parameter type,
*/
export type CellActionExtend<C extends CellAction = CellAction> = Partial<C> & { id: string };
export interface CellActionFactory<C extends CellAction = CellAction> {
<A extends C = C>(extend: CellActionExtend<A>): A;
combine: <A extends C = C>(
partialActionTemplate: Partial<CellActionTemplate<A>>
) => CellActionFactory<A>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ describe('HoverActionsPopover', () => {
const TestComponent = () => <span data-test-subj="test-component" />;
jest.useFakeTimers();

it('renders', () => {
it('renders the children', () => {
const getActions = () => Promise.resolve([]);
const { queryByTestId } = render(
const { getByTestId } = render(
<CellActionsProvider getTriggerCompatibleActions={getActions}>
<HoverActionsPopover {...defaultProps} children={null} />
<HoverActionsPopover {...defaultProps}>
<TestComponent />
</HoverActionsPopover>
</CellActionsProvider>
);
expect(queryByTestId('hoverActionsPopover')).toBeInTheDocument();
expect(getByTestId('test-component')).toBeInTheDocument();
});

it('renders actions when hovered', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const HoverActionsPopover: React.FC<Props> = ({
panelPaddingSize="none"
repositionOnScroll
ownFocus={false}
data-test-subj={'hoverActionsPopover'}
panelProps={{ ['data-test-subj']: 'hoverActionsPopover' }}
aria-label={ACTIONS_AREA_LABEL}
>
{showHoverContent && (
Expand Down
41 changes: 0 additions & 41 deletions packages/kbn-cell-actions/src/index.ts

This file was deleted.

19 changes: 2 additions & 17 deletions packages/kbn-cell-actions/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import type { FieldSpec } from '@kbn/data-views-plugin/common';
import { Serializable } from '@kbn/utility-types';
import type { CellActionsMode } from './constants';

export * from './actions/types';

export type CellActionsProviderProps = PropsWithChildren<{
/**
* Please assign `uiActions.getTriggerCompatibleActions` function.
Expand Down Expand Up @@ -133,20 +135,3 @@ export interface PartitionedActions {
extraActions: CellAction[];
visibleActions: CellAction[];
}

/**
* Cell action factory template with optional `id`.
* The id override is required when using the action factory so it
* can be omitted in the original action creator
*/
export type CellActionTemplate<C extends CellAction = CellAction> = Omit<C, 'id'>;
/**
* Action factory extend parameter type,
*/
export type CellActionExtend<C extends CellAction = CellAction> = Partial<C> & { id: string };
export interface CellActionFactory<C extends CellAction = CellAction> {
<A extends C = C>(extend: CellActionExtend<A>): A;
combine: <A extends C = C>(
partialActionTemplate: Partial<CellActionTemplate<A>>
) => CellActionFactory<A>;
}
24 changes: 0 additions & 24 deletions x-pack/plugins/security_solution/public/actions/jest.config.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* 2.0.
*/

import type { SecurityAppStore } from '../../../common/store/types';
import { TimelineId } from '../../../../common/types';
import { addProvider } from '../../../timelines/store/actions';
import type { SecurityAppStore } from '../../../../common/store/types';
import { TimelineId } from '../../../../../common/types';
import { addProvider } from '../../../../timelines/store/actions';
import { createAddToTimelineCellActionFactory } from './add_to_timeline';
import type { CellActionExecutionContext } from '@kbn/cell-actions';
import { GEO_FIELD_TYPE } from '../../../timelines/components/timeline/body/renderers/constants';
import { createStartServicesMock } from '../../../common/lib/kibana/kibana_react.mock';
import { GEO_FIELD_TYPE } from '../../../../timelines/components/timeline/body/renderers/constants';
import { createStartServicesMock } from '../../../../common/lib/kibana/kibana_react.mock';
import { set } from 'lodash/fp';
import { KBN_FIELD_TYPES } from '@kbn/field-types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@
* 2.0.
*/

import { createCellActionFactory } from '@kbn/cell-actions';
import type { CellActionTemplate } from '@kbn/cell-actions';
import { createCellActionFactory, type CellActionTemplate } from '@kbn/cell-actions/actions';
import {
isTypeSupportedByDefaultActions,
isValueSupportedByDefaultActions,
filterOutNullableValues,
valueToArray,
} from '@kbn/cell-actions/src/actions/utils';
} from '@kbn/cell-actions/actions/utils';
import { ACTION_INCOMPATIBLE_VALUE_WARNING } from '@kbn/cell-actions/src/actions/translations';
import type { KBN_FIELD_TYPES } from '@kbn/field-types';
import { addProvider } from '../../../timelines/store/actions';
import { TimelineId } from '../../../../common/types';
import type { SecurityAppStore } from '../../../common/store';
import { addProvider } from '../../../../timelines/store/actions';
import { TimelineId } from '../../../../../common/types';
import type { SecurityAppStore } from '../../../../common/store';
import { fieldHasCellActions } from '../../utils';
import {
ADD_TO_TIMELINE,
Expand All @@ -28,7 +27,7 @@ import {
} from '../constants';
import { createDataProviders, isValidDataProviderField } from '../data_provider';
import { SecurityCellActionType } from '../../constants';
import type { StartServices } from '../../../types';
import type { StartServices } from '../../../../types';
import type { SecurityCellAction } from '../../types';

export const createAddToTimelineCellActionFactory = createCellActionFactory(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
* 2.0.
*/

import type { SecurityAppStore } from '../../../common/store/types';
import { TimelineId } from '../../../../common/types';
import { addProvider, showTimeline } from '../../../timelines/store/actions';
import type { SecurityAppStore } from '../../../../common/store/types';
import { TimelineId } from '../../../../../common/types';
import { addProvider, showTimeline } from '../../../../timelines/store/actions';
import { createInvestigateInNewTimelineCellActionFactory } from './investigate_in_new_timeline';
import type { CellActionExecutionContext } from '@kbn/cell-actions';
import { GEO_FIELD_TYPE } from '../../../timelines/components/timeline/body/renderers/constants';
import { createStartServicesMock } from '../../../common/lib/kibana/kibana_react.mock';
import { timelineActions } from '../../../timelines/store';
import { GEO_FIELD_TYPE } from '../../../../timelines/components/timeline/body/renderers/constants';
import { createStartServicesMock } from '../../../../common/lib/kibana/kibana_react.mock';
import { timelineActions } from '../../../../timelines/store';
import { KBN_FIELD_TYPES } from '@kbn/field-types';

const services = createStartServicesMock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
* 2.0.
*/

import { createCellActionFactory, type CellActionTemplate } from '@kbn/cell-actions';
import type { KBN_FIELD_TYPES } from '@kbn/field-types';
import { createCellActionFactory, type CellActionTemplate } from '@kbn/cell-actions/actions';
import {
isTypeSupportedByDefaultActions,
isValueSupportedByDefaultActions,
valueToArray,
filterOutNullableValues,
} from '@kbn/cell-actions/src/actions/utils';
valueToArray,
} from '@kbn/cell-actions/actions/utils';
import { ACTION_INCOMPATIBLE_VALUE_WARNING } from '@kbn/cell-actions/src/actions/translations';
import { timelineActions } from '../../../timelines/store';
import { addProvider, showTimeline } from '../../../timelines/store/actions';
import { TimelineId } from '../../../../common/types';
import type { SecurityAppStore } from '../../../common/store';
import { timelineActions } from '../../../../timelines/store';
import { addProvider, showTimeline } from '../../../../timelines/store/actions';
import { TimelineId } from '../../../../../common/types';
import type { SecurityAppStore } from '../../../../common/store';
import { fieldHasCellActions } from '../../utils';
import {
ADD_TO_TIMELINE_FAILED_TEXT,
Expand All @@ -27,9 +27,9 @@ import {
} from '../constants';
import { createDataProviders, isValidDataProviderField } from '../data_provider';
import { SecurityCellActionType } from '../../constants';
import type { StartServices } from '../../../types';
import type { StartServices } from '../../../../types';
import type { SecurityCellAction } from '../../types';
import { timelineDefaults } from '../../../timelines/store/defaults';
import { timelineDefaults } from '../../../../timelines/store/defaults';

export const createInvestigateInNewTimelineCellActionFactory = createCellActionFactory(
({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { escapeDataProviderId } from '@kbn/securitysolution-t-grid';
import type { Serializable } from '@kbn/utility-types';

import { isArray, isString, isEmpty } from 'lodash/fp';
import { INDICATOR_REFERENCE } from '../../../common/cti/constants';
import type { DataProvider, QueryOperator } from '../../../common/types';
import { EXISTS_OPERATOR, IS_OPERATOR } from '../../../common/types';
import { IP_FIELD_TYPE } from '../../explore/network/components/ip';
import { PORT_NAMES } from '../../explore/network/components/port/helpers';
import { EVENT_DURATION_FIELD_NAME } from '../../timelines/components/duration';
import { BYTES_FORMAT } from '../../timelines/components/timeline/body/renderers/bytes';
import { INDICATOR_REFERENCE } from '../../../../common/cti/constants';
import type { DataProvider, QueryOperator } from '../../../../common/types';
import { EXISTS_OPERATOR, IS_OPERATOR } from '../../../../common/types';
import { IP_FIELD_TYPE } from '../../../explore/network/components/ip';
import { PORT_NAMES } from '../../../explore/network/components/port/helpers';
import { EVENT_DURATION_FIELD_NAME } from '../../../timelines/components/duration';
import { BYTES_FORMAT } from '../../../timelines/components/timeline/body/renderers/bytes';
import {
GEO_FIELD_TYPE,
MESSAGE_FIELD_NAME,
Expand All @@ -25,7 +25,7 @@ import {
RULE_REFERENCE_FIELD_NAME,
REFERENCE_URL_FIELD_NAME,
EVENT_URL_FIELD_NAME,
} from '../../timelines/components/timeline/body/renderers/constants';
} from '../../../timelines/components/timeline/body/renderers/constants';
import { isCountField } from '../utils';

export const getDataProvider = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
* 2.0.
*/

import type { SecurityAppStore } from '../../../common/store/types';
import { TimelineId } from '../../../../common/types';
import { addProvider } from '../../../timelines/store/actions';
import type { SecurityAppStore } from '../../../../common/store/types';
import { TimelineId } from '../../../../../common/types';
import { addProvider } from '../../../../timelines/store/actions';
import { createAddToTimelineDiscoverCellActionFactory } from './add_to_timeline';
import type { CellActionExecutionContext } from '@kbn/cell-actions';
import { GEO_FIELD_TYPE } from '../../../timelines/components/timeline/body/renderers/constants';
import { createStartServicesMock } from '../../../common/lib/kibana/kibana_react.mock';
import { APP_UI_ID } from '../../../../common';
import { GEO_FIELD_TYPE } from '../../../../timelines/components/timeline/body/renderers/constants';
import { createStartServicesMock } from '../../../../common/lib/kibana/kibana_react.mock';
import { APP_UI_ID } from '../../../../../common';
import { BehaviorSubject } from 'rxjs';

const services = createStartServicesMock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*/

import type { CellAction, CellActionFactory } from '@kbn/cell-actions';
import type { SecurityAppStore } from '../../../common/store';
import type { SecurityAppStore } from '../../../../common/store';
import { isInSecurityApp } from '../../utils';
import type { StartServices } from '../../../types';
import type { StartServices } from '../../../../types';
import { createAddToTimelineCellActionFactory } from '../cell_action/add_to_timeline';

export const createAddToTimelineDiscoverCellActionFactory = ({
Expand Down
Loading

0 comments on commit f655fe8

Please sign in to comment.