[EDR Workflows] Add technical preview badge to S1 flyout (#176581)

This commit is contained in:
Tomasz Ciecierski 2024-02-13 09:41:44 +01:00 committed by GitHub
parent b3354bcd11
commit 81529e2870
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 37 additions and 15 deletions

View file

@ -13,6 +13,9 @@ import { PanelHeader } from './header';
import { FLYOUT_HEADER_TITLE_TEST_ID } from './test_ids';
jest.mock('./context');
jest.mock('../../../common/hooks/use_experimental_features', () => ({
useIsExperimentalFeatureEnabled: jest.fn().mockReturnValue(true),
}));
const renderPanelHeader = () =>
render(

View file

@ -5,32 +5,51 @@
* 2.0.
*/
import { EuiTitle } from '@elastic/eui';
import type { FC } from 'react';
import React from 'react';
import { EuiBetaBadge, EuiFlexGroup, EuiFlexItem, EuiTitle } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { useIsExperimentalFeatureEnabled } from '../../../common/hooks/use_experimental_features';
import {
TECHNICAL_PREVIEW,
TECHNICAL_PREVIEW_DESCRIPTION,
} from '../../../timelines/components/side_panel/event_details/translations';
import { useIsolateHostPanelContext } from './context';
import { FLYOUT_HEADER_TITLE_TEST_ID } from './test_ids';
import { FlyoutHeader } from '../../shared/components/flyout_header';
import { isAlertFromSentinelOneEvent } from '../../../common/utils/sentinelone_alert_check';
/**
* Document details expandable right section header for the isolate host panel
*/
export const PanelHeader: FC = () => {
const { isolateAction } = useIsolateHostPanelContext();
const title =
isolateAction === 'isolateHost' ? (
<FormattedMessage
id="xpack.securitySolution.flyout.isolateHost.isolateTitle"
defaultMessage="Isolate host"
/>
) : (
<FormattedMessage
id="xpack.securitySolution.flyout.isolateHost.releaseTitle"
defaultMessage="Release host"
/>
);
const { isolateAction, dataFormattedForFieldBrowser: data } = useIsolateHostPanelContext();
const isSentinelOneAlert = isAlertFromSentinelOneEvent({ data });
const sentinelOneManualHostActionsEnabled = useIsExperimentalFeatureEnabled(
'sentinelOneManualHostActionsEnabled'
);
const title = (
<EuiFlexGroup responsive gutterSize="s">
<EuiFlexItem grow={false}>
{isolateAction === 'isolateHost' ? (
<FormattedMessage
id="xpack.securitySolution.flyout.isolateHost.isolateTitle"
defaultMessage="Isolate host"
/>
) : (
<FormattedMessage
id="xpack.securitySolution.flyout.isolateHost.releaseTitle"
defaultMessage="Release host"
/>
)}
</EuiFlexItem>
{sentinelOneManualHostActionsEnabled && isSentinelOneAlert && (
<EuiFlexItem grow={false}>
<EuiBetaBadge label={TECHNICAL_PREVIEW} tooltipContent={TECHNICAL_PREVIEW_DESCRIPTION} />
</EuiFlexItem>
)}
</EuiFlexGroup>
);
return (
<FlyoutHeader>