Skip to content

Commit

Permalink
Hide manual rule run behind feature flag for bulk actions (#188506)
Browse files Browse the repository at this point in the history
## Hide manual rule run behind feature flag for bulk actions

Currently it exposes on serverless, but user can't run it still. We are
waiting for docs, to remove FF

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
nkhristinin and elasticmachine authored Jul 29, 2024
1 parent 05534b0 commit 5a09ec9
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ 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 @@ -88,6 +89,7 @@ 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 @@ -446,14 +448,18 @@ export const useBulkActions = ({
onClick: handleExportAction,
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,
},
...(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_DISABLE,
name: i18n.BULK_ACTION_DISABLE,
Expand Down Expand Up @@ -594,6 +600,7 @@ export const useBulkActions = ({
filterOptions,
completeBulkEditForm,
startServices,
isManualRuleRunEnabled,
]
);

Expand Down

0 comments on commit 5a09ec9

Please sign in to comment.