Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,6 @@ export const allowedExperimentalValues = Object.freeze({
*/
valueListItemsModalEnabled: true,

/**
* Enables the manual rule run
*/
manualRuleRunEnabled: false,

/**
* Adds a new option to filter descendants of a process for Management / Event Filters
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
} from '../../../../../../common/detection_engine/rule_management/execution_log';

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

export const EXECUTION_LOG_SCHEMA_MAPPING = {
Expand Down Expand Up @@ -75,7 +74,6 @@ export const ExecutionLogSearchBar = React.memo<ExecutionLogTableSearchProps>(
},
[onSearch]
);
const isManualRuleRunEnabled = useIsExperimentalFeatureEnabled('manualRuleRunEnabled');

return (
<EuiFlexGroup gutterSize={'s'}>
Expand All @@ -93,15 +91,14 @@ export const ExecutionLogSearchBar = React.memo<ExecutionLogTableSearchProps>(
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiFlexGroup gutterSize={'s'}>
{isManualRuleRunEnabled && (
<EuiFlexItem grow={true}>
<ExecutionRunTypeFilter
items={RUN_TYPE_FILTERS}
selectedItems={selectedRunTypes}
onChange={onRunTypeFilterChange}
/>
</EuiFlexItem>
)}
<EuiFlexItem grow={true}>
<ExecutionRunTypeFilter
items={RUN_TYPE_FILTERS}
selectedItems={selectedRunTypes}
onChange={onRunTypeFilterChange}
/>
</EuiFlexItem>

<EuiFlexItem grow={true}>
<ExecutionStatusFilter
items={STATUS_FILTERS}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ import {
} from './execution_log_columns';
import { ExecutionLogSearchBar } from './execution_log_search_bar';

import { useIsExperimentalFeatureEnabled } from '../../../../../common/hooks/use_experimental_features';

const EXECUTION_UUID_FIELD_NAME = 'kibana.alert.rule.execution.uuid';

const UtilitySwitch = styled(EuiSwitch)`
Expand Down Expand Up @@ -128,7 +126,6 @@ const ExecutionLogTableComponent: React.FC<ExecutionLogTableProps> = ({
timelines,
telemetry,
} = useKibana().services;
const isManualRuleRunEnabled = useIsExperimentalFeatureEnabled('manualRuleRunEnabled');

const {
[RuleDetailTabs.executionResults]: {
Expand Down Expand Up @@ -473,15 +470,10 @@ const ExecutionLogTableComponent: React.FC<ExecutionLogTableProps> = ({
);

const executionLogColumns = useMemo(() => {
const columns = [...EXECUTION_LOG_COLUMNS].filter((item) => {
if ('field' in item) {
return item.field === 'type' ? isManualRuleRunEnabled : true;
}
return true;
});
const columns = [...EXECUTION_LOG_COLUMNS];
let messageColumnWidth = 50;

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

return columns;
}, [
isManualRuleRunEnabled,
actions,
docLinks,
showMetricColumns,
Expand Down Expand Up @@ -583,14 +574,12 @@ const ExecutionLogTableComponent: React.FC<ExecutionLogTableProps> = ({
updatedAt: dataUpdatedAt,
})}
</UtilityBarText>
{isManualRuleRunEnabled && (
<UtilitySwitch
label={i18n.RULE_EXECUTION_LOG_SHOW_SOURCE_EVENT_TIME_RANGE}
checked={showSourceEventTimeRange}
compressed={true}
onChange={handleShowSourceEventTimeRange}
/>
)}
<UtilitySwitch
label={i18n.RULE_EXECUTION_LOG_SHOW_SOURCE_EVENT_TIME_RANGE}
checked={showSourceEventTimeRange}
compressed={true}
onChange={handleShowSourceEventTimeRange}
/>
<UtilitySwitch
label={i18n.RULE_EXECUTION_LOG_SHOW_METRIC_COLUMNS_SWITCH}
checked={showMetricColumns}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { hasUserCRUDPermission } from '../../../../common/utils/privileges';
import { useUserData } from '../../../../detections/components/user_info';
import { getBackfillRowsFromResponse } from './utils';
import { HeaderSection } from '../../../../common/components/header_section';
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';
import { TableHeaderTooltipCell } from '../../../rule_management_ui/components/rules_table/table_header_tooltip_cell';
import { TECHNICAL_PREVIEW, TECHNICAL_PREVIEW_TOOLTIP } from '../../../../common/translations';
import { useKibana } from '../../../../common/lib/kibana';
Expand Down Expand Up @@ -143,26 +142,16 @@ const getBackfillsTableColumns = (hasCRUDPermissions: boolean) => {
};

export const RuleBackfillsInfo = React.memo<{ ruleId: string }>(({ ruleId }) => {
const isManualRuleRunEnabled = useIsExperimentalFeatureEnabled('manualRuleRunEnabled');
const [pageIndex, setPageIndex] = useState(0);
const [pageSize, setPageSize] = useState(DEFAULT_PAGE_SIZE);
const [{ canUserCRUD }] = useUserData();
const hasCRUDPermissions = hasUserCRUDPermission(canUserCRUD);
const { timelines } = useKibana().services;
const { data, isLoading, isError, refetch, dataUpdatedAt } = useFindBackfillsForRules(
{
ruleIds: [ruleId],
page: pageIndex + 1,
perPage: pageSize,
},
{
enabled: isManualRuleRunEnabled,
}
);

if (!isManualRuleRunEnabled) {
return null;
}
const { data, isLoading, isError, refetch, dataUpdatedAt } = useFindBackfillsForRules({
ruleIds: [ruleId],
page: pageIndex + 1,
perPage: pageSize,
});

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { MAX_MANUAL_RULE_RUN_BULK_SIZE } from '../../../../../../common/constant
import type { TimeRange } from '../../../../rule_gaps/types';
import { useKibana } from '../../../../../common/lib/kibana';
import { convertRulesFilterToKQL } from '../../../../../../common/detection_engine/rule_management/rule_filtering';
import { useIsExperimentalFeatureEnabled } from '../../../../../common/hooks/use_experimental_features';
import { DuplicateOptions } from '../../../../../../common/detection_engine/rule_management/constants';
import type {
BulkActionEditPayload,
Expand Down Expand Up @@ -89,7 +88,6 @@ export const useBulkActions = ({
actions: { clearRulesSelection, setIsPreflightInProgress },
} = rulesTableContext;

const isManualRuleRunEnabled = useIsExperimentalFeatureEnabled('manualRuleRunEnabled');
const getBulkItemsPopoverContent = useCallback(
(closePopover: () => void): EuiContextMenuPanelDescriptor[] => {
const selectedRules = rules.filter(({ id }) => selectedRuleIds.includes(id));
Expand Down Expand Up @@ -448,18 +446,14 @@ export const useBulkActions = ({
onClick: handleExportAction,
icon: undefined,
},
...(isManualRuleRunEnabled
? [
{
key: i18n.BULK_ACTION_MANUAL_RULE_RUN,
name: i18n.BULK_ACTION_MANUAL_RULE_RUN,
'data-test-subj': 'scheduleRuleRunBulk',
disabled: containsLoading || (!containsEnabled && !isAllSelected),
onClick: handleScheduleRuleRunAction,
icon: undefined,
},
]
: []),
{
key: i18n.BULK_ACTION_MANUAL_RULE_RUN,
name: i18n.BULK_ACTION_MANUAL_RULE_RUN,
'data-test-subj': 'scheduleRuleRunBulk',
disabled: containsLoading || (!containsEnabled && !isAllSelected),
onClick: handleScheduleRuleRunAction,
icon: undefined,
},
{
key: i18n.BULK_ACTION_DISABLE,
name: i18n.BULK_ACTION_DISABLE,
Expand Down Expand Up @@ -600,7 +594,6 @@ export const useBulkActions = ({
filterOptions,
completeBulkEditForm,
startServices,
isManualRuleRunEnabled,
]
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import type { DefaultItemAction } from '@elastic/eui';
import { EuiToolTip } from '@elastic/eui';
import React from 'react';
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';
import { DuplicateOptions } from '../../../../../common/detection_engine/rule_management/constants';
import { BulkActionTypeEnum } from '../../../../../common/api/detection_engine/rule_management';
import { SINGLE_RULE_ACTIONS } from '../../../../common/lib/apm/user_actions';
Expand Down Expand Up @@ -47,8 +46,6 @@ export const useRulesTableActions = ({
const downloadExportedRules = useDownloadExportedRules();
const { scheduleRuleRun } = useScheduleRuleRun();

const isManualRuleRunEnabled = useIsExperimentalFeatureEnabled('manualRuleRunEnabled');

return [
{
type: 'icon',
Expand Down Expand Up @@ -120,33 +117,28 @@ export const useRulesTableActions = ({
},
enabled: (rule: Rule) => !rule.immutable,
},
...(isManualRuleRunEnabled
? [
{
type: 'icon',
'data-test-subj': 'manualRuleRunAction',
description: (rule) =>
!rule.enabled ? i18n.MANUAL_RULE_RUN_TOOLTIP : i18n.MANUAL_RULE_RUN,
icon: 'play',
name: i18n.MANUAL_RULE_RUN,
onClick: async (rule: Rule) => {
startTransaction({ name: SINGLE_RULE_ACTIONS.MANUAL_RULE_RUN });
const modalManualRuleRunConfirmationResult = await showManualRuleRunConfirmation();
telemetry.reportManualRuleRunOpenModal({
type: 'single',
});
if (modalManualRuleRunConfirmationResult === null) {
return;
}
await scheduleRuleRun({
ruleIds: [rule.id],
timeRange: modalManualRuleRunConfirmationResult,
});
},
enabled: (rule: Rule) => rule.enabled,
} as DefaultItemAction<Rule>,
]
: []),
{
type: 'icon',
'data-test-subj': 'manualRuleRunAction',
description: (rule) => (!rule.enabled ? i18n.MANUAL_RULE_RUN_TOOLTIP : i18n.MANUAL_RULE_RUN),
icon: 'play',
name: i18n.MANUAL_RULE_RUN,
onClick: async (rule: Rule) => {
startTransaction({ name: SINGLE_RULE_ACTIONS.MANUAL_RULE_RUN });
const modalManualRuleRunConfirmationResult = await showManualRuleRunConfirmation();
telemetry.reportManualRuleRunOpenModal({
type: 'single',
});
if (modalManualRuleRunConfirmationResult === null) {
return;
}
await scheduleRuleRun({
ruleIds: [rule.id],
timeRange: modalManualRuleRunConfirmationResult,
});
},
enabled: (rule: Rule) => rule.enabled,
},
{
type: 'icon',
'data-test-subj': 'deleteRuleAction',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,20 @@

import { useQuery } from '@tanstack/react-query';
import { useAppToasts } from '../../../../common/hooks/use_app_toasts';

import { RuleRunTypeEnum } from '../../../../../common/api/detection_engine/rule_monitoring';
import type { GetRuleExecutionResultsResponse } from '../../../../../common/api/detection_engine/rule_monitoring';
import type { FetchRuleExecutionResultsArgs } from '../../api';
import { api } from '../../api';
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';
import * as i18n from './translations';

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

export const useExecutionResults = (args: UseExecutionResultsArgs) => {
const { addError } = useAppToasts();
const isManualRuleRunEnabled = useIsExperimentalFeatureEnabled('manualRuleRunEnabled');

return useQuery<GetRuleExecutionResultsResponse>(
['detectionEngine', 'ruleMonitoring', 'executionResults', args],
({ signal }) => {
let runTypeFilters = args.runTypeFilters;

// if manual rule run is disabled, only show standard runs
if (!isManualRuleRunEnabled) {
runTypeFilters = [RuleRunTypeEnum.standard];
}
const runTypeFilters = args.runTypeFilters;

return api.fetchRuleExecutionResults({ ...args, runTypeFilters, signal });
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,25 +274,6 @@ describe('RuleActionsOverflow', () => {
expect(getByTestId('rules-details-popover')).not.toHaveTextContent(/.+/);
});

test('it does not show "Manual run" action item when feature flag "manualRuleRunEnabled" is set to false', () => {
useIsExperimentalFeatureEnabledMock.mockReturnValue(false);

const { getByTestId } = render(
<RuleActionsOverflow
showBulkDuplicateExceptionsConfirmation={showBulkDuplicateExceptionsConfirmation}
showManualRuleRunConfirmation={showManualRuleRunConfirmation}
rule={mockRule('id')}
userHasPermissions
canDuplicateRuleWithActions={true}
confirmDeletion={() => Promise.resolve(true)}
/>,
{ wrapper: TestProviders }
);
fireEvent.click(getByTestId('rules-details-popover-button-icon'));

expect(getByTestId('rules-details-menu-panel')).not.toHaveTextContent('Manual run');
});

test('it calls telemetry.reportManualRuleRunOpenModal when rules-details-manual-rule-run is clicked', async () => {
const { getByTestId } = render(
<RuleActionsOverflow
Expand Down
Loading