Skip to content

Commit

Permalink
Merge branch 'main' into kbn-152269-followup-log-route-access
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Mar 2, 2023
2 parents bf7a3c3 + 2ceaa64 commit 2962355
Show file tree
Hide file tree
Showing 74 changed files with 1,348 additions and 771 deletions.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ packages/kbn-securitysolution-autocomplete @elastic/security-solution-platform
packages/kbn-securitysolution-ecs @elastic/security-threat-hunting-explore
packages/kbn-securitysolution-es-utils @elastic/security-solution-platform
packages/kbn-securitysolution-exception-list-components @elastic/security-solution-platform
packages/kbn-securitysolution-grouping @elastic/security-threat-hunting-explore
packages/kbn-securitysolution-hook-utils @elastic/security-solution-platform
packages/kbn-securitysolution-io-ts-alerting-types @elastic/security-solution-platform
packages/kbn-securitysolution-io-ts-list-types @elastic/security-solution-platform
Expand Down Expand Up @@ -803,7 +804,7 @@ packages/kbn-yarn-lock-validator @elastic/kibana-operations
/x-pack/test/functional/services/uptime @elastic/uptime
/x-pack/test/api_integration/apis/uptime @elastic/uptime
/x-pack/plugins/observability/public/components/shared/exploratory_view @elastic/uptime

/x-pack/plugins/observability/public/utils/observability_data_views @elastic/uptime

# Client Side Monitoring / Uptime (lives in APM directories but owned by Uptime)
/x-pack/plugins/apm/public/application/uxApp.tsx @elastic/uptime
Expand Down Expand Up @@ -1007,7 +1008,6 @@ packages/kbn-yarn-lock-validator @elastic/kibana-operations

/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/common/components/grouping @elastic/security-threat-hunting-explore
/x-pack/plugins/security_solution/public/detections/components/alerts_table/grouping_settings @elastic/security-threat-hunting-explore
/x-pack/plugins/security_solution/public/common/components/header_page @elastic/security-threat-hunting-explore
/x-pack/plugins/security_solution/public/common/components/header_section @elastic/security-threat-hunting-explore
Expand Down
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"files": "src/plugins/files",
"filesManagement": "src/plugins/files_management",
"flot": "packages/kbn-flot-charts/lib",
"grouping": "packages/kbn-securitysolution-grouping/src",
"guidedOnboarding": "src/plugins/guided_onboarding",
"guidedOnboardingPackage": "packages/kbn-guided-onboarding",
"home": "src/plugins/home",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@
"@kbn/securitysolution-ecs": "link:packages/kbn-securitysolution-ecs",
"@kbn/securitysolution-es-utils": "link:packages/kbn-securitysolution-es-utils",
"@kbn/securitysolution-exception-list-components": "link:packages/kbn-securitysolution-exception-list-components",
"@kbn/securitysolution-grouping": "link:packages/kbn-securitysolution-grouping",
"@kbn/securitysolution-hook-utils": "link:packages/kbn-securitysolution-hook-utils",
"@kbn/securitysolution-io-ts-alerting-types": "link:packages/kbn-securitysolution-io-ts-alerting-types",
"@kbn/securitysolution-io-ts-list-types": "link:packages/kbn-securitysolution-io-ts-list-types",
Expand Down Expand Up @@ -920,7 +921,7 @@
"usng.js": "^0.4.5",
"utility-types": "^3.10.0",
"uuid": "9.0.0",
"vega": "^5.23.0",
"vega": "^5.22.1",
"vega-interpreter": "^1.0.4",
"vega-lite": "^5.5.0",
"vega-schema-url-parser": "^2.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/src/worker/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export function getWebpackConfig(
// already bundled with all its necessary dependencies
noParse: [
/[\/\\]node_modules[\/\\]lodash[\/\\]index\.js$/,
/[\/\\]node_modules[\/\\]vega[\/\\]build-es5[\/\\]vega\.js$/,
/[\/\\]node_modules[\/\\]vega[\/\\]build[\/\\]vega\.js$/,
],

rules: [
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const MenuItemsComponent: FC<MenuItemsProps> = ({
if (typeof onManageRules === 'function') onManageRules();
}}
>
{i18n.EXCEPTION_LIST_HEADER_MANAGE_RULES_BUTTON}
{i18n.EXCEPTION_LIST_HEADER_LINK_RULES_BUTTON}
</EuiButton>
</EuiFlexItem>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ export const EXCEPTION_LIST_HEADER_DELETE_ACTION = i18n.translate(
defaultMessage: 'Delete exception list',
}
);
export const EXCEPTION_LIST_HEADER_MANAGE_RULES_BUTTON = i18n.translate(
'exceptionList-components.exception_list_header_manage_rules_button',
export const EXCEPTION_LIST_HEADER_LINK_RULES_BUTTON = i18n.translate(
'exceptionList-components.exception_list_header_link_rules_button',
{
defaultMessage: 'Manage rules',
defaultMessage: 'Link rules',
}
);

Expand Down
3 changes: 3 additions & 0 deletions packages/kbn-securitysolution-grouping/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @kbn/securitysolution-grouping

Grouping component and query. Currently only consumed by security solution alerts table. Package is a WIP. Refactoring to make generic https://github.com/elastic/kibana/issues/152491
31 changes: 31 additions & 0 deletions packages/kbn-securitysolution-grouping/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* 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.
*/

import React from 'react';
import {
GroupSelectorProps,
Grouping,
GroupingProps,
GroupSelector,
RawBucket,
getGroupingQuery,
isNoneGroup,
} from './src';
import type { NamedAggregation, GroupingFieldTotalAggregation, GroupingAggregation } from './src';

export const getGrouping = (props: GroupingProps): React.ReactElement<GroupingProps> => (
<Grouping {...props} />
);

export const getGroupSelector = (
props: GroupSelectorProps
): React.ReactElement<GroupSelectorProps> => <GroupSelector {...props} />;

export { isNoneGroup, getGroupingQuery };

export type { GroupingAggregation, GroupingFieldTotalAggregation, NamedAggregation, RawBucket };
26 changes: 26 additions & 0 deletions packages/kbn-securitysolution-grouping/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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.
*/

module.exports = {
preset: '@kbn/test',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-securitysolution-grouping'],
coverageReporters: ['text', 'html'],
collectCoverageFrom: [
'<rootDir>/packages/kbn-securitysolution-grouping/**/*.{ts,tsx}',
'!<rootDir>/packages/kbn-securitysolution-grouping/**/*.test',
'!<rootDir>/packages/kbn-securitysolution-grouping/**/types/*',
'!<rootDir>/packages/kbn-securitysolution-grouping/**/*.type',
'!<rootDir>/packages/kbn-securitysolution-grouping/**/*.styles',
'!<rootDir>/packages/kbn-securitysolution-grouping/**/mocks/*',
'!<rootDir>/packages/kbn-securitysolution-grouping/**/*.config',
'!<rootDir>/packages/kbn-securitysolution-grouping/**/translations',
'!<rootDir>/packages/kbn-securitysolution-grouping/**/types/*',
],
setupFilesAfterEnv: ['<rootDir>/packages/kbn-securitysolution-grouping/setup_test.ts'],
};
5 changes: 5 additions & 0 deletions packages/kbn-securitysolution-grouping/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "shared-common",
"id": "@kbn/securitysolution-grouping",
"owner": "@elastic/security-threat-hunting-explore"
}
6 changes: 6 additions & 0 deletions packages/kbn-securitysolution-grouping/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@kbn/securitysolution-grouping",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
}
9 changes: 9 additions & 0 deletions packages/kbn-securitysolution-grouping/setup_test.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.
*/
// eslint-disable-next-line import/no-extraneous-dependencies
import '@testing-library/jest-dom';
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* 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.
* 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.
*/

import React from 'react';
import { fireEvent, render } from '@testing-library/react';
import { GroupStats } from './group_stats';
import { TestProviders } from '../../../mock';

const onTakeActionsOpen = jest.fn();
const testProps = {
Expand Down Expand Up @@ -49,11 +49,7 @@ describe('Group stats', () => {
jest.clearAllMocks();
});
it('renders each stat item', () => {
const { getByTestId } = render(
<TestProviders>
<GroupStats {...testProps} />
</TestProviders>
);
const { getByTestId } = render(<GroupStats {...testProps} />);
expect(getByTestId('group-stats')).toBeInTheDocument();
testProps.badgeMetricStats.forEach(({ title: stat }) => {
expect(getByTestId(`metric-${stat}`)).toBeInTheDocument();
Expand All @@ -63,23 +59,15 @@ describe('Group stats', () => {
});
});
it('when onTakeActionsOpen is defined, call onTakeActionsOpen on popover click', () => {
const { getByTestId, queryByTestId } = render(
<TestProviders>
<GroupStats {...testProps} />
</TestProviders>
);
const { getByTestId, queryByTestId } = render(<GroupStats {...testProps} />);
fireEvent.click(getByTestId('take-action-button'));
expect(onTakeActionsOpen).toHaveBeenCalled();
['takeActionItem-1', 'takeActionItem-2'].forEach((actionItem) => {
expect(queryByTestId(actionItem)).not.toBeInTheDocument();
});
});
it('when onTakeActionsOpen is undefined, render take actions dropdown on popover click', () => {
const { getByTestId } = render(
<TestProviders>
<GroupStats {...testProps} onTakeActionsOpen={undefined} />
</TestProviders>
);
const { getByTestId } = render(<GroupStats {...testProps} onTakeActionsOpen={undefined} />);
fireEvent.click(getByTestId('take-action-button'));
['takeActionItem-1', 'takeActionItem-2'].forEach((actionItem) => {
expect(getByTestId(actionItem)).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +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; you may not use this file except in compliance with the Elastic License
* 2.0.
* 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.
*/

import {
Expand All @@ -16,7 +17,7 @@ import {
} from '@elastic/eui';
import React, { useCallback, useMemo, useState } from 'react';
import type { BadgeMetric, CustomMetric } from '.';
import { StatsContainer } from '../styles';
import { statsContainerCss } from '../styles';
import { TAKE_ACTION } from '../translations';
import type { RawBucket } from '../types';

Expand Down Expand Up @@ -46,7 +47,7 @@ const GroupStatsComponent = ({
() =>
badgeMetricStats?.map((metric) => (
<EuiFlexItem grow={false} key={metric.title}>
<StatsContainer data-test-subj={`metric-${metric.title}`}>
<span css={statsContainerCss} data-test-subj={`metric-${metric.title}`}>
<>
{metric.title}
<EuiToolTip position="top" content={metric.value}>
Expand All @@ -58,7 +59,7 @@ const GroupStatsComponent = ({
</EuiBadge>
</EuiToolTip>
</>
</StatsContainer>
</span>
</EuiFlexItem>
)),
[badgeMetricStats]
Expand All @@ -68,10 +69,10 @@ const GroupStatsComponent = ({
() =>
customMetricStats?.map((customMetric) => (
<EuiFlexItem grow={false} key={customMetric.title}>
<StatsContainer data-test-subj={`customMetric-${customMetric.title}`}>
<span css={statsContainerCss} data-test-subj={`customMetric-${customMetric.title}`}>
{customMetric.title}
{customMetric.customStatRenderer}
</StatsContainer>
</span>
</EuiFlexItem>
)),
[customMetricStats]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +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; you may not use this file except in compliance with the Elastic License
* 2.0.
* 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 const createGroupFilter = (selectedGroup: string, query?: string) =>
Expand Down
Loading

0 comments on commit 2962355

Please sign in to comment.