mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Security Solution][THI] - remove obsolete timelineEsqlTabDisabled feature flag (#205175)
## Summary This PR removes the `timelineEsqlTabDisabled` feature flag that was introduced a long time ago and has been in `disabled: false` state for many months. I noticed that the line was moved in [this PR](https://github.com/elastic/kibana/pull/176064) over 6 months ago but the introduction of the feature precedes that. No UI changes introduced!
This commit is contained in:
parent
f833b18d19
commit
3d6f45292f
6 changed files with 15 additions and 84 deletions
|
@ -184,12 +184,6 @@ export const allowedExperimentalValues = Object.freeze({
|
|||
*/
|
||||
jamfDataInAnalyzerEnabled: true,
|
||||
|
||||
/*
|
||||
* Disables discover esql tab within timeline
|
||||
*
|
||||
*/
|
||||
timelineEsqlTabDisabled: false,
|
||||
|
||||
/**
|
||||
* Enables graph visualization in alerts flyout
|
||||
*/
|
||||
|
|
|
@ -34,7 +34,6 @@ import {
|
|||
} from '../../timelines/store/actions';
|
||||
import { useDiscoverInTimelineContext } from '../../common/components/discover_in_timeline/use_discover_in_timeline_context';
|
||||
import { useShowTimeline } from '../../common/utils/timeline/use_show_timeline';
|
||||
import { useIsExperimentalFeatureEnabled } from '../../common/hooks/use_experimental_features';
|
||||
import { useSourcererDataView } from '../../sourcerer/containers';
|
||||
import { useDiscoverState } from '../../timelines/components/timeline/tabs/esql/use_discover_state';
|
||||
|
||||
|
@ -63,8 +62,6 @@ export const SendToTimelineButton: FC<PropsWithChildren<SendToTimelineButtonProp
|
|||
const { dataViewId: timelineDataViewId } = useSourcererDataView(SourcererScopeName.timeline);
|
||||
const { setDiscoverAppState } = useDiscoverState();
|
||||
|
||||
const isEsqlTabInTimelineDisabled = useIsExperimentalFeatureEnabled('timelineEsqlTabDisabled');
|
||||
|
||||
const signalIndexName = useSelector(sourcererSelectors.signalIndexName);
|
||||
const defaultDataView = useSelector(sourcererSelectors.defaultDataView);
|
||||
|
||||
|
@ -245,10 +242,7 @@ export const SendToTimelineButton: FC<PropsWithChildren<SendToTimelineButtonProp
|
|||
: ACTION_CANNOT_INVESTIGATE_IN_TIMELINE;
|
||||
const isDisabled = !isTimelineBottomBarVisible;
|
||||
|
||||
if (
|
||||
(dataProviders?.[0]?.queryType === 'esql' || dataProviders?.[0]?.queryType === 'sql') &&
|
||||
isEsqlTabInTimelineDisabled
|
||||
) {
|
||||
if (dataProviders?.[0]?.queryType === 'esql' || dataProviders?.[0]?.queryType === 'sql') {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,9 +19,6 @@ export const useEsqlAvailability = () => {
|
|||
const { uiSettings } = useKibana().services;
|
||||
const isEsqlAdvancedSettingEnabled = uiSettings?.get(ENABLE_ESQL);
|
||||
|
||||
const isTimelineEsqlFeatureFlagDisabled =
|
||||
useIsExperimentalFeatureEnabled('timelineEsqlTabDisabled');
|
||||
|
||||
const isEsqlRuleTypeEnabled =
|
||||
!useIsExperimentalFeatureEnabled('esqlRulesDisabled') && isEsqlAdvancedSettingEnabled;
|
||||
|
||||
|
@ -29,8 +26,7 @@ export const useEsqlAvailability = () => {
|
|||
() => ({
|
||||
isEsqlAdvancedSettingEnabled,
|
||||
isEsqlRuleTypeEnabled,
|
||||
isTimelineEsqlEnabledByFeatureFlag: !isTimelineEsqlFeatureFlagDisabled,
|
||||
}),
|
||||
[isEsqlAdvancedSettingEnabled, isTimelineEsqlFeatureFlagDisabled, isEsqlRuleTypeEnabled]
|
||||
[isEsqlAdvancedSettingEnabled, isEsqlRuleTypeEnabled]
|
||||
);
|
||||
};
|
||||
|
|
|
@ -10,17 +10,14 @@ import { safeDecode } from '@kbn/rison';
|
|||
import { useSelector } from 'react-redux';
|
||||
|
||||
import type { State } from '../../store';
|
||||
import { TimelineId, TimelineTabs } from '../../../../common/types';
|
||||
import { TimelineId } from '../../../../common/types';
|
||||
import { useInitializeUrlParam } from '../../utils/global_query_string';
|
||||
import { useQueryTimelineById } from '../../../timelines/components/open_timeline/helpers';
|
||||
import type { TimelineModel, TimelineUrl } from '../../../timelines/store/model';
|
||||
import { selectTimelineById } from '../../../timelines/store/selectors';
|
||||
import { URL_PARAM_KEY } from '../use_url_state';
|
||||
import { useIsExperimentalFeatureEnabled } from '../use_experimental_features';
|
||||
|
||||
export const useInitTimelineFromUrlParam = () => {
|
||||
const isEsqlTabDisabled = useIsExperimentalFeatureEnabled('timelineEsqlTabDisabled');
|
||||
|
||||
const queryTimelineById = useQueryTimelineById();
|
||||
const activeTimeline = useSelector((state: State) =>
|
||||
selectTimelineById(state, TimelineId.active)
|
||||
|
@ -30,10 +27,7 @@ export const useInitTimelineFromUrlParam = () => {
|
|||
(initialState: TimelineUrl | null) => {
|
||||
if (initialState != null) {
|
||||
queryTimelineById({
|
||||
activeTimelineTab:
|
||||
initialState.activeTab === TimelineTabs.esql && isEsqlTabDisabled
|
||||
? TimelineTabs.query
|
||||
: initialState.activeTab,
|
||||
activeTimelineTab: initialState.activeTab,
|
||||
duplicate: false,
|
||||
graphEventId: initialState.graphEventId,
|
||||
timelineId: initialState.id,
|
||||
|
@ -42,7 +36,7 @@ export const useInitTimelineFromUrlParam = () => {
|
|||
});
|
||||
}
|
||||
},
|
||||
[isEsqlTabDisabled, queryTimelineById]
|
||||
[queryTimelineById]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
@ -39,7 +39,6 @@ jest.mock('react-router-dom', () => {
|
|||
jest.mock('../../../../common/hooks/esql/use_esql_availability', () => ({
|
||||
useEsqlAvailability: jest.fn().mockReturnValue({
|
||||
isEsqlAdvancedSettingEnabled: true,
|
||||
isTimelineEsqlEnabledByFeatureFlag: true,
|
||||
}),
|
||||
}));
|
||||
|
||||
|
@ -73,22 +72,6 @@ describe('Timeline', () => {
|
|||
it('should not show the esql tab when the advanced setting is disabled', async () => {
|
||||
useEsqlAvailabilityMock.mockReturnValue({
|
||||
isEsqlAdvancedSettingEnabled: false,
|
||||
isTimelineEsqlEnabledByFeatureFlag: true,
|
||||
});
|
||||
render(
|
||||
<TestProviders>
|
||||
<TabsContent {...defaultProps} />
|
||||
</TestProviders>
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.queryByTestId(esqlTabSubj)).toBeNull();
|
||||
});
|
||||
});
|
||||
it('should not show the esql tab when the esql is disabled by feature flag', async () => {
|
||||
useEsqlAvailabilityMock.mockReturnValue({
|
||||
isEsqlAdvancedSettingEnabled: false,
|
||||
isTimelineEsqlEnabledByFeatureFlag: false,
|
||||
});
|
||||
render(
|
||||
<TestProviders>
|
||||
|
@ -113,7 +96,6 @@ describe('Timeline', () => {
|
|||
it('should show the esql tab when the advanced setting is disabled', async () => {
|
||||
useEsqlAvailabilityMock.mockReturnValue({
|
||||
isESQLTabInTimelineEnabled: false,
|
||||
isTimelineEsqlEnabledByFeatureFlag: true,
|
||||
});
|
||||
|
||||
render(
|
||||
|
@ -126,23 +108,6 @@ describe('Timeline', () => {
|
|||
expect(screen.queryByTestId(esqlTabSubj)).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
it('should not show the esql tab when the esql is disabled by the feature flag', async () => {
|
||||
useEsqlAvailabilityMock.mockReturnValue({
|
||||
isESQLTabInTimelineEnabled: true,
|
||||
isTimelineEsqlEnabledByFeatureFlag: false,
|
||||
});
|
||||
|
||||
render(
|
||||
<TestProviders store={mockStore}>
|
||||
<TabsContent {...defaultProps} />
|
||||
</TestProviders>
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.queryByTestId(esqlTabSubj)).toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -107,20 +107,14 @@ const ActiveTimelineTab = memo<ActiveTimelineTabProps>(
|
|||
timelineType,
|
||||
showTimeline,
|
||||
}) => {
|
||||
const { isTimelineEsqlEnabledByFeatureFlag, isEsqlAdvancedSettingEnabled } =
|
||||
useEsqlAvailability();
|
||||
const { isEsqlAdvancedSettingEnabled } = useEsqlAvailability();
|
||||
const timelineESQLSavedSearch = useShallowEqualSelector((state) =>
|
||||
selectTimelineESQLSavedSearchId(state, timelineId)
|
||||
);
|
||||
const shouldShowESQLTab = useMemo(() => {
|
||||
// disabling esql feature from feature flag should unequivocally hide the tab
|
||||
// irrespective of the fact that the advanced setting is enabled or
|
||||
// not or existing esql query is present or not
|
||||
if (!isTimelineEsqlEnabledByFeatureFlag) {
|
||||
return false;
|
||||
}
|
||||
return isEsqlAdvancedSettingEnabled || timelineESQLSavedSearch != null;
|
||||
}, [isEsqlAdvancedSettingEnabled, isTimelineEsqlEnabledByFeatureFlag, timelineESQLSavedSearch]);
|
||||
const shouldShowESQLTab = useMemo(
|
||||
() => isEsqlAdvancedSettingEnabled || timelineESQLSavedSearch != null,
|
||||
[isEsqlAdvancedSettingEnabled, timelineESQLSavedSearch]
|
||||
);
|
||||
const getTab = useCallback(
|
||||
(tab: TimelineTabs) => {
|
||||
switch (tab) {
|
||||
|
@ -246,8 +240,7 @@ const TabsContentComponent: React.FC<BasicTimelineTab> = ({
|
|||
const getAppNotes = useMemo(() => getNotesSelector(), []);
|
||||
const getTimelineNoteIds = useMemo(() => getNoteIdsSelector(), []);
|
||||
const getTimelinePinnedEventNotes = useMemo(() => getEventIdToNoteIdsSelector(), []);
|
||||
const { isEsqlAdvancedSettingEnabled, isTimelineEsqlEnabledByFeatureFlag } =
|
||||
useEsqlAvailability();
|
||||
const { isEsqlAdvancedSettingEnabled } = useEsqlAvailability();
|
||||
|
||||
const timelineESQLSavedSearch = useShallowEqualSelector((state) =>
|
||||
selectTimelineESQLSavedSearchId(state, timelineId)
|
||||
|
@ -263,15 +256,10 @@ const TabsContentComponent: React.FC<BasicTimelineTab> = ({
|
|||
|
||||
const activeTab = useShallowEqualSelector((state) => getActiveTab(state, timelineId));
|
||||
const showTimeline = useShallowEqualSelector((state) => getShowTimeline(state, timelineId));
|
||||
const shouldShowESQLTab = useMemo(() => {
|
||||
// disabling esql feature from feature flag should unequivocally hide the tab
|
||||
// irrespective of the fact that the advanced setting is enabled or
|
||||
// not or existing esql query is present or not
|
||||
if (!isTimelineEsqlEnabledByFeatureFlag) {
|
||||
return false;
|
||||
}
|
||||
return isEsqlAdvancedSettingEnabled || timelineESQLSavedSearch != null;
|
||||
}, [isEsqlAdvancedSettingEnabled, isTimelineEsqlEnabledByFeatureFlag, timelineESQLSavedSearch]);
|
||||
const shouldShowESQLTab = useMemo(
|
||||
() => isEsqlAdvancedSettingEnabled || timelineESQLSavedSearch != null,
|
||||
[isEsqlAdvancedSettingEnabled, timelineESQLSavedSearch]
|
||||
);
|
||||
|
||||
const numberOfPinnedEvents = useShallowEqualSelector((state) =>
|
||||
getNumberOfPinnedEvents(state, timelineId)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue