From 8532b996c4924ae10723d42b37a02d7f92422cdc Mon Sep 17 00:00:00 2001 From: Sander Philipse <94373878+sphilipse@users.noreply.github.com> Date: Mon, 21 Aug 2023 10:37:59 +0200 Subject: [PATCH] [Search] Disable crawler on overview without ent-search (#164227) ## Summary This disables the crawler if Enterprise Search is not available on the new overview page. --- .../product_selector/ingestion_selector.tsx | 120 ++++++++++-------- 1 file changed, 67 insertions(+), 53 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_overview/components/product_selector/ingestion_selector.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_overview/components/product_selector/ingestion_selector.tsx index 8758506edd9b6..abb569361e7c3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_overview/components/product_selector/ingestion_selector.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_overview/components/product_selector/ingestion_selector.tsx @@ -9,6 +9,8 @@ import React from 'react'; import { generatePath } from 'react-router-dom'; +import { useValues } from 'kea'; + import { EuiButton, EuiCard, EuiFlexGroup, EuiFlexItem, EuiIcon } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; @@ -27,13 +29,18 @@ import { NEW_INDEX_METHOD_PATH, NEW_INDEX_SELECT_CONNECTOR_PATH, } from '../../../enterprise_search_content/routes'; -import { EuiLinkTo } from '../../../shared/react_router_helpers'; +import { HttpLogic } from '../../../shared/http/http_logic'; +import { KibanaLogic } from '../../../shared/kibana'; +import { EuiButtonTo, EuiLinkTo } from '../../../shared/react_router_helpers'; const START_LABEL = i18n.translate('xpack.enterpriseSearch.ingestSelector.startButton', { defaultMessage: 'Start', }); export const IngestionSelector: React.FC = () => { + const { config, productFeatures } = useValues(KibanaLogic); + const { errorConnectingMessage } = useValues(HttpLogic); + const crawlerDisabled = Boolean(errorConnectingMessage || !config.host); return ( @@ -61,60 +68,67 @@ export const IngestionSelector: React.FC = () => { } /> - - } - textAlign="left" - title={i18n.translate('xpack.enterpriseSearch.ingestSelector.method.connectors', { - defaultMessage: 'Connectors', - })} - description={i18n.translate( - 'xpack.enterpriseSearch.ingestSelector.method.connectors.description', - { - defaultMessage: - 'Extract, transform, index and sync data from a third-party data source.', + {productFeatures.hasConnectors && ( + + } + textAlign="left" + title={i18n.translate('xpack.enterpriseSearch.ingestSelector.method.connectors', { + defaultMessage: 'Connectors', + })} + description={i18n.translate( + 'xpack.enterpriseSearch.ingestSelector.method.connectors.description', + { + defaultMessage: + 'Extract, transform, index and sync data from a third-party data source.', + } + )} + footer={ + + {START_LABEL} + } - )} - footer={ - - {START_LABEL} - - } - /> - - - } - textAlign="left" - title={i18n.translate('xpack.enterpriseSearch.ingestSelector.method.crawler', { - defaultMessage: 'Web Crawler', - })} - description={i18n.translate( - 'xpack.enterpriseSearch.ingestSelector.method.crawler.description', - { - defaultMessage: - 'Discover, extract, and index searchable content from websites and knowledge bases.', + /> + + )} + {productFeatures.hasWebCrawler && ( + + } + textAlign="left" + title={i18n.translate('xpack.enterpriseSearch.ingestSelector.method.crawler', { + defaultMessage: 'Web Crawler', + })} + description={i18n.translate( + 'xpack.enterpriseSearch.ingestSelector.method.crawler.description', + { + defaultMessage: + 'Discover, extract, and index searchable content from websites and knowledge bases.', + } + )} + footer={ + + {START_LABEL} + } - )} - footer={ - - {START_LABEL} - - } - /> - + /> + + )} ); };