From 636c3a7bd4ff4d7d0d179e404d07094b81c6a2a0 Mon Sep 17 00:00:00 2001 From: Paul Tavares <56442535+paul-tavares@users.noreply.github.com> Date: Thu, 22 Feb 2024 12:52:59 -0500 Subject: [PATCH] [Security Solution][Endpoint] Revert Badges for SentinelOne functionality back to Tech Preview (from Beta) (#177488) ## Summary This PR reverts most of the changes done in #176228 : - Reverts changes to Connectors so that the Badge displayed for SentinelOne is again showing "Technical Preview" - Changes the badge displayed on the Host Isolation flyout and Responder for SentinelOne host to "Technical Preview" - Fixes #177337 IN addition, the following issue was also addressed: - Corrected `i18n` definition for response action log history ( Fixes #177185 ) _____________ ### Host isolation flyout image ### Responder image ### Connector image image --- .../public/common/translations.ts | 15 +++++ .../isolate_host/header.test.tsx | 5 +- .../document_details/isolate_host/header.tsx | 4 +- .../components/actions_log_filter_popover.tsx | 4 +- .../translations.tsx | 6 +- .../hooks/use_with_show_responder.tsx | 7 ++- .../endpoint/sentinelone_host/common.ts | 5 +- .../endpoint/sentinelone_host/index.ts | 5 +- .../common/experimental_features.ts | 4 -- .../public/connector_types/index.ts | 9 +-- .../sentinelone/sentinelone.ts | 10 +--- .../action_type_menu.tsx | 21 +++---- .../beta_badge_props.tsx | 10 ---- .../create_connector_flyout/header.tsx | 37 ++++-------- .../create_connector_flyout/index.test.tsx | 16 ++--- .../create_connector_flyout/index.tsx | 3 +- .../edit_connector_flyout/header.tsx | 44 +++++--------- .../edit_connector_flyout/index.test.tsx | 16 ++--- .../edit_connector_flyout/index.tsx | 5 +- .../triggers_actions_ui/public/types.ts | 59 ++++++++----------- 20 files changed, 119 insertions(+), 166 deletions(-) diff --git a/x-pack/plugins/security_solution/public/common/translations.ts b/x-pack/plugins/security_solution/public/common/translations.ts index f3f17b8eb81a5..f8b8906df9cc3 100644 --- a/x-pack/plugins/security_solution/public/common/translations.ts +++ b/x-pack/plugins/security_solution/public/common/translations.ts @@ -24,6 +24,21 @@ export const BETA_TOOLTIP = i18n.translate('xpack.securitySolution.pages.common. 'This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.', }); +export const TECHNICAL_PREVIEW = i18n.translate( + 'xpack.securitySolution.pages.common.technicalPreviewLabel', + { + defaultMessage: 'Technical Preview', + } +); + +export const TECHNICAL_PREVIEW_TOOLTIP = i18n.translate( + 'xpack.securitySolution.pages.common.technicalPreviewTooltip', + { + defaultMessage: + 'This functionality is in technical preview and may be changed or removed completely in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.', + } +); + export const UPDATE_ALERT_STATUS_FAILED = (conflicts: number) => i18n.translate('xpack.securitySolution.pages.common.updateAlertStatusFailed', { values: { conflicts }, diff --git a/x-pack/plugins/security_solution/public/flyout/document_details/isolate_host/header.test.tsx b/x-pack/plugins/security_solution/public/flyout/document_details/isolate_host/header.test.tsx index 6b147f89261e3..e5fc0916ffb7c 100644 --- a/x-pack/plugins/security_solution/public/flyout/document_details/isolate_host/header.test.tsx +++ b/x-pack/plugins/security_solution/public/flyout/document_details/isolate_host/header.test.tsx @@ -13,6 +13,7 @@ import { useIsExperimentalFeatureEnabled } from '../../../common/hooks/use_exper import { PanelHeader } from './header'; import { FLYOUT_HEADER_TITLE_TEST_ID } from './test_ids'; import { isAlertFromSentinelOneEvent } from '../../../common/utils/sentinelone_alert_check'; +import { TECHNICAL_PREVIEW } from '../../../common/translations'; jest.mock('../../../common/hooks/use_experimental_features'); jest.mock('../../../common/utils/sentinelone_alert_check'); @@ -63,7 +64,7 @@ describe('', () => { const { getByTestId } = renderPanelHeader(); expect(getByTestId(FLYOUT_HEADER_TITLE_TEST_ID)).toBeInTheDocument(); - expect(getByTestId(FLYOUT_HEADER_TITLE_TEST_ID)).toHaveTextContent('Beta'); + expect(getByTestId(FLYOUT_HEADER_TITLE_TEST_ID)).toHaveTextContent(TECHNICAL_PREVIEW); } ); @@ -79,7 +80,7 @@ describe('', () => { const { getByTestId } = renderPanelHeader(); expect(getByTestId(FLYOUT_HEADER_TITLE_TEST_ID)).toBeInTheDocument(); - expect(getByTestId(FLYOUT_HEADER_TITLE_TEST_ID)).not.toHaveTextContent('Beta'); + expect(getByTestId(FLYOUT_HEADER_TITLE_TEST_ID)).not.toHaveTextContent(TECHNICAL_PREVIEW); } ); }); diff --git a/x-pack/plugins/security_solution/public/flyout/document_details/isolate_host/header.tsx b/x-pack/plugins/security_solution/public/flyout/document_details/isolate_host/header.tsx index da1d933a01013..efe8e867966db 100644 --- a/x-pack/plugins/security_solution/public/flyout/document_details/isolate_host/header.tsx +++ b/x-pack/plugins/security_solution/public/flyout/document_details/isolate_host/header.tsx @@ -9,8 +9,8 @@ import { EuiBetaBadge, EuiFlexGroup, EuiFlexItem, EuiTitle } from '@elastic/eui' import type { FC } from 'react'; import React from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; +import { TECHNICAL_PREVIEW, TECHNICAL_PREVIEW_TOOLTIP } from '../../../common/translations'; import { useIsExperimentalFeatureEnabled } from '../../../common/hooks/use_experimental_features'; -import { BETA, BETA_TOOLTIP } from '../../../common/translations'; import { isAlertFromSentinelOneEvent } from '../../../common/utils/sentinelone_alert_check'; import { useIsolateHostPanelContext } from './context'; import { FLYOUT_HEADER_TITLE_TEST_ID } from './test_ids'; @@ -43,7 +43,7 @@ export const PanelHeader: FC = () => { {isSentinelOneV1Enabled && isSentinelOneAlert && ( - + )} diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_filter_popover.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_filter_popover.tsx index 8eb7f8e2d298d..2fdb1a201f046 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_filter_popover.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/components/actions_log_filter_popover.tsx @@ -56,8 +56,8 @@ export const ActionsLogFilterPopover = memo( > {filterName === 'types' ? isSentinelOneV1Enabled - ? FILTER_NAMES.types('s') - : FILTER_NAMES.types('') + ? FILTER_NAMES.types(2) + : FILTER_NAMES.types(1) : FILTER_NAMES[filterName]} ), diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/translations.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/translations.tsx index b11f31bbd1b72..e19f7cc19102e 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/translations.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/translations.tsx @@ -211,10 +211,10 @@ export const FILTER_NAMES = Object.freeze({ }), // TODO: change it to just a value instead of a function // when responseActionsSentinelOneV1Enabled is enabled/removed - types: (suffix: string) => + types: (countOfTypes: number) => i18n.translate('xpack.securitySolution.responseActionsList.list.filter.types', { - defaultMessage: `Type{suffix}`, - values: { suffix }, + defaultMessage: `{countOfTypes, plural, one {Type} other {Types}}`, + values: { countOfTypes }, }), // replace above with: // types: i18n.translate('xpack.securitySolution.responseActionsList.list.filter.types', { diff --git a/x-pack/plugins/security_solution/public/management/hooks/use_with_show_responder.tsx b/x-pack/plugins/security_solution/public/management/hooks/use_with_show_responder.tsx index 95ec33718f063..d2645bb7e34d9 100644 --- a/x-pack/plugins/security_solution/public/management/hooks/use_with_show_responder.tsx +++ b/x-pack/plugins/security_solution/public/management/hooks/use_with_show_responder.tsx @@ -7,7 +7,7 @@ import React, { useCallback } from 'react'; import { EuiBetaBadge, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import { BETA, BETA_TOOLTIP } from '../../common/translations'; +import { TECHNICAL_PREVIEW, TECHNICAL_PREVIEW_TOOLTIP } from '../../common/translations'; import { useLicense } from '../../common/hooks/use_license'; import type { ImmutableArray } from '../../../common/endpoint/types'; import { @@ -136,7 +136,10 @@ export const useWithShowResponder = (): ShowResponseActionsConsole => { {RESPONDER_PAGE_TITLE} - + ); diff --git a/x-pack/plugins/security_solution/scripts/endpoint/sentinelone_host/common.ts b/x-pack/plugins/security_solution/scripts/endpoint/sentinelone_host/common.ts index 168d2089d9c1e..f366bd7c17f51 100644 --- a/x-pack/plugins/security_solution/scripts/endpoint/sentinelone_host/common.ts +++ b/x-pack/plugins/security_solution/scripts/endpoint/sentinelone_host/common.ts @@ -209,7 +209,10 @@ export const installSentinelOneAgent = async ({ try { // Generate an alert in SentinelOne - await hostVm.exec('nslookup amazon.com'); + const command = 'nslookup elastic.co'; + + log?.info(`Triggering alert using command: ${command}`); + await hostVm.exec(command); } catch (e) { log?.warning(`Attempted to generate an alert on SentinelOne host failed: ${e.message}`); } diff --git a/x-pack/plugins/security_solution/scripts/endpoint/sentinelone_host/index.ts b/x-pack/plugins/security_solution/scripts/endpoint/sentinelone_host/index.ts index 3416b8d4e51b6..871d5bcf83606 100644 --- a/x-pack/plugins/security_solution/scripts/endpoint/sentinelone_host/index.ts +++ b/x-pack/plugins/security_solution/scripts/endpoint/sentinelone_host/index.ts @@ -116,6 +116,9 @@ const runCli: RunFn = async ({ log, flags }) => { s1Client, }); + log.info(`SentinelOne Agent Status: +${s1Info.status}`); + const { id: agentPolicyId, agents = 0, @@ -177,7 +180,5 @@ const runCli: RunFn = async ({ log, flags }) => { ${hostVm.info()} ${agentPolicyVm ? `${agentPolicyVm.info()}\n` : ''} ${await getMultipassVmCountNotice(2)} -SentinelOne Agent Status: -${s1Info.status} `); }; diff --git a/x-pack/plugins/stack_connectors/common/experimental_features.ts b/x-pack/plugins/stack_connectors/common/experimental_features.ts index 7bec75eaeb0a9..fee440e86b8d5 100644 --- a/x-pack/plugins/stack_connectors/common/experimental_features.ts +++ b/x-pack/plugins/stack_connectors/common/experimental_features.ts @@ -13,11 +13,7 @@ export type ExperimentalFeatures = typeof allowedExperimentalValues; */ export const allowedExperimentalValues = Object.freeze({ isMustacheAutocompleteOn: false, - // set to true to show tech preview badge on sentinel one connector sentinelOneConnectorOn: true, - // set to true to show beta badge on sentinel one connector - // TODO: set to true when 8.13 is ready - sentinelOneConnectorOnBeta: false, }); export type ExperimentalConfigKeys = Array; diff --git a/x-pack/plugins/stack_connectors/public/connector_types/index.ts b/x-pack/plugins/stack_connectors/public/connector_types/index.ts index 12991bcc4d055..a2297dac9d6bf 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/index.ts +++ b/x-pack/plugins/stack_connectors/public/connector_types/index.ts @@ -69,14 +69,7 @@ export function registerConnectorTypes({ connectorTypeRegistry.register(getTinesConnectorType()); connectorTypeRegistry.register(getD3SecurityConnectorType()); - // get sentinelOne connector type - // when either feature flag is enabled - if ( - // 8.12 - ExperimentalFeaturesService.get().sentinelOneConnectorOn || - // 8.13 - ExperimentalFeaturesService.get().sentinelOneConnectorOnBeta - ) { + if (ExperimentalFeaturesService.get().sentinelOneConnectorOn) { connectorTypeRegistry.register(getSentinelOneConnectorType()); } } diff --git a/x-pack/plugins/stack_connectors/public/connector_types/sentinelone/sentinelone.ts b/x-pack/plugins/stack_connectors/public/connector_types/sentinelone/sentinelone.ts index 0b92334e90268..b01fa9fbaed5d 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/sentinelone/sentinelone.ts +++ b/x-pack/plugins/stack_connectors/public/connector_types/sentinelone/sentinelone.ts @@ -11,16 +11,15 @@ import type { ActionTypeModel as ConnectorTypeModel, GenericValidationResult, } from '@kbn/triggers-actions-ui-plugin/public'; -import { getIsExperimentalFeatureEnabled } from '../../common/get_experimental_features'; import { SENTINELONE_CONNECTOR_ID, SENTINELONE_TITLE, SUB_ACTION, } from '../../../common/sentinelone/constants'; import type { - SentinelOneActionParams, SentinelOneConfig, SentinelOneSecrets, + SentinelOneActionParams, } from '../../../common/sentinelone/types'; interface ValidationErrors { @@ -32,16 +31,11 @@ export function getConnectorType(): ConnectorTypeModel< SentinelOneSecrets, SentinelOneActionParams > { - const isSentinelOneBetaBadgeEnabled = getIsExperimentalFeatureEnabled( - 'sentinelOneConnectorOnBeta' - ); - return { id: SENTINELONE_CONNECTOR_ID, actionTypeTitle: SENTINELONE_TITLE, iconClass: lazy(() => import('./logo')), - isBeta: isSentinelOneBetaBadgeEnabled ? true : undefined, - isExperimental: isSentinelOneBetaBadgeEnabled ? undefined : true, + isExperimental: true, selectMessage: i18n.translate( 'xpack.stackConnectors.security.sentinelone.config.selectMessageText', { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_menu.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_menu.tsx index e0ce5dcceec67..f4717bb512a0c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_menu.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/action_type_menu.tsx @@ -6,8 +6,9 @@ */ import React, { useEffect, useState } from 'react'; -import { EuiCard, EuiFlexGrid, EuiFlexItem, EuiIcon, EuiSpacer, EuiToolTip } from '@elastic/eui'; +import { EuiFlexItem, EuiCard, EuiIcon, EuiFlexGrid, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { EuiToolTip } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { ActionType, ActionTypeIndex, ActionTypeRegistryContract } from '../../../types'; import { loadActionTypes } from '../../lib/action_connector_api'; @@ -15,7 +16,7 @@ import { actionTypeCompare } from '../../lib/action_type_compare'; import { checkActionTypeEnabled } from '../../lib/check_action_type_enabled'; import { useKibana } from '../../../common/lib/kibana'; import { SectionLoading } from '../../components/section_loading'; -import { betaBadgeProps, technicalPreviewBadgeProps } from './beta_badge_props'; +import { betaBadgeProps } from './beta_badge_props'; interface Props { onActionTypeChange: (actionType: ActionType) => void; @@ -76,13 +77,12 @@ export const ActionTypeMenu = ({ })(); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); - const registeredActionTypes = Object.entries(actionTypesIndex ?? []) .filter( ([id, details]) => actionTypeRegistry.has(id) && - !actionTypeRegistry.get(id).hideInUi && - details.enabledInConfig + details.enabledInConfig === true && + !actionTypeRegistry.get(id).hideInUi ) .map(([id, actionType]) => { const actionTypeModel = actionTypeRegistry.get(id); @@ -91,7 +91,6 @@ export const ActionTypeMenu = ({ selectMessage: actionTypeModel ? actionTypeModel.selectMessage : '', actionType, name: actionType.name, - isBeta: actionTypeModel.isBeta, isExperimental: actionTypeModel.isExperimental, }; }); @@ -102,13 +101,7 @@ export const ActionTypeMenu = ({ const checkEnabledResult = checkActionTypeEnabled(item.actionType); const card = ( } @@ -124,7 +117,7 @@ export const ActionTypeMenu = ({ return ( {checkEnabledResult.isEnabled && card} - {!checkEnabledResult.isEnabled && ( + {checkEnabledResult.isEnabled === false && ( {card} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/beta_badge_props.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/beta_badge_props.tsx index 3e151eb832f1e..ddd8f4b26a032 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/beta_badge_props.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/beta_badge_props.tsx @@ -8,16 +8,6 @@ import { i18n } from '@kbn/i18n'; export const betaBadgeProps = { - label: i18n.translate('xpack.triggersActionsUI.betaBadgeLabel', { - defaultMessage: 'Beta', - }), - tooltipContent: i18n.translate('xpack.triggersActionsUI.betaBadgeDescription', { - defaultMessage: - 'This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.', - }), -}; - -export const technicalPreviewBadgeProps = { label: i18n.translate('xpack.triggersActionsUI.technicalPreviewBadgeLabel', { defaultMessage: 'Technical preview', }), diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/header.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/header.tsx index 428740e88f66e..2c12431dc12cb 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/header.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/header.tsx @@ -8,18 +8,18 @@ import React, { memo } from 'react'; import { EuiBadge, - EuiBetaBadge, + EuiTitle, EuiFlexGroup, EuiFlexItem, - EuiFlyoutHeader, EuiIcon, - EuiSpacer, EuiText, - EuiTitle, + EuiFlyoutHeader, IconType, + EuiSpacer, + EuiBetaBadge, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; -import { betaBadgeProps, technicalPreviewBadgeProps } from '../beta_badge_props'; +import { betaBadgeProps } from '../beta_badge_props'; interface Props { icon?: IconType | null; @@ -27,7 +27,6 @@ interface Props { actionTypeMessage?: string | null; compatibility?: string[] | null; isExperimental?: boolean; - isBeta?: boolean; } const FlyoutHeaderComponent: React.FC = ({ @@ -36,7 +35,6 @@ const FlyoutHeaderComponent: React.FC = ({ actionTypeMessage, compatibility, isExperimental, - isBeta, }) => { return ( @@ -63,23 +61,14 @@ const FlyoutHeaderComponent: React.FC = ({ - {actionTypeName - ? isBeta && ( - - - - ) - : isExperimental && ( - - - - )} + {actionTypeName && isExperimental && ( + + + + )} {actionTypeMessage} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.test.tsx index 8c6454f9427af..554fb9aff3c30 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.test.tsx @@ -9,9 +9,9 @@ import React, { lazy } from 'react'; import { actionTypeRegistryMock } from '../../../action_type_registry.mock'; import userEvent from '@testing-library/user-event'; -import { act, waitFor } from '@testing-library/react'; +import { waitFor, act } from '@testing-library/react'; import CreateConnectorFlyout from '.'; -import { technicalPreviewBadgeProps } from '../beta_badge_props'; +import { betaBadgeProps } from '../beta_badge_props'; import { AppMockRenderer, createAppMockRenderer } from '../../test_utils'; jest.mock('../../../lib/action_connector_api', () => ({ @@ -392,7 +392,7 @@ describe('CreateConnectorFlyout', () => { expect(getByText(`selectMessage-${actionTypeModel.id}`)).toBeInTheDocument(); }); - it('does not show tech preview badge when isExperimental is undefined', async () => { + it('does not show beta badge when isExperimental is undefined', async () => { const { queryByText } = appMockRenderer.render( { /> ); await act(() => Promise.resolve()); - expect(queryByText(technicalPreviewBadgeProps.label)).not.toBeInTheDocument(); + expect(queryByText(betaBadgeProps.label)).not.toBeInTheDocument(); }); - it('does not show tech preview badge when isExperimental is false', async () => { + it('does not show beta badge when isExperimental is false', async () => { actionTypeRegistry.get.mockReturnValue({ ...actionTypeModel, isExperimental: false }); const { queryByText } = appMockRenderer.render( { /> ); await act(() => Promise.resolve()); - expect(queryByText(technicalPreviewBadgeProps.label)).not.toBeInTheDocument(); + expect(queryByText(betaBadgeProps.label)).not.toBeInTheDocument(); }); - it('shows tech preview badge when isExperimental is true', async () => { + it('shows beta badge when isExperimental is true', async () => { actionTypeRegistry.get.mockReturnValue({ ...actionTypeModel, isExperimental: true }); const { getByText } = appMockRenderer.render( { /> ); await act(() => Promise.resolve()); - expect(getByText(technicalPreviewBadgeProps.label)).toBeInTheDocument(); + expect(getByText(betaBadgeProps.label)).toBeInTheDocument(); }); }); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.tsx index c0c6941e68410..5cf6f6f8de69b 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/create_connector_flyout/index.tsx @@ -21,8 +21,8 @@ import { FormattedMessage } from '@kbn/i18n-react'; import { ActionConnector, ActionType, - ActionTypeIndex, ActionTypeModel, + ActionTypeIndex, ActionTypeRegistryContract, } from '../../../../types'; import { hasSaveActionsCapability } from '../../../lib/capabilities'; @@ -211,7 +211,6 @@ const CreateConnectorFlyoutComponent: React.FC = ({ actionTypeMessage={actionTypeModel?.selectMessage} compatibility={getConnectorCompatibility(actionType?.supportedFeatureIds)} isExperimental={actionTypeModel?.isExperimental} - isBeta={actionTypeModel?.isBeta} /> : null} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/header.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/header.tsx index ac2834c6e8f49..29e0df04a24bb 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/header.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/header.tsx @@ -8,27 +8,26 @@ import React, { memo, useCallback } from 'react'; import { css } from '@emotion/react'; import { - EuiBetaBadge, + EuiTitle, EuiFlexGroup, EuiFlexItem, - EuiFlyoutHeader, EuiIcon, - EuiTab, - EuiTabs, EuiText, - EuiTitle, + EuiFlyoutHeader, IconType, + EuiBetaBadge, + EuiTab, + EuiTabs, useEuiTheme, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; -import { betaBadgeProps, technicalPreviewBadgeProps } from '../beta_badge_props'; +import { betaBadgeProps } from '../beta_badge_props'; import { EditConnectorTabs } from '../../../../types'; import { useKibana } from '../../../../common/lib/kibana'; import { hasExecuteActionsCapability } from '../../../lib/capabilities'; const FlyoutHeaderComponent: React.FC<{ - isBeta?: boolean; isExperimental?: boolean; isPreconfigured: boolean; connectorName: string; @@ -39,7 +38,6 @@ const FlyoutHeaderComponent: React.FC<{ icon?: IconType | null; }> = ({ icon, - isBeta = false, isExperimental = false, isPreconfigured, connectorName, @@ -103,18 +101,11 @@ const FlyoutHeaderComponent: React.FC<{ /> - {isBeta ? ( + {isExperimental && ( - ) : ( - isExperimental && ( - - ) )} @@ -138,20 +129,13 @@ const FlyoutHeaderComponent: React.FC<{ - {isBeta ? ( - - ) : ( - isExperimental && ( - - - - ) + {isExperimental && ( + + + )} )} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/index.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/index.test.tsx index 3bdeb84e4bc19..d7aa6fbe0a39d 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/index.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/index.test.tsx @@ -9,10 +9,10 @@ import React, { lazy } from 'react'; import { actionTypeRegistryMock } from '../../../action_type_registry.mock'; import userEvent from '@testing-library/user-event'; -import { act, waitFor } from '@testing-library/react'; +import { waitFor, act } from '@testing-library/react'; import EditConnectorFlyout from '.'; import { ActionConnector, EditConnectorTabs, GenericValidationResult } from '../../../../types'; -import { betaBadgeProps, technicalPreviewBadgeProps } from '../beta_badge_props'; +import { betaBadgeProps } from '../beta_badge_props'; import { AppMockRenderer, createAppMockRenderer } from '../../test_utils'; const updateConnectorResponse = { @@ -321,7 +321,7 @@ describe('EditConnectorFlyout', () => { /> ); await act(() => Promise.resolve()); - expect(queryByText(technicalPreviewBadgeProps.label)).not.toBeInTheDocument(); + expect(queryByText(betaBadgeProps.label)).not.toBeInTheDocument(); }); it('shows `tech preview` badge when isExperimental is true', async () => { @@ -335,11 +335,11 @@ describe('EditConnectorFlyout', () => { /> ); await act(() => Promise.resolve()); - expect(getByText(technicalPreviewBadgeProps.label)).toBeInTheDocument(); + expect(getByText(betaBadgeProps.label)).toBeInTheDocument(); }); - it('does not show `beta` badge when `isBeta` is `false`', async () => { - actionTypeRegistry.get.mockReturnValue({ ...actionTypeModel, isBeta: false }); + it('does not show `Technical Preview` badge when `isExperimental` is `false`', async () => { + actionTypeRegistry.get.mockReturnValue({ ...actionTypeModel, isExperimental: false }); const { queryByText } = appMockRenderer.render( { expect(queryByText(betaBadgeProps.label)).not.toBeInTheDocument(); }); - it('shows `beta` badge when `isBeta` is `true`', async () => { - actionTypeRegistry.get.mockReturnValue({ ...actionTypeModel, isBeta: true }); + it('shows `Technical Preview` badge when `isExperimental` is `true`', async () => { + actionTypeRegistry.get.mockReturnValue({ ...actionTypeModel, isExperimental: true }); const { getByText } = appMockRenderer.render( = ({ setTab={handleSetTab} selectedTab={selectedTab} icon={actionTypeModel?.iconClass} - isBeta={actionTypeModel?.isBeta} isExperimental={actionTypeModel?.isExperimental} /> diff --git a/x-pack/plugins/triggers_actions_ui/public/types.ts b/x-pack/plugins/triggers_actions_ui/public/types.ts index 26f3aae4bc424..62cf353557f5c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/types.ts +++ b/x-pack/plugins/triggers_actions_ui/public/types.ts @@ -7,55 +7,54 @@ import type { Moment } from 'moment'; import type { ComponentType, ReactNode, RefObject } from 'react'; -import React from 'react'; import type { PublicMethodsOf } from '@kbn/utility-types'; import type { DocLinksStart } from '@kbn/core/public'; -import { HttpSetup } from '@kbn/core/public'; import type { ChartsPluginSetup } from '@kbn/charts-plugin/public'; import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import type { + IconType, + RecursivePartial, EuiDataGridCellValueElementProps, - EuiDataGridColumnCellAction, - EuiDataGridOnColumnResizeHandler, + EuiDataGridToolBarAdditionalControlsOptions, EuiDataGridProps, EuiDataGridRefProps, - EuiDataGridToolBarAdditionalControlsOptions, + EuiDataGridColumnCellAction, EuiDataGridToolBarVisibilityOptions, EuiSuperSelectOption, - IconType, - RecursivePartial, + EuiDataGridOnColumnResizeHandler, } from '@elastic/eui'; -import { EuiDataGridColumn, EuiDataGridControlColumn, EuiDataGridSorting } from '@elastic/eui'; import type { RuleCreationValidConsumer, ValidFeatureId } from '@kbn/rule-data-utils'; +import { EuiDataGridColumn, EuiDataGridControlColumn, EuiDataGridSorting } from '@elastic/eui'; +import { HttpSetup } from '@kbn/core/public'; import { KueryNode } from '@kbn/es-query'; import { ActionType, + AlertHistoryEsIndexConnectorId, + AlertHistoryDocumentTemplate, ALERT_HISTORY_PREFIX, AlertHistoryDefaultIndexName, - AlertHistoryDocumentTemplate, - AlertHistoryEsIndexConnectorId, AsApiContract, } from '@kbn/actions-plugin/common'; import { ActionGroup, - ActionVariable, - AlertingFrameworkHealth, - AlertStatus, + RuleActionParam, + SanitizedRule as AlertingSanitizedRule, + ResolvedSanitizedRule, + RuleAction, + RuleTaskState, AlertSummary as RuleSummary, ExecutionDuration, - MaintenanceWindow, + AlertStatus, RawAlertInstance, - ResolvedSanitizedRule, - RuleAction, - RuleActionParam, - RuleLastRun, + AlertingFrameworkHealth, RuleNotifyWhenType, - RuleTaskState, - RuleTypeMetaData, RuleTypeParams, - SanitizedRule as AlertingSanitizedRule, + RuleTypeMetaData, + ActionVariable, + RuleLastRun, + MaintenanceWindow, } from '@kbn/alerting-plugin/common'; import type { BulkOperationError } from '@kbn/alerting-plugin/server'; import { RuleRegistrySearchRequestPagination } from '@kbn/rule-registry-plugin/common'; @@ -64,6 +63,7 @@ import { QueryDslQueryContainer, SortCombinations, } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import React from 'react'; import { ActionsPublicPluginSetup } from '@kbn/actions-plugin/public'; import type { RuleType, RuleTypeIndex } from '@kbn/triggers-actions-ui-types'; import { TypeRegistry } from './application/type_registry'; @@ -72,23 +72,23 @@ import type { RuleTagFilterProps } from './application/sections/rules_list/compo import type { RuleStatusFilterProps } from './application/sections/rules_list/components/rule_status_filter'; import type { RulesListProps } from './application/sections/rules_list/components/rules_list'; import type { - RuleTagBadgeOptions, RuleTagBadgeProps, + RuleTagBadgeOptions, } from './application/sections/rules_list/components/rule_tag_badge'; import type { - RuleEventLogListOptions, RuleEventLogListProps, + RuleEventLogListOptions, } from './application/sections/rule_details/components/rule_event_log_list'; import type { GlobalRuleEventLogListProps } from './application/sections/rule_details/components/global_rule_event_log_list'; import type { AlertSummaryTimeRange } from './application/sections/alert_summary_widget/types'; import type { CreateConnectorFlyoutProps } from './application/sections/action_connector_form/create_connector_flyout'; import type { EditConnectorFlyoutProps } from './application/sections/action_connector_form/edit_connector_flyout'; import type { - BrowserFieldItem, - CreateFieldComponent, FieldBrowserOptions, - FieldBrowserProps, + CreateFieldComponent, GetFieldTableColumns, + FieldBrowserProps, + BrowserFieldItem, } from './application/sections/field_browser/types'; import { RulesListVisibleColumns } from './application/sections/rules_list/components/rules_list_column_selector'; import { TimelineItem } from './application/sections/alerts_table/bulk_actions/components/toolbar'; @@ -173,13 +173,11 @@ export interface ConnectorValidationError { } export type ConnectorValidationFunc = () => Promise; - export interface ActionConnectorFieldsProps { readOnly: boolean; isEdit: boolean; registerPreSubmitValidator: (validator: ConnectorValidationFunc) => void; } - export interface ActionReadOnlyElementProps { connectorId: string; connectorName: string; @@ -211,12 +209,10 @@ interface BulkOperationAttributesByIds { ids: string[]; filter?: never; } - interface BulkOperationAttributesByFilter { ids?: never; filter: KueryNode | null; } - export type BulkOperationAttributesWithoutHttp = | BulkOperationAttributesByIds | BulkOperationAttributesByFilter; @@ -286,7 +282,6 @@ export interface ActionTypeModel; defaultRecoveredActionParams?: RecursivePartial; customConnectorSelectItem?: CustomConnectorSelectionItem; - isBeta?: boolean; isExperimental?: boolean; subtype?: Array<{ id: string; name: string }>; convertParamsBetweenGroups?: (params: ActionParams) => ActionParams | {}; @@ -479,7 +474,6 @@ export interface RuleAddProps< useRuleProducer?: boolean; initialSelectedConsumer?: RuleCreationValidConsumer | null; } - export interface RuleDefinitionProps { rule: Rule; ruleTypeRegistry: RuleTypeRegistryContract; @@ -514,7 +508,6 @@ export interface InspectQuery { request: string[]; response: string[]; } - export type GetInspectQuery = () => InspectQuery; export type Alert = EcsFieldsResponse;