Skip to content

Commit 89040c3

Browse files
Remove feature flag for manual rule run (#193833)
## Summary Remove feature flag for manual rule run --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit 3f75a1d)
1 parent ab8f467 commit 89040c3

24 files changed

Lines changed: 104 additions & 215 deletions

File tree

x-pack/plugins/security_solution/common/experimental_features.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,6 @@ export const allowedExperimentalValues = Object.freeze({
240240
*/
241241
valueListItemsModalEnabled: true,
242242

243-
/**
244-
* Enables the manual rule run
245-
*/
246-
manualRuleRunEnabled: false,
247-
248243
/**
249244
* Adds a new option to filter descendants of a process for Management / Event Filters
250245
*/

x-pack/plugins/security_solution/public/detection_engine/rule_details_ui/pages/rule_details/execution_log_table/__snapshots__/execution_log_search_bar.test.tsx.snap

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugins/security_solution/public/detection_engine/rule_details_ui/pages/rule_details/execution_log_table/execution_log_search_bar.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
} from '../../../../../../common/detection_engine/rule_management/execution_log';
2121

2222
import { ExecutionStatusFilter, ExecutionRunTypeFilter } from '../../../../rule_monitoring';
23-
import { useIsExperimentalFeatureEnabled } from '../../../../../common/hooks/use_experimental_features';
2423
import * as i18n from './translations';
2524

2625
export const EXECUTION_LOG_SCHEMA_MAPPING = {
@@ -75,7 +74,6 @@ export const ExecutionLogSearchBar = React.memo<ExecutionLogTableSearchProps>(
7574
},
7675
[onSearch]
7776
);
78-
const isManualRuleRunEnabled = useIsExperimentalFeatureEnabled('manualRuleRunEnabled');
7977

8078
return (
8179
<EuiFlexGroup gutterSize={'s'}>
@@ -93,15 +91,14 @@ export const ExecutionLogSearchBar = React.memo<ExecutionLogTableSearchProps>(
9391
</EuiFlexItem>
9492
<EuiFlexItem grow={false}>
9593
<EuiFlexGroup gutterSize={'s'}>
96-
{isManualRuleRunEnabled && (
97-
<EuiFlexItem grow={true}>
98-
<ExecutionRunTypeFilter
99-
items={RUN_TYPE_FILTERS}
100-
selectedItems={selectedRunTypes}
101-
onChange={onRunTypeFilterChange}
102-
/>
103-
</EuiFlexItem>
104-
)}
94+
<EuiFlexItem grow={true}>
95+
<ExecutionRunTypeFilter
96+
items={RUN_TYPE_FILTERS}
97+
selectedItems={selectedRunTypes}
98+
onChange={onRunTypeFilterChange}
99+
/>
100+
</EuiFlexItem>
101+
105102
<EuiFlexItem grow={true}>
106103
<ExecutionStatusFilter
107104
items={STATUS_FILTERS}

x-pack/plugins/security_solution/public/detection_engine/rule_details_ui/pages/rule_details/execution_log_table/execution_log_table.tsx

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ import {
8585
} from './execution_log_columns';
8686
import { ExecutionLogSearchBar } from './execution_log_search_bar';
8787

88-
import { useIsExperimentalFeatureEnabled } from '../../../../../common/hooks/use_experimental_features';
89-
9088
const EXECUTION_UUID_FIELD_NAME = 'kibana.alert.rule.execution.uuid';
9189

9290
const UtilitySwitch = styled(EuiSwitch)`
@@ -128,7 +126,6 @@ const ExecutionLogTableComponent: React.FC<ExecutionLogTableProps> = ({
128126
timelines,
129127
telemetry,
130128
} = useKibana().services;
131-
const isManualRuleRunEnabled = useIsExperimentalFeatureEnabled('manualRuleRunEnabled');
132129

133130
const {
134131
[RuleDetailTabs.executionResults]: {
@@ -473,15 +470,10 @@ const ExecutionLogTableComponent: React.FC<ExecutionLogTableProps> = ({
473470
);
474471

475472
const executionLogColumns = useMemo(() => {
476-
const columns = [...EXECUTION_LOG_COLUMNS].filter((item) => {
477-
if ('field' in item) {
478-
return item.field === 'type' ? isManualRuleRunEnabled : true;
479-
}
480-
return true;
481-
});
473+
const columns = [...EXECUTION_LOG_COLUMNS];
482474
let messageColumnWidth = 50;
483475

484-
if (showSourceEventTimeRange && isManualRuleRunEnabled) {
476+
if (showSourceEventTimeRange) {
485477
columns.push(...getSourceEventTimeRangeColumns());
486478
messageColumnWidth = 30;
487479
}
@@ -506,7 +498,6 @@ const ExecutionLogTableComponent: React.FC<ExecutionLogTableProps> = ({
506498

507499
return columns;
508500
}, [
509-
isManualRuleRunEnabled,
510501
actions,
511502
docLinks,
512503
showMetricColumns,
@@ -583,14 +574,12 @@ const ExecutionLogTableComponent: React.FC<ExecutionLogTableProps> = ({
583574
updatedAt: dataUpdatedAt,
584575
})}
585576
</UtilityBarText>
586-
{isManualRuleRunEnabled && (
587-
<UtilitySwitch
588-
label={i18n.RULE_EXECUTION_LOG_SHOW_SOURCE_EVENT_TIME_RANGE}
589-
checked={showSourceEventTimeRange}
590-
compressed={true}
591-
onChange={handleShowSourceEventTimeRange}
592-
/>
593-
)}
577+
<UtilitySwitch
578+
label={i18n.RULE_EXECUTION_LOG_SHOW_SOURCE_EVENT_TIME_RANGE}
579+
checked={showSourceEventTimeRange}
580+
compressed={true}
581+
onChange={handleShowSourceEventTimeRange}
582+
/>
594583
<UtilitySwitch
595584
label={i18n.RULE_EXECUTION_LOG_SHOW_METRIC_COLUMNS_SWITCH}
596585
checked={showMetricColumns}

x-pack/plugins/security_solution/public/detection_engine/rule_gaps/components/manual_rule_run/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
import moment from 'moment';
2121
import React, { useCallback, useMemo, useState } from 'react';
2222
import { MAX_MANUAL_RULE_RUN_LOOKBACK_WINDOW_DAYS } from '../../../../../common/constants';
23-
import { TECHNICAL_PREVIEW, TECHNICAL_PREVIEW_TOOLTIP } from '../../../../common/translations';
23+
import { BETA, BETA_TOOLTIP } from '../../../../common/translations';
2424

2525
import * as i18n from './translations';
2626

@@ -73,7 +73,7 @@ const ManualRuleRunModalComponent = ({ onCancel, onConfirm }: ManualRuleRunModal
7373
<EuiFlexGroup justifyContent="spaceBetween">
7474
<EuiFlexItem>{i18n.MANUAL_RULE_RUN_MODAL_TITLE}</EuiFlexItem>
7575
<EuiFlexItem grow={false}>
76-
<EuiBetaBadge label={TECHNICAL_PREVIEW} tooltipContent={TECHNICAL_PREVIEW_TOOLTIP} />
76+
<EuiBetaBadge label={BETA} tooltipContent={BETA_TOOLTIP} />
7777
</EuiFlexItem>
7878
</EuiFlexGroup>
7979
}

x-pack/plugins/security_solution/public/detection_engine/rule_gaps/components/rule_backfills_info/index.tsx

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ import { hasUserCRUDPermission } from '../../../../common/utils/privileges';
2525
import { useUserData } from '../../../../detections/components/user_info';
2626
import { getBackfillRowsFromResponse } from './utils';
2727
import { HeaderSection } from '../../../../common/components/header_section';
28-
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';
2928
import { TableHeaderTooltipCell } from '../../../rule_management_ui/components/rules_table/table_header_tooltip_cell';
30-
import { TECHNICAL_PREVIEW, TECHNICAL_PREVIEW_TOOLTIP } from '../../../../common/translations';
29+
import { BETA, BETA_TOOLTIP } from '../../../../common/translations';
3130
import { useKibana } from '../../../../common/lib/kibana';
3231

3332
const DEFAULT_PAGE_SIZE = 10;
@@ -143,26 +142,16 @@ const getBackfillsTableColumns = (hasCRUDPermissions: boolean) => {
143142
};
144143

145144
export const RuleBackfillsInfo = React.memo<{ ruleId: string }>(({ ruleId }) => {
146-
const isManualRuleRunEnabled = useIsExperimentalFeatureEnabled('manualRuleRunEnabled');
147145
const [pageIndex, setPageIndex] = useState(0);
148146
const [pageSize, setPageSize] = useState(DEFAULT_PAGE_SIZE);
149147
const [{ canUserCRUD }] = useUserData();
150148
const hasCRUDPermissions = hasUserCRUDPermission(canUserCRUD);
151149
const { timelines } = useKibana().services;
152-
const { data, isLoading, isError, refetch, dataUpdatedAt } = useFindBackfillsForRules(
153-
{
154-
ruleIds: [ruleId],
155-
page: pageIndex + 1,
156-
perPage: pageSize,
157-
},
158-
{
159-
enabled: isManualRuleRunEnabled,
160-
}
161-
);
162-
163-
if (!isManualRuleRunEnabled) {
164-
return null;
165-
}
150+
const { data, isLoading, isError, refetch, dataUpdatedAt } = useFindBackfillsForRules({
151+
ruleIds: [ruleId],
152+
page: pageIndex + 1,
153+
perPage: pageSize,
154+
});
166155

167156
const backfills: BackfillRow[] = getBackfillRowsFromResponse(data?.data ?? []);
168157

@@ -197,7 +186,7 @@ export const RuleBackfillsInfo = React.memo<{ ruleId: string }>(({ ruleId }) =>
197186
title={i18n.BACKFILL_TABLE_TITLE}
198187
subtitle={i18n.BACKFILL_TABLE_SUBTITLE}
199188
/>
200-
<EuiBetaBadge label={TECHNICAL_PREVIEW} tooltipContent={TECHNICAL_PREVIEW_TOOLTIP} />
189+
<EuiBetaBadge label={BETA} tooltipContent={BETA_TOOLTIP} />
201190
</EuiFlexGroup>
202191
</EuiFlexItem>
203192

x-pack/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/bulk_actions/use_bulk_actions.tsx

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { MAX_MANUAL_RULE_RUN_BULK_SIZE } from '../../../../../../common/constant
1616
import type { TimeRange } from '../../../../rule_gaps/types';
1717
import { useKibana } from '../../../../../common/lib/kibana';
1818
import { convertRulesFilterToKQL } from '../../../../../../common/detection_engine/rule_management/rule_filtering';
19-
import { useIsExperimentalFeatureEnabled } from '../../../../../common/hooks/use_experimental_features';
2019
import { DuplicateOptions } from '../../../../../../common/detection_engine/rule_management/constants';
2120
import type {
2221
BulkActionEditPayload,
@@ -89,7 +88,6 @@ export const useBulkActions = ({
8988
actions: { clearRulesSelection, setIsPreflightInProgress },
9089
} = rulesTableContext;
9190

92-
const isManualRuleRunEnabled = useIsExperimentalFeatureEnabled('manualRuleRunEnabled');
9391
const getBulkItemsPopoverContent = useCallback(
9492
(closePopover: () => void): EuiContextMenuPanelDescriptor[] => {
9593
const selectedRules = rules.filter(({ id }) => selectedRuleIds.includes(id));
@@ -448,18 +446,14 @@ export const useBulkActions = ({
448446
onClick: handleExportAction,
449447
icon: undefined,
450448
},
451-
...(isManualRuleRunEnabled
452-
? [
453-
{
454-
key: i18n.BULK_ACTION_MANUAL_RULE_RUN,
455-
name: i18n.BULK_ACTION_MANUAL_RULE_RUN,
456-
'data-test-subj': 'scheduleRuleRunBulk',
457-
disabled: containsLoading || (!containsEnabled && !isAllSelected),
458-
onClick: handleScheduleRuleRunAction,
459-
icon: undefined,
460-
},
461-
]
462-
: []),
449+
{
450+
key: i18n.BULK_ACTION_MANUAL_RULE_RUN,
451+
name: i18n.BULK_ACTION_MANUAL_RULE_RUN,
452+
'data-test-subj': 'scheduleRuleRunBulk',
453+
disabled: containsLoading || (!containsEnabled && !isAllSelected),
454+
onClick: handleScheduleRuleRunAction,
455+
icon: undefined,
456+
},
463457
{
464458
key: i18n.BULK_ACTION_DISABLE,
465459
name: i18n.BULK_ACTION_DISABLE,
@@ -600,7 +594,6 @@ export const useBulkActions = ({
600594
filterOptions,
601595
completeBulkEditForm,
602596
startServices,
603-
isManualRuleRunEnabled,
604597
]
605598
);
606599

x-pack/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/use_rules_table_actions.tsx

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import type { DefaultItemAction } from '@elastic/eui';
99
import { EuiToolTip } from '@elastic/eui';
1010
import React from 'react';
11-
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';
1211
import { DuplicateOptions } from '../../../../../common/detection_engine/rule_management/constants';
1312
import { BulkActionTypeEnum } from '../../../../../common/api/detection_engine/rule_management';
1413
import { SINGLE_RULE_ACTIONS } from '../../../../common/lib/apm/user_actions';
@@ -47,8 +46,6 @@ export const useRulesTableActions = ({
4746
const downloadExportedRules = useDownloadExportedRules();
4847
const { scheduleRuleRun } = useScheduleRuleRun();
4948

50-
const isManualRuleRunEnabled = useIsExperimentalFeatureEnabled('manualRuleRunEnabled');
51-
5249
return [
5350
{
5451
type: 'icon',
@@ -120,33 +117,28 @@ export const useRulesTableActions = ({
120117
},
121118
enabled: (rule: Rule) => !rule.immutable,
122119
},
123-
...(isManualRuleRunEnabled
124-
? [
125-
{
126-
type: 'icon',
127-
'data-test-subj': 'manualRuleRunAction',
128-
description: (rule) =>
129-
!rule.enabled ? i18n.MANUAL_RULE_RUN_TOOLTIP : i18n.MANUAL_RULE_RUN,
130-
icon: 'play',
131-
name: i18n.MANUAL_RULE_RUN,
132-
onClick: async (rule: Rule) => {
133-
startTransaction({ name: SINGLE_RULE_ACTIONS.MANUAL_RULE_RUN });
134-
const modalManualRuleRunConfirmationResult = await showManualRuleRunConfirmation();
135-
telemetry.reportManualRuleRunOpenModal({
136-
type: 'single',
137-
});
138-
if (modalManualRuleRunConfirmationResult === null) {
139-
return;
140-
}
141-
await scheduleRuleRun({
142-
ruleIds: [rule.id],
143-
timeRange: modalManualRuleRunConfirmationResult,
144-
});
145-
},
146-
enabled: (rule: Rule) => rule.enabled,
147-
} as DefaultItemAction<Rule>,
148-
]
149-
: []),
120+
{
121+
type: 'icon',
122+
'data-test-subj': 'manualRuleRunAction',
123+
description: (rule) => (!rule.enabled ? i18n.MANUAL_RULE_RUN_TOOLTIP : i18n.MANUAL_RULE_RUN),
124+
icon: 'play',
125+
name: i18n.MANUAL_RULE_RUN,
126+
onClick: async (rule: Rule) => {
127+
startTransaction({ name: SINGLE_RULE_ACTIONS.MANUAL_RULE_RUN });
128+
const modalManualRuleRunConfirmationResult = await showManualRuleRunConfirmation();
129+
telemetry.reportManualRuleRunOpenModal({
130+
type: 'single',
131+
});
132+
if (modalManualRuleRunConfirmationResult === null) {
133+
return;
134+
}
135+
await scheduleRuleRun({
136+
ruleIds: [rule.id],
137+
timeRange: modalManualRuleRunConfirmationResult,
138+
});
139+
},
140+
enabled: (rule: Rule) => rule.enabled,
141+
},
150142
{
151143
type: 'icon',
152144
'data-test-subj': 'deleteRuleAction',

x-pack/plugins/security_solution/public/detection_engine/rule_monitoring/components/execution_results_table/use_execution_results.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,20 @@
77

88
import { useQuery } from '@tanstack/react-query';
99
import { useAppToasts } from '../../../../common/hooks/use_app_toasts';
10-
11-
import { RuleRunTypeEnum } from '../../../../../common/api/detection_engine/rule_monitoring';
1210
import type { GetRuleExecutionResultsResponse } from '../../../../../common/api/detection_engine/rule_monitoring';
1311
import type { FetchRuleExecutionResultsArgs } from '../../api';
1412
import { api } from '../../api';
15-
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';
1613
import * as i18n from './translations';
1714

1815
export type UseExecutionResultsArgs = Omit<FetchRuleExecutionResultsArgs, 'signal'>;
1916

2017
export const useExecutionResults = (args: UseExecutionResultsArgs) => {
2118
const { addError } = useAppToasts();
22-
const isManualRuleRunEnabled = useIsExperimentalFeatureEnabled('manualRuleRunEnabled');
2319

2420
return useQuery<GetRuleExecutionResultsResponse>(
2521
['detectionEngine', 'ruleMonitoring', 'executionResults', args],
2622
({ signal }) => {
27-
let runTypeFilters = args.runTypeFilters;
28-
29-
// if manual rule run is disabled, only show standard runs
30-
if (!isManualRuleRunEnabled) {
31-
runTypeFilters = [RuleRunTypeEnum.standard];
32-
}
23+
const runTypeFilters = args.runTypeFilters;
3324

3425
return api.fetchRuleExecutionResults({ ...args, runTypeFilters, signal });
3526
},

x-pack/plugins/security_solution/public/detections/components/rules/rule_actions_overflow/index.test.tsx

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -274,25 +274,6 @@ describe('RuleActionsOverflow', () => {
274274
expect(getByTestId('rules-details-popover')).not.toHaveTextContent(/.+/);
275275
});
276276

277-
test('it does not show "Manual run" action item when feature flag "manualRuleRunEnabled" is set to false', () => {
278-
useIsExperimentalFeatureEnabledMock.mockReturnValue(false);
279-
280-
const { getByTestId } = render(
281-
<RuleActionsOverflow
282-
showBulkDuplicateExceptionsConfirmation={showBulkDuplicateExceptionsConfirmation}
283-
showManualRuleRunConfirmation={showManualRuleRunConfirmation}
284-
rule={mockRule('id')}
285-
userHasPermissions
286-
canDuplicateRuleWithActions={true}
287-
confirmDeletion={() => Promise.resolve(true)}
288-
/>,
289-
{ wrapper: TestProviders }
290-
);
291-
fireEvent.click(getByTestId('rules-details-popover-button-icon'));
292-
293-
expect(getByTestId('rules-details-menu-panel')).not.toHaveTextContent('Manual run');
294-
});
295-
296277
test('it calls telemetry.reportManualRuleRunOpenModal when rules-details-manual-rule-run is clicked', async () => {
297278
const { getByTestId } = render(
298279
<RuleActionsOverflow

0 commit comments

Comments
 (0)