Hide manual rule run behind feature flag for bulk actions (#188506)

## 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 <elasticmachine@users.noreply.github.com>
This commit is contained in:
Khristinin Nikita 2024-07-29 09:54:49 +02:00 committed by GitHub
parent 05534b0899
commit 5a09ec9a30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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,
@ -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));
@ -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,
@ -594,6 +600,7 @@ export const useBulkActions = ({
filterOptions,
completeBulkEditForm,
startServices,
isManualRuleRunEnabled,
]
);