[Security Solution] - Rename esql setting (#182432)

## Summary

Follow up to this PR: https://github.com/elastic/kibana/pull/181616
Renaming `discover:enableEsql` to `enableESQL` according to this change:
https://github.com/elastic/kibana/pull/182074
This commit is contained in:
Michael Olorunnisola 2024-05-02 15:18:05 -04:00 committed by GitHub
parent f328ec6e6b
commit c0532083ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,12 +6,18 @@
*/
import { useMemo } from 'react';
import { ENABLE_ESQL } from '@kbn/esql-utils';
import { useKibana } from '../../lib/kibana';
import { useIsExperimentalFeatureEnabled } from '../use_experimental_features';
/**
* This hook combines the checks for esql availability within the security solution
* If the advanced setting is disabled, ESQL will not be accessible in the UI for any new timeline or new rule creation workflows
* The feature flags are still available to provide users an escape hatch in case of any esql related performance issues
*/
export const useEsqlAvailability = () => {
const { uiSettings } = useKibana().services;
const isEsqlAdvancedSettingEnabled = uiSettings?.get('discover:enableESQL');
const isEsqlAdvancedSettingEnabled = uiSettings?.get(ENABLE_ESQL);
const isEsqlRuleTypeEnabled =
!useIsExperimentalFeatureEnabled('esqlRulesDisabled') && isEsqlAdvancedSettingEnabled;
const isESQLTabInTimelineEnabled =