Skip to content

Commit

Permalink
[Security Solution] - remove tGridEnabled feature flag (elastic#184478)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeOberti committed May 30, 2024
1 parent 975eeed commit cb9b7d2
Show file tree
Hide file tree
Showing 12 changed files with 8 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ export type ExperimentalFeatures = { [K in keyof typeof allowedExperimentalValue
* This object is then used to validate and parse the value entered.
*/
export const allowedExperimentalValues = Object.freeze({
tGridEnabled: true,

// FIXME:PT delete?
excludePoliciesInFilterEnabled: false,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ import { getDefaultControlColumn } from '../../../timelines/components/timeline/
import { defaultRowRenderers } from '../../../timelines/components/timeline/body/renderers';
import { DefaultCellRenderer } from '../../../timelines/components/timeline/cell_rendering/default_cell_renderer';
import { SourcererScopeName } from '../../store/sourcerer/model';
import { useIsExperimentalFeatureEnabled } from '../../hooks/use_experimental_features';
import { DEFAULT_COLUMN_MIN_WIDTH } from '../../../timelines/components/timeline/body/constants';
import type { GlobalTimeArgs } from '../../containers/use_global_time';
import type { QueryTabBodyProps as UserQueryTabBodyProps } from '../../../explore/users/pages/navigation/types';
import type { QueryTabBodyProps as HostQueryTabBodyProps } from '../../../explore/hosts/pages/navigation/types';
Expand Down Expand Up @@ -74,7 +72,6 @@ const EventsQueryTabBodyComponent: React.FC<EventsQueryTabBodyComponentProps> =
}) => {
const dispatch = useDispatch();
const { globalFullScreen } = useGlobalFullScreen();
const tGridEnabled = useIsExperimentalFeatureEnabled('tGridEnabled');
const [defaultNumberFormat] = useUiSetting$<string>(DEFAULT_NUMBER_FORMAT);
const isEnterprisePlus = useLicense().isEnterprise();
const ACTION_BUTTON_COUNT = isEnterprisePlus ? 5 : 4;
Expand All @@ -101,20 +98,13 @@ const EventsQueryTabBodyComponent: React.FC<EventsQueryTabBodyComponentProps> =
dispatch(
dataTableActions.initializeDataTableSettings({
id: tableId,
defaultColumns: eventsDefaultModel.columns.map((c) =>
!tGridEnabled && c.initialWidth == null
? {
...c,
initialWidth: DEFAULT_COLUMN_MIN_WIDTH,
}
: c
),
defaultColumns: eventsDefaultModel.columns,
title: i18n.EVENTS_GRAPH_TITLE,
showCheckboxes: true,
selectAll: true,
})
);
}, [dispatch, showExternalAlerts, tGridEnabled, tableId]);
}, [dispatch, showExternalAlerts, tableId]);

useEffect(() => {
return () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,37 +127,6 @@ describe('Actions', () => {
(useShallowEqualSelector as jest.Mock).mockReturnValue(mockTimelineModel);
});

test('it renders a checkbox for selecting the event when `showCheckboxes` is `true`', () => {
const wrapper = mount(
<TestProviders>
<Actions {...defaultProps} />
</TestProviders>
);

expect(wrapper.find('[data-test-subj="select-event"]').exists()).toEqual(true);
});

test('it does NOT render a checkbox for selecting the event when `showCheckboxes` is `false`', () => {
const wrapper = mount(
<TestProviders>
<Actions {...defaultProps} showCheckboxes={false} />
</TestProviders>
);

expect(wrapper.find('[data-test-subj="select-event"]').exists()).toBe(false);
});

test('it does NOT render a checkbox for selecting the event when `tGridEnabled` is `true`', () => {
(useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true);
const wrapper = mount(
<TestProviders>
<Actions {...defaultProps} />
</TestProviders>
);

expect(wrapper.find('[data-test-subj="select-event"]').exists()).toBe(false);
});

describe('Guided Onboarding Step', () => {
const incrementStepMock = jest.fn();
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import React, { useCallback, useMemo } from 'react';
import { useDispatch } from 'react-redux';
import { EuiButtonIcon, EuiCheckbox, EuiLoadingSpinner, EuiToolTip } from '@elastic/eui';
import { EuiButtonIcon, EuiToolTip } from '@elastic/eui';
import styled from 'styled-components';

import { TimelineTabs, TableId } from '@kbn/securitysolution-data-table';
Expand Down Expand Up @@ -48,26 +48,20 @@ const ActionsContainer = styled.div`

const ActionsComponent: React.FC<ActionProps> = ({
ariaRowindex,
checked,
columnValues,
ecsData,
eventId,
eventIdToNoteIds,
isEventPinned = false,
isEventViewer = false,
loadingEventIds,
onEventDetailsPanelOpened,
onRowSelected,
onRuleChange,
showCheckboxes,
showNotes,
timelineId,
toggleShowNotes,
refetch,
setEventsLoading,
}) => {
const dispatch = useDispatch();
const tGridEnabled = useIsExperimentalFeatureEnabled('tGridEnabled');
const unifiedComponentsInTimelineEnabled = useIsExperimentalFeatureEnabled(
'unifiedComponentsInTimelineEnabled'
);
Expand All @@ -91,15 +85,6 @@ const ActionsComponent: React.FC<ActionProps> = ({
[dispatch, timelineId]
);

const handleSelectEvent = useCallback(
(event: React.ChangeEvent<HTMLInputElement>) =>
onRowSelected({
eventIds: [eventId],
isSelected: event.currentTarget.checked,
}),
[eventId, onRowSelected]
);

const handlePinClicked = useCallback(
() =>
getPinOnClick({
Expand Down Expand Up @@ -234,23 +219,6 @@ const ActionsComponent: React.FC<ActionProps> = ({

return (
<ActionsContainer>
{showCheckboxes && !tGridEnabled && (
<div key="select-event-container" data-test-subj="select-event-container">
<EventsTdContent textAlign="center" width={DEFAULT_ACTION_BUTTON_WIDTH}>
{loadingEventIds.includes(eventId) ? (
<EuiLoadingSpinner size="m" data-test-subj="event-loader" />
) : (
<EuiCheckbox
aria-label={i18n.CHECKBOX_FOR_ROW({ ariaRowindex, columnValues, checked })}
data-test-subj="select-event"
id={eventId}
checked={checked}
onChange={handleSelectEvent}
/>
)}
</EventsTdContent>
</div>
)}
<>
{showExpandEvent && (
<GuidedOnboardingTourStep
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,6 @@ export const ACTION_INVESTIGATE_IN_RESOLVER = i18n.translate(
}
);

export const CHECKBOX_FOR_ROW = ({
ariaRowindex,
columnValues,
checked,
}: {
ariaRowindex: number;
columnValues: string;
checked: boolean;
}) =>
i18n.translate('xpack.securitySolution.hoverActions.checkboxForRowAriaLabel', {
values: { ariaRowindex, checked, columnValues },
defaultMessage:
'{checked, select, false {unchecked} true {checked}} checkbox for the alert or event in row {ariaRowindex}, with columns {columnValues}',
});

export const ACTION_INVESTIGATE_IN_RESOLVER_FOR_ROW = ({
ariaRowindex,
columnValues,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import { SourcererScopeName } from '../../store/sourcerer/model';
import { getDefaultControlColumn } from '../../../timelines/components/timeline/body/control_columns';
import { useLicense } from '../../hooks/use_license';
import { eventsDefaultModel } from '../events_viewer/default_model';
import { useIsExperimentalFeatureEnabled } from '../../hooks/use_experimental_features';
import { DEFAULT_COLUMN_MIN_WIDTH } from '../../../timelines/components/timeline/body/constants';
import type { BulkActionsProp } from '../toolbar/bulk_actions/types';
import { SecurityCellActionsTrigger } from '../cell_actions';

Expand Down Expand Up @@ -85,7 +83,6 @@ const SessionsViewComponent: React.FC<SessionsComponentsProps> = ({
defaultColumns = sessionsHeaders,
}) => {
const dispatch = useDispatch();
const tGridEnabled = useIsExperimentalFeatureEnabled('tGridEnabled');
const parsedFilterQuery: ESBoolQuery = useMemo(() => {
if (filterQuery && filterQuery !== '') {
return JSON.parse(filterQuery);
Expand Down Expand Up @@ -115,19 +112,12 @@ const SessionsViewComponent: React.FC<SessionsComponentsProps> = ({
dataTableActions.initializeDataTableSettings({
id: tableId,
title: i18n.SESSIONS_TITLE,
defaultColumns: eventsDefaultModel.columns.map((c) =>
!tGridEnabled && c.initialWidth == null
? {
...c,
initialWidth: DEFAULT_COLUMN_MIN_WIDTH,
}
: c
),
defaultColumns: eventsDefaultModel.columns,
showCheckboxes: true,
selectAll: true,
})
);
}, [dispatch, tGridEnabled, tableId]);
}, [dispatch, tableId]);

const isEnterprisePlus = useLicense().isEnterprise();
const ACTION_BUTTON_COUNT =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ jest.mock('../../../common/hooks/use_license', () => ({
useLicense: jest.fn().mockReturnValue({ isPlatinumPlus: () => true, isEnterprise: () => false }),
}));

jest.mock('../../../common/hooks/use_experimental_features', () => ({
useIsExperimentalFeatureEnabled: jest.fn().mockReturnValue(true),
}));

jest.mock('../../../common/utils/endpoint_alert_check', () => {
const realEndpointAlertCheckUtils = jest.requireActual(
'../../../common/utils/endpoint_alert_check'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import { useHostIsolationAction } from '../host_isolation/use_host_isolation_act
import { getFieldValue } from '../host_isolation/helpers';
import type { Status } from '../../../../common/api/detection_engine';
import { isAlertFromEndpointAlert } from '../../../common/utils/endpoint_alert_check';
import { useIsExperimentalFeatureEnabled } from '../../../common/hooks/use_experimental_features';
import { useUserPrivileges } from '../../../common/components/user_privileges';
import { useAddToCaseActions } from '../alerts_table/timeline_actions/use_add_to_case_actions';
import { useKibana } from '../../../common/lib/kibana';
Expand Down Expand Up @@ -76,7 +75,6 @@ export const TakeActionDropdown = React.memo(
onOsqueryClick,
scopeId,
}: TakeActionDropdownProps) => {
const tGridEnabled = useIsExperimentalFeatureEnabled('tGridEnabled');
const { loading: endpointPrivilegesLoading, canWriteEventFilters } =
useUserPrivileges().endpointPrivileges;

Expand Down Expand Up @@ -267,15 +265,14 @@ export const TakeActionDropdown = React.memo(

const items: AlertTableContextMenuItem[] = useMemo(
() => [
...(tGridEnabled ? addToCaseActionItems : []),
...addToCaseActionItems,
...alertsActionItems,
...hostIsolationActionItems,
...endpointResponseActionsConsoleItems,
...(osqueryAvailable ? [osqueryActionItem] : []),
...investigateInTimelineActionItems,
],
[
tGridEnabled,
addToCaseActionItems,
alertsActionItems,
hostIsolationActionItems,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import type { TimelineModel } from '../../../../store/model';
import type { ActionProps } from '../../../../../../common/types';

const noOp = () => {};
const emptyLoadingEventIds: string[] = [];
export interface UnifiedActionProps extends ActionProps {
onToggleShowNotes: (eventId?: string) => void;
events: TimelineItem[];
Expand All @@ -31,24 +30,20 @@ export const ControlColumnCellRender = memo(function RowCellRender(props: Unifie
return (
<Actions
{...props}
ecsData={ecsData ?? event.ecs}
ariaRowindex={rowIndex}
rowIndex={rowIndex}
checked={false}
columnValues="columnValues"
ecsData={ecsData ?? event.ecs}
eventId={event?._id}
eventIdToNoteIds={eventIdToNoteIds}
isEventPinned={isPinned}
isEventViewer={false}
loadingEventIds={emptyLoadingEventIds}
onEventDetailsPanelOpened={noOp}
onRowSelected={noOp}
onRuleChange={noOp}
showCheckboxes={false}
showNotes={true}
timelineId={TimelineId.active}
toggleShowNotes={onToggleShowNotes}
refetch={noOp}
rowIndex={rowIndex}
/>
);
});
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -36699,7 +36699,6 @@
"xpack.securitySolution.hostsTable.osLastSeenToolTip": "Dernier système d'exploitation observé",
"xpack.securitySolution.hostsTable.osTitle": "Système d'exploitation",
"xpack.securitySolution.hostsTable.versionTitle": "Version",
"xpack.securitySolution.hoverActions.checkboxForRowAriaLabel": "Case {checked, select, false {non cochée} true {cochée}} pour l'alerte ou l'événement de la ligne {ariaRowindex}, avec les colonnes {columnValues}",
"xpack.securitySolution.hoverActions.investigateInResolverTooltip": "Analyser l'événement",
"xpack.securitySolution.hoverActions.pinEventForRowAriaLabel": "{isEventPinned, select, false {Épingler} true {Désépingler}} l'événement de la ligne {ariaRowindex} {isEventPinned, select, false{dans} true {de}} la chronologie, avec les colonnes {columnValues}",
"xpack.securitySolution.hoverActions.viewDetailsAriaLabel": "Afficher les détails",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -36668,7 +36668,6 @@
"xpack.securitySolution.hostsTable.osLastSeenToolTip": "前回観察されたオペレーティングシステム",
"xpack.securitySolution.hostsTable.osTitle": "オペレーティングシステム",
"xpack.securitySolution.hostsTable.versionTitle": "バージョン",
"xpack.securitySolution.hoverActions.checkboxForRowAriaLabel": "行 {ariaRowindex}、列 {columnValues} のアラートまたはイベントのチェックボックスを{checked, select, false {オフ} true {オン}}",
"xpack.securitySolution.hoverActions.investigateInResolverTooltip": "イベントを分析します",
"xpack.securitySolution.hoverActions.pinEventForRowAriaLabel": "行 {ariaRowindex}、列 {columnValues} のイベントを{isEventPinned, select, false {固定} true {固定解除}}",
"xpack.securitySolution.hoverActions.viewDetailsAriaLabel": "詳細を表示",
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -36712,7 +36712,6 @@
"xpack.securitySolution.hostsTable.osLastSeenToolTip": "上次观察的操作系统",
"xpack.securitySolution.hostsTable.osTitle": "操作系统",
"xpack.securitySolution.hostsTable.versionTitle": "版本",
"xpack.securitySolution.hoverActions.checkboxForRowAriaLabel": "告警或事件第 {ariaRowindex} 行的{checked, select, false {已取消选中} true {已选中}}复选框,其中列为 {columnValues}",
"xpack.securitySolution.hoverActions.investigateInResolverTooltip": "分析事件",
"xpack.securitySolution.hoverActions.pinEventForRowAriaLabel": "将第 {ariaRowindex} 行的事件{isEventPinned, select, false {固定} true {取消固定}}到时间线,其中列为 {columnValues}",
"xpack.securitySolution.hoverActions.viewDetailsAriaLabel": "查看详情",
Expand Down

0 comments on commit cb9b7d2

Please sign in to comment.