diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/components/choose_connector_selectable.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/components/choose_connector.tsx similarity index 54% rename from x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/components/choose_connector_selectable.tsx rename to x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/components/choose_connector.tsx index 7019fcbb71e3..21fa8e3f89f6 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/components/choose_connector_selectable.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/components/choose_connector.tsx @@ -7,6 +7,7 @@ import React, { useEffect, useMemo, useState } from 'react'; +import { css } from '@emotion/react'; import { useActions, useValues } from 'kea'; import { @@ -18,11 +19,18 @@ import { EuiFlexGroup, EuiText, useEuiTheme, + EuiTextTruncate, + EuiBadgeGroup, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import connectorLogo from '../../../../../../assets/images/connector.svg'; +import { + BETA_LABEL, + TECH_PREVIEW_LABEL, + CONNECTOR_CLIENT_LABEL, +} from '../../../../../shared/constants'; import { KibanaLogic } from '../../../../../shared/kibana'; import { NewConnectorLogic } from '../../../new_index/method_connector/new_connector_logic'; import { SelfManagePreference } from '../create_connector'; @@ -34,9 +42,7 @@ interface OptionData { secondaryContent?: string; } -export const ChooseConnectorSelectable: React.FC = ({ - selfManaged, -}) => { +export const ChooseConnector: React.FC = ({ selfManaged }) => { const { euiTheme } = useEuiTheme(); const [selectedOption, setSelectedOption] = useState>>( [] @@ -52,20 +58,26 @@ export const ChooseConnectorSelectable: React.FC }; return ( - - {_prepend} - - - {label} - - - - {_append} + {_prepend} + + + + + + + {_append} + ); }; @@ -83,43 +95,39 @@ export const ChooseConnectorSelectable: React.FC const getInitialOptions = () => { return allConnectors.map((connector, key) => { const _append: JSX.Element[] = []; + let _ariaLabelAppend = ''; if (connector.isTechPreview) { _append.push( - - {i18n.translate( - 'xpack.enterpriseSearch.createConnector.chooseConnectorSelectable.thechPreviewBadgeLabel', - { defaultMessage: 'Tech preview' } - )} + + {TECH_PREVIEW_LABEL} ); + _ariaLabelAppend += `, ${TECH_PREVIEW_LABEL}`; } if (connector.isBeta) { _append.push( - - {i18n.translate( - 'xpack.enterpriseSearch.createConnector.chooseConnectorSelectable.BetaBadgeLabel', - { - defaultMessage: 'Beta', - } - )} + + {BETA_LABEL} ); + _ariaLabelAppend += `, ${BETA_LABEL}`; } if (selfManaged === 'native' && !connector.isNative) { _append.push( - {i18n.translate( - 'xpack.enterpriseSearch.createConnector.chooseConnectorSelectable.OnlySelfManagedBadgeLabel', - { - defaultMessage: 'Self managed', - } - )} + {CONNECTOR_CLIENT_LABEL} ); } return { _append, _prepend: , + 'aria-label': connector.name + _ariaLabelAppend, key: key.toString(), label: connector.name, }; @@ -133,33 +141,31 @@ export const ChooseConnectorSelectable: React.FC }, [selfManaged]); return ( - - } - singleSelection - fullWidth - placeholder={i18n.translate( - 'xpack.enterpriseSearch.createConnector.chooseConnectorSelectable.placeholder.text', - { defaultMessage: 'Choose a data source' } - )} - options={selectableOptions} - selectedOptions={selectedOption} - onChange={(selectedItem) => { - setSelectedOption(selectedItem); - if (selectedItem.length === 0) { - setSelectedConnector(null); - return; - } - const keySelected = Number(selectedItem[0].key); - setSelectedConnector(allConnectors[keySelected]); - }} - renderOption={renderOption} - rowHeight={(euiTheme.base / 2) * 5} - /> - + } + singleSelection + fullWidth + placeholder={i18n.translate( + 'xpack.enterpriseSearch.createConnector.chooseConnectorSelectable.placeholder.text', + { defaultMessage: 'Choose a data source' } + )} + options={selectableOptions} + selectedOptions={selectedOption} + onChange={(selectedItem) => { + setSelectedOption(selectedItem); + if (selectedItem.length === 0) { + setSelectedConnector(null); + return; + } + const keySelected = Number(selectedItem[0].key); + setSelectedConnector(allConnectors[keySelected]); + }} + renderOption={renderOption} + rowHeight={(euiTheme.base / 2) * 5} + /> ); }; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/start_step.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/start_step.tsx index 7e23474b207f..46840d577e4d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/start_step.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/connectors/create_connector/start_step.tsx @@ -20,6 +20,7 @@ import { EuiRadio, EuiSpacer, EuiText, + useIsWithinBreakpoints, EuiTitle, useGeneratedHtmlId, } from '@elastic/eui'; @@ -33,7 +34,7 @@ import { GeneratedConfigFields } from '../../connector_detail/components/generat import { ConnectorViewLogic } from '../../connector_detail/connector_view_logic'; import { NewConnectorLogic } from '../../new_index/method_connector/new_connector_logic'; -import { ChooseConnectorSelectable } from './components/choose_connector_selectable'; +import { ChooseConnector } from './components/choose_connector'; import { ConnectorDescriptionPopover } from './components/connector_description_popover'; import { ManualConfiguration } from './components/manual_configuration'; import { SelfManagePreference } from './create_connector'; @@ -53,6 +54,7 @@ export const StartStep: React.FC = ({ onSelfManagePreferenceChange, error, }) => { + const isMediumDevice = useIsWithinBreakpoints(['xs', 's', 'm', 'l']); const elasticManagedRadioButtonId = useGeneratedHtmlId({ prefix: 'elasticManagedRadioButton' }); const selfManagedRadioButtonId = useGeneratedHtmlId({ prefix: 'selfManagedRadioButton' }); @@ -93,8 +95,8 @@ export const StartStep: React.FC = ({

{title}

- - + + = ({ { defaultMessage: 'Connector' } )} > - + - +