[Security Solution][Detection Engine] removes feature flag for AI assistant on rule create form (#189040)

## Summary

- removes feature flag AIAssistantOnRuleCreationFormEnabled
This commit is contained in:
Vitalii Dmyterko 2024-07-25 11:24:52 +01:00 committed by GitHub
parent fb34fc70bc
commit a8e19eef5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 1 additions and 30 deletions

View file

@ -158,11 +158,6 @@ export const allowedExperimentalValues = Object.freeze({
*/
protectionUpdatesEnabled: true,
/**
* Enables AI assistant on rule creation form when query has error
*/
AIAssistantOnRuleCreationFormEnabled: false,
/**
* Disables the timeline save tour.
* This flag is used to disable the tour in cypress tests.

View file

@ -25,7 +25,6 @@ import {
createIndexPatternField,
getSelectToggleButtonForName,
} from '../../../rule_creation/components/required_fields/required_fields.test';
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';
// Mocks integrations
jest.mock('../../../fleet_integrations/api');
@ -49,11 +48,6 @@ jest.mock('../ai_assistant', () => {
};
});
jest.mock('../../../../common/hooks/use_experimental_features', () => ({
useIsExperimentalFeatureEnabled: jest.fn(),
}));
const useIsExperimentalFeatureEnabledMock = useIsExperimentalFeatureEnabled as jest.Mock;
const mockRedirectLegacyUrl = jest.fn();
const mockGetLegacyUrlConflict = jest.fn();
jest.mock('../../../../common/lib/kibana', () => {
@ -631,9 +625,6 @@ describe('StepDefineRule', () => {
});
describe('AI assistant', () => {
beforeEach(() => {
useIsExperimentalFeatureEnabledMock.mockReturnValue(true);
});
it('renders assistant when query is not valid', () => {
render(<TestForm formProps={{ isQueryBarValid: false, ruleType: 'query' }} />, {
wrapper: TestProviders,
@ -642,16 +633,6 @@ describe('StepDefineRule', () => {
expect(screen.getByTestId('ai-assistant')).toBeInTheDocument();
});
it('does not render assistant when feature flag is disabled', () => {
useIsExperimentalFeatureEnabledMock.mockReturnValue(false);
render(<TestForm formProps={{ isQueryBarValid: false, ruleType: 'query' }} />, {
wrapper: TestProviders,
});
expect(screen.queryByTestId('ai-assistant')).toBe(null);
});
it('does not render assistant when query is valid', () => {
render(<TestForm formProps={{ isQueryBarValid: true, ruleType: 'query' }} />, {
wrapper: TestProviders,

View file

@ -54,7 +54,6 @@ import { MlJobSelect } from '../../../rule_creation/components/ml_job_select';
import { PickTimeline } from '../../../rule_creation/components/pick_timeline';
import { StepContentWrapper } from '../../../rule_creation/components/step_content_wrapper';
import { ThresholdInput } from '../threshold_input';
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';
import { SuppressionInfoIcon } from '../suppression_info_icon';
import { EsqlInfoIcon } from '../../../rule_creation/components/esql_info_icon';
import {
@ -216,10 +215,6 @@ const StepDefineRuleComponent: FC<StepDefineRuleProps> = ({
const isThresholdRule = getIsThresholdRule(ruleType);
const alertSuppressionUpsellingMessage = useUpsellingMessage('alert_suppression_rule_form');
const isAIAssistantEnabled = useIsExperimentalFeatureEnabled(
'AIAssistantOnRuleCreationFormEnabled'
);
const { getFields, reset, setFieldValue } = form;
const setRuleTypeCallback = useSetFieldValueWithCallback({
@ -938,7 +933,7 @@ const StepDefineRuleComponent: FC<StepDefineRuleProps> = ({
</>
</RuleTypeEuiFormRow>
{isAIAssistantEnabled && !isMlRule(ruleType) && !isQueryBarValid && (
{!isMlRule(ruleType) && !isQueryBarValid && (
<AiAssistant getFields={form.getFields} language={queryBar?.query?.language} />
)}