Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions packages/kbn-babel-preset/styled_components_files.js

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 @@ -34471,7 +34471,6 @@
"xpack.securitySolution.components.chartCollapse.noResultMessage": "Aucun",
"xpack.securitySolution.components.chartCollapse.topGroup": "Générant le plus d'alertes",
"xpack.securitySolution.components.chartCollapse.topRule": "Règle Générant le plus d'alertes :",
"xpack.securitySolution.components.chartSelect.chartsOption": "Graphiques",
"xpack.securitySolution.components.chartSelect.chartsOptionTitle": "Résumé",
"xpack.securitySolution.components.chartSelect.legendTitle": "Sélectionner un onglet",
"xpack.securitySolution.components.chartSelect.tableOptionTitle": "Comptes",
Expand Down Expand Up @@ -34770,12 +34769,9 @@
"xpack.securitySolution.detectionEngine.alerts.alertsByGrouping.sourceLabel": "source",
"xpack.securitySolution.detectionEngine.alerts.alertsByGrouping.userNameLabel": "utilisateur",
"xpack.securitySolution.detectionEngine.alerts.alertsByType.alertRuleChartTitle": "Alertes par nom",
"xpack.securitySolution.detectionEngine.alerts.chartsTitle": "Graphiques",
"xpack.securitySolution.detectionEngine.alerts.closedAlertFailedToastMessage": "Impossible de fermer l'alerte ou les alertes.",
"xpack.securitySolution.detectionEngine.alerts.closedAlertsTitle": "Fermé",
"xpack.securitySolution.detectionEngine.alerts.closedAlertSuccessToastMessage": "Fermeture réussie de {totalAlerts} {totalAlerts, plural, =1 {alerte} other {alertes}}.",
"xpack.securitySolution.detectionEngine.alerts.count.columnLabel": "{topN} principales valeurs de {fieldName}",
"xpack.securitySolution.detectionEngine.alerts.count.countTableColumnTitle": "Nombre d'enregistrements",
"xpack.securitySolution.detectionEngine.alerts.count.countTableTitle": "Décompte",
"xpack.securitySolution.detectionEngine.alerts.createNewTermsTimelineFailure": "Impossible de créer une chronologie pour l’ID de document : {id}",
"xpack.securitySolution.detectionEngine.alerts.createNewTermsTimelineFailureTitle": "Impossible de créer une chronologie d'alerte de nouveaux termes",
Expand All @@ -34785,7 +34781,6 @@
"xpack.securitySolution.detectionEngine.alerts.createThresholdTimelineFailureTitle": "Impossible de créer une chronologie d'alerte de seuil",
"xpack.securitySolution.detectionEngine.alerts.fetchExceptionFilterFailure": "Erreur lors de la récupération du filtre d'exception.",
"xpack.securitySolution.detectionEngine.alerts.histogram.headerTitle": "Tendance",
"xpack.securitySolution.detectionEngine.alerts.histogram.notAvailableTooltip": "Non disponible pour la vue de tendance",
"xpack.securitySolution.detectionEngine.alerts.histogram.showingAlertsTitle": "Affichage de : {modifier}{totalAlertsFormatted} {totalAlerts, plural, =1 {alerte} other {alertes}}",
"xpack.securitySolution.detectionEngine.alerts.histogram.stackByOptions.groupByLabel": "Regrouper par",
"xpack.securitySolution.detectionEngine.alerts.histogram.stackByOptions.groupByTopLabel": "Regrouper par top",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34333,7 +34333,6 @@
"xpack.securitySolution.components.chartCollapse.noResultMessage": "なし",
"xpack.securitySolution.components.chartCollapse.topGroup": "上位のアラート",
"xpack.securitySolution.components.chartCollapse.topRule": "上位のアラートルール:",
"xpack.securitySolution.components.chartSelect.chartsOption": "チャート",
"xpack.securitySolution.components.chartSelect.chartsOptionTitle": "まとめ",
"xpack.securitySolution.components.chartSelect.legendTitle": "タブを選択",
"xpack.securitySolution.components.chartSelect.tableOptionTitle": "カウント",
Expand Down Expand Up @@ -34631,12 +34630,9 @@
"xpack.securitySolution.detectionEngine.alerts.alertsByGrouping.sourceLabel": "ソース",
"xpack.securitySolution.detectionEngine.alerts.alertsByGrouping.userNameLabel": "ユーザー",
"xpack.securitySolution.detectionEngine.alerts.alertsByType.alertRuleChartTitle": "名前別アラート",
"xpack.securitySolution.detectionEngine.alerts.chartsTitle": "チャート",
"xpack.securitySolution.detectionEngine.alerts.closedAlertFailedToastMessage": "アラートをクローズできませんでした。",
"xpack.securitySolution.detectionEngine.alerts.closedAlertsTitle": "停止中",
"xpack.securitySolution.detectionEngine.alerts.closedAlertSuccessToastMessage": "{totalAlerts} {totalAlerts, plural, other {件のアラート}}を正常にクローズしました。",
"xpack.securitySolution.detectionEngine.alerts.count.columnLabel": "{fieldName}の上位{topN}の値",
"xpack.securitySolution.detectionEngine.alerts.count.countTableColumnTitle": "レコード数",
"xpack.securitySolution.detectionEngine.alerts.count.countTableTitle": "カウント",
"xpack.securitySolution.detectionEngine.alerts.createNewTermsTimelineFailure": "document _idのタイムラインを作成できませんでした:{id}",
"xpack.securitySolution.detectionEngine.alerts.createNewTermsTimelineFailureTitle": "新しい用語アラートタイムラインを作成できませんでした",
Expand All @@ -34646,7 +34642,6 @@
"xpack.securitySolution.detectionEngine.alerts.createThresholdTimelineFailureTitle": "しきい値アラートタイムラインを作成できませんでした",
"xpack.securitySolution.detectionEngine.alerts.fetchExceptionFilterFailure": "例外フィルターの取得エラー。",
"xpack.securitySolution.detectionEngine.alerts.histogram.headerTitle": "傾向",
"xpack.securitySolution.detectionEngine.alerts.histogram.notAvailableTooltip": "傾向ビューでは使用できません",
"xpack.securitySolution.detectionEngine.alerts.histogram.showingAlertsTitle": "{modifier}{totalAlertsFormatted} {totalAlerts, plural, other {件のアラート}}を表示しています",
"xpack.securitySolution.detectionEngine.alerts.histogram.stackByOptions.groupByLabel": "グループ分けの条件",
"xpack.securitySolution.detectionEngine.alerts.histogram.stackByOptions.groupByTopLabel": "上位でグループ化",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33802,7 +33802,6 @@
"xpack.securitySolution.components.chartCollapse.noResultMessage": "无",
"xpack.securitySolution.components.chartCollapse.topGroup": "排名靠前已告警项",
"xpack.securitySolution.components.chartCollapse.topRule": "排名靠前已告警规则:",
"xpack.securitySolution.components.chartSelect.chartsOption": "图表",
"xpack.securitySolution.components.chartSelect.chartsOptionTitle": "摘要",
"xpack.securitySolution.components.chartSelect.legendTitle": "选择选项卡",
"xpack.securitySolution.components.chartSelect.tableOptionTitle": "计数",
Expand Down Expand Up @@ -34101,12 +34100,9 @@
"xpack.securitySolution.detectionEngine.alerts.alertsByGrouping.sourceLabel": "源",
"xpack.securitySolution.detectionEngine.alerts.alertsByGrouping.userNameLabel": "user",
"xpack.securitySolution.detectionEngine.alerts.alertsByType.alertRuleChartTitle": "按名称排列的告警",
"xpack.securitySolution.detectionEngine.alerts.chartsTitle": "图表",
"xpack.securitySolution.detectionEngine.alerts.closedAlertFailedToastMessage": "无法关闭告警。",
"xpack.securitySolution.detectionEngine.alerts.closedAlertsTitle": "已关闭",
"xpack.securitySolution.detectionEngine.alerts.closedAlertSuccessToastMessage": "已成功关闭 {totalAlerts} 个{totalAlerts, plural, other {告警}}。",
"xpack.securitySolution.detectionEngine.alerts.count.columnLabel": "排名前 {topN} 的 {fieldName} 值",
"xpack.securitySolution.detectionEngine.alerts.count.countTableColumnTitle": "记录计数",
"xpack.securitySolution.detectionEngine.alerts.count.countTableTitle": "计数",
"xpack.securitySolution.detectionEngine.alerts.createNewTermsTimelineFailure": "无法创建文档 _id 的时间线:{id}",
"xpack.securitySolution.detectionEngine.alerts.createNewTermsTimelineFailureTitle": "无法创建新的字词告警时间线",
Expand All @@ -34116,7 +34112,6 @@
"xpack.securitySolution.detectionEngine.alerts.createThresholdTimelineFailureTitle": "无法创建阈值告警时间线",
"xpack.securitySolution.detectionEngine.alerts.fetchExceptionFilterFailure": "提取例外筛选时出错。",
"xpack.securitySolution.detectionEngine.alerts.histogram.headerTitle": "趋势",
"xpack.securitySolution.detectionEngine.alerts.histogram.notAvailableTooltip": "不适用于趋势视图",
"xpack.securitySolution.detectionEngine.alerts.histogram.showingAlertsTitle": "正在显示:{modifier}{totalAlertsFormatted} 个{totalAlerts, plural, other {告警}}",
"xpack.securitySolution.detectionEngine.alerts.histogram.stackByOptions.groupByLabel": "分组依据",
"xpack.securitySolution.detectionEngine.alerts.histogram.stackByOptions.groupByTopLabel": "按顶部分组",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ const TopNComponent: React.FC<Props> = ({
filters={applicableFilters}
headerChildren={headerChildren}
onlyField={field}
paddingSize={paddingSize}
setAbsoluteRangeDatePickerTarget={setAbsoluteRangeDatePickerTarget}
hideQueryToggle
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ const RuleDetailsPageComponent: React.FC<DetectionEngineComponentProps> = ({
filters={alertMergedFilters}
signalIndexName={signalIndexName}
defaultStackByOption={defaultRuleStackByOption}
title={i18n.HISTOGRAM_HEADER}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a reason for adding a title?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not really adding the title, I just moved it from here

updateDateRange={updateDateRangeCallback}
/>
<EuiSpacer />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,10 @@ export const DELETE_CONFIRMATION_BODY = i18n.translate(
defaultMessage: 'This action will delete the rule. Click "Delete" to continue.',
}
);

export const HISTOGRAM_HEADER = i18n.translate(
'xpack.securitySolution.detectionEngine.alerts.histogram.headerTitle',
{
defaultMessage: 'Trend',
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*/

import type { EuiBasicTableColumn } from '@elastic/eui';
import { EuiInMemoryTable, EuiSpacer, EuiText } from '@elastic/eui';
import { EuiInMemoryTable, EuiSpacer, EuiText, useEuiTheme } from '@elastic/eui';
import React from 'react';
import styled from 'styled-components';
import { css } from '@emotion/react';
import type { SortOrder } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { ALERT_RULE_NAME } from '@kbn/rule-data-utils';
import { TableId } from '@kbn/securitysolution-data-table';
Expand All @@ -18,18 +18,13 @@ import { ALERTS_HEADERS_RULE_NAME } from '../../alerts_table/translations';
import { COUNT_TABLE_TITLE } from '../alerts_count_panel/translations';
import {
CellActionsMode,
SecurityCellActionsTrigger,
SecurityCellActions,
SecurityCellActionsTrigger,
SecurityCellActionType,
} from '../../../../common/components/cell_actions';
import { getSourcererScopeId } from '../../../../helpers';

const Wrapper = styled.div`
margin-top: -${({ theme }) => theme.eui.euiSizeM};
`;
const TableWrapper = styled.div`
height: 210px;
`;
const TABLE_HEIGHT = 210; // px

export interface AlertsByRuleProps {
data: AlertsByRuleData[];
Expand Down Expand Up @@ -89,16 +84,28 @@ const SORTING: { sort: { field: keyof AlertsByRuleData; direction: SortOrder } }
},
};

const PAGINATION: {} = {
const PAGINATION = {
pageSize: 25,
showPerPageOptions: false,
};

export const AlertsByRule: React.FC<AlertsByRuleProps> = ({ data, isLoading }) => {
const { euiTheme } = useEuiTheme();

return (
<Wrapper data-test-subj="alerts-by-rule">
<div
data-test-subj="alerts-by-rule"
css={css`
margin-top: -${euiTheme.size.m};
`}
>
<EuiSpacer size="xs" />
<TableWrapper className="eui-yScroll">
<div
className="eui-yScroll"
css={css`
height: ${TABLE_HEIGHT}px;
`}
>
<EuiInMemoryTable
data-test-subj="alerts-by-rule-table"
columns={COLUMNS}
Expand All @@ -107,8 +114,8 @@ export const AlertsByRule: React.FC<AlertsByRuleProps> = ({ data, isLoading }) =
sorting={SORTING}
pagination={PAGINATION}
/>
</TableWrapper>
</Wrapper>
</div>
</div>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ import { act } from '@testing-library/react';
import { mount } from 'enzyme';
import type { Action } from '@kbn/ui-actions-plugin/public';
import { AlertsCountPanel } from '.';

import type { Status } from '../../../../../common/api/detection_engine';
import { DEFAULT_STACK_BY_FIELD, DEFAULT_STACK_BY_FIELD1 } from '../common/config';
import { TestProviders } from '../../../../common/mock';
import { ChartContextMenu } from '../chart_panels/chart_context_menu';
import { COUNTS } from '../chart_panels/chart_select/translations';
import { VisualizationEmbeddable } from '../../../../common/components/visualization_actions/visualization_embeddable';

const from = '2022-07-28T08:20:18.966Z';
Expand Down Expand Up @@ -46,18 +43,17 @@ jest.mock('../common/hooks', () => ({

const mockSetIsExpanded = jest.fn();
const defaultProps = {
inspectTitle: COUNTS,
signalIndexName: 'signalIndexName',
stackByField0: DEFAULT_STACK_BY_FIELD,
stackByField1: DEFAULT_STACK_BY_FIELD1,
chartOptionsContextMenu: jest.fn(),
extraActions: [{ id: 'resetGroupByFields' }] as Action[],
filters: [],
panelHeight: 300,
setStackByField0: jest.fn(),
setStackByField1: jest.fn(),
stackByField0: DEFAULT_STACK_BY_FIELD,
stackByField1: DEFAULT_STACK_BY_FIELD1,
title: <div>{'test'}</div>,
isExpanded: true,
setIsExpanded: mockSetIsExpanded,
showBuildingBlockAlerts: false,
showOnlyThreatIndicatorAlerts: false,
status: 'open' as Status,
extraActions: [{ id: 'resetGroupByFields' }] as Action[],
};

describe('AlertsCountPanel', () => {
Expand All @@ -77,34 +73,6 @@ describe('AlertsCountPanel', () => {
});
});

it('renders with the specified `alignHeader` alignment', async () => {
await act(async () => {
const wrapper = mount(
<TestProviders>
<AlertsCountPanel {...defaultProps} alignHeader="flexEnd" />
</TestProviders>
);

expect(
wrapper.find('[data-test-subj="headerSectionInnerFlexGroup"]').last().getDOMNode().className
).toContain('flexEnd');
});
});

it('renders the inspect button by default', async () => {
await act(async () => {
const wrapper = mount(
<TestProviders>
<AlertsCountPanel {...defaultProps} alignHeader="flexEnd" />
</TestProviders>
);

expect(wrapper.find('button[data-test-subj="inspect-icon-button"]').first().exists()).toBe(
true
);
});
});

it('it does NOT render the inspect button when a `chartOptionsContextMenu` is provided', async () => {
const chartOptionsContextMenu = (queryId: string) => (
<ChartContextMenu
Expand Down Expand Up @@ -152,6 +120,7 @@ describe('AlertsCountPanel', () => {
expect(wrapper.find('[data-test-subj="visualization-embeddable"]').exists()).toEqual(true);
});
});

it('when isExpanded is false, hide counts panel', async () => {
await act(async () => {
const wrapper = mount(
Expand Down
Loading