Skip to content

Commit

Permalink
[Security Solution][THI] - remove obsolete analyzerDatePickersAndSour…
Browse files Browse the repository at this point in the history
…cererDisabled feature flag (#205176)

## Summary

This PR removes the `analyzerDatePickersAndSourcererDisabled` 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](#176064) over 6 months ago but
the introduction of the feature precedes that.

No UI changes introduced!
  • Loading branch information
PhilippeOberti authored Jan 8, 2025
1 parent 019f0e8 commit 3fd987c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,6 @@ export const allowedExperimentalValues = Object.freeze({
*/
timelineEsqlTabDisabled: false,

/*
* Disables date pickers and sourcerer in analyzer if needed.
*
*/
analyzerDatePickersAndSourcererDisabled: false,

/**
* Enables graph visualization in alerts flyout
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
userSetPositionOfCamera,
} from '../../store/camera/action';
import type { State } from '../../../common/store/types';
import { useIsExperimentalFeatureEnabled } from '../../../common/hooks/use_experimental_features';
import { SourcererButton } from './sourcerer_selection';
import { DateSelectionButton } from './date_picker';
import { StyledGraphControls, StyledGraphControlsColumn, StyledEuiRange } from './styles';
Expand Down Expand Up @@ -61,9 +60,6 @@ export const GraphControls = React.memo(
selectors.scalingFactor(state.analyzer[id])
);
const { timestamp } = useContext(SideEffectContext);
const isDatePickerAndSourcererDisabled = useIsExperimentalFeatureEnabled(
'analyzerDatePickersAndSourcererDisabled'
);
const [activePopover, setPopover] = useState<PopoverType>(null);
const colorMap = useColors();

Expand Down Expand Up @@ -143,22 +139,18 @@ export const GraphControls = React.memo(
isOpen={activePopover === 'nodeLegend'}
setActivePopover={setActivePopover}
/>
{!isDatePickerAndSourcererDisabled ? (
<>
<SourcererButton
id={id}
closePopover={closePopover}
isOpen={activePopover === 'sourcererSelection'}
setActivePopover={setActivePopover}
/>
<DateSelectionButton
id={id}
closePopover={closePopover}
isOpen={activePopover === 'datePicker'}
setActivePopover={setActivePopover}
/>
</>
) : null}
<SourcererButton
id={id}
closePopover={closePopover}
isOpen={activePopover === 'sourcererSelection'}
setActivePopover={setActivePopover}
/>
<DateSelectionButton
id={id}
closePopover={closePopover}
isOpen={activePopover === 'datePicker'}
setActivePopover={setActivePopover}
/>
{isSplitPanel && showPanelOnClick && (
<ShowPanelButton showPanelOnClick={showPanelOnClick} />
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,19 @@
*/

import { useMemo } from 'react';
import { useSelector } from 'react-redux';
import { useLocation } from 'react-router-dom';
import { useDeepEqualSelector } from '../../common/hooks/use_selector';
import {
isLoadingSelector,
startSelector,
endSelector,
} from '../../common/components/super_date_picker/selectors';
import { useIsExperimentalFeatureEnabled } from '../../common/hooks/use_experimental_features';
import { SourcererScopeName } from '../../sourcerer/store/model';
import { useSourcererDataView } from '../../sourcerer/containers';
import { getScopeFromPath } from '../../sourcerer/containers/sourcerer_paths';
import { sourcererSelectors } from '../../common/store';

export function useTimelineDataFilters(isActiveTimelines: boolean) {
const getStartSelector = useMemo(() => startSelector(), []);
const getEndSelector = useMemo(() => endSelector(), []);
const getIsLoadingSelector = useMemo(() => isLoadingSelector(), []);
const isDatePickerAndSourcererDisabled = useIsExperimentalFeatureEnabled(
'analyzerDatePickersAndSourcererDisabled'
);

const shouldUpdate = useDeepEqualSelector((state) => {
if (isActiveTimelines) {
Expand All @@ -49,35 +41,15 @@ export function useTimelineDataFilters(isActiveTimelines: boolean) {
return getEndSelector(state.inputs.global);
}
});
const defaultDataView = useSelector(sourcererSelectors.defaultDataView);
const { pathname } = useLocation();
const { selectedPatterns: nonTimelinePatterns } = useSourcererDataView(
getScopeFromPath(pathname)
);

const { selectedPatterns: timelinePatterns } = useSourcererDataView(SourcererScopeName.timeline);

const selectedPatterns = useMemo(() => {
return isActiveTimelines
? [...new Set([...timelinePatterns, ...defaultDataView.patternList])]
: [...new Set([...nonTimelinePatterns, ...defaultDataView.patternList])];
}, [isActiveTimelines, timelinePatterns, nonTimelinePatterns, defaultDataView.patternList]);

const { selectedPatterns: analyzerPatterns } = useSourcererDataView(SourcererScopeName.analyzer);

return useMemo(() => {
return {
selectedPatterns: isDatePickerAndSourcererDisabled ? selectedPatterns : analyzerPatterns,
selectedPatterns: analyzerPatterns,
from,
to,
shouldUpdate,
};
}, [
selectedPatterns,
from,
to,
shouldUpdate,
isDatePickerAndSourcererDisabled,
analyzerPatterns,
]);
}, [from, to, shouldUpdate, analyzerPatterns]);
}

0 comments on commit 3fd987c

Please sign in to comment.