From 980162b0b0138fb572a32c4f3901da3df7f53017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Efe=20G=C3=BCrkan=20YALAMAN?= Date: Wed, 25 Oct 2023 14:02:28 +0200 Subject: [PATCH] [Enterprise Search]Disable syncs for native connectors when EnterpriseSearch is down (#169671) ## Summary Disable syncs when Enterprise Search is down for native connectors. Screenshot 2023-10-24 at 17 15 00 Screenshot 2023-10-24 at 17 15 07 Screenshot 2023-10-24 at 17 15 32 Screenshot 2023-10-24 at 17 15 20 ### Checklist Delete any items that are not applicable to this PR. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [x] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) --- .../header_actions/syncs_context_menu.tsx | 20 ++++++++---- .../native_connector_configuration.tsx | 32 +++++++++++++++++++ 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/components/header_actions/syncs_context_menu.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/components/header_actions/syncs_context_menu.tsx index 96efd9d7d8447c..bbe8a039a3ef7e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/components/header_actions/syncs_context_menu.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/components/header_actions/syncs_context_menu.tsx @@ -23,6 +23,7 @@ import { import { i18n } from '@kbn/i18n'; import { Status } from '../../../../../../../common/types/api'; +import { HttpLogic } from '../../../../../shared/http'; import { KibanaLogic } from '../../../../../shared/kibana'; import { CancelSyncsApiLogic } from '../../../../api/connector/cancel_syncs_api_logic'; import { IngestionStatus } from '../../../../types'; @@ -30,8 +31,9 @@ import { CancelSyncsLogic } from '../../connector/cancel_syncs_logic'; import { IndexViewLogic } from '../../index_view_logic'; export const SyncsContextMenu: React.FC = () => { - const { productFeatures } = useValues(KibanaLogic); + const { config, productFeatures } = useValues(KibanaLogic); const { + connector, hasDocumentLevelSecurityFeature, hasIncrementalSyncFeature, ingestionMethod, @@ -43,7 +45,7 @@ export const SyncsContextMenu: React.FC = () => { const { cancelSyncs } = useActions(CancelSyncsLogic); const { status } = useValues(CancelSyncsApiLogic); const { startSync, startIncrementalSync, startAccessControlSync } = useActions(IndexViewLogic); - const { connector } = useValues(IndexViewLogic); + const { errorConnectingMessage } = useValues(HttpLogic); const [isPopoverOpen, setPopover] = useState(false); const togglePopover = () => setPopover(!isPopoverOpen); @@ -75,6 +77,13 @@ export const SyncsContextMenu: React.FC = () => { const shouldShowIncrementalSync = productFeatures.hasIncrementalSyncEnabled && hasIncrementalSyncFeature; + const isEnterpriseSearchNotAvailable = Boolean( + config.host && config.canDeployEntSearch && errorConnectingMessage + ); + const isSyncsDisabled = + (connector?.is_native && isEnterpriseSearchNotAvailable) || + ingestionStatus === IngestionStatus.INCOMPLETE; + const panels: EuiContextMenuProps['panels'] = [ { id: 0, @@ -86,7 +95,7 @@ export const SyncsContextMenu: React.FC = () => { // @ts-ignore - data-* attributes are applied but doesn't exist on types 'data-telemetry-id': `entSearchContent-${ingestionMethod}-header-sync-startSync`, 'data-test-subj': `entSearchContent-${ingestionMethod}-header-sync-startSync`, - disabled: ingestionStatus === IngestionStatus.INCOMPLETE, + disabled: isSyncsDisabled, icon: 'play', name: i18n.translate('xpack.enterpriseSearch.index.header.more.fullSync', { defaultMessage: 'Full Content', @@ -105,7 +114,7 @@ export const SyncsContextMenu: React.FC = () => { 'entSearchContent-${ingestionMethod}-header-sync-more-incrementalSync', 'data-test-subj': 'entSearchContent-${ingestionMethod}-header-sync-more-incrementalSync', - disabled: ingestionStatus === IngestionStatus.INCOMPLETE, + disabled: isSyncsDisabled, icon: 'play', name: i18n.translate('xpack.enterpriseSearch.index.header.more.incrementalSync', { defaultMessage: 'Incremental Content', @@ -126,8 +135,7 @@ export const SyncsContextMenu: React.FC = () => { 'data-test-subj': 'entSearchContent-${ingestionMethod}-header-sync-more-accessControlSync', disabled: Boolean( - ingestionStatus === IngestionStatus.INCOMPLETE || - connector?.configuration.use_document_level_security?.value + isSyncsDisabled || !connector?.configuration.use_document_level_security?.value ), icon: 'play', name: i18n.translate('xpack.enterpriseSearch.index.header.more.accessControlSync', { diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/native_connector_configuration/native_connector_configuration.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/native_connector_configuration/native_connector_configuration.tsx index 235ec644d3399d..df4155cb28d655 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/native_connector_configuration/native_connector_configuration.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/native_connector_configuration/native_connector_configuration.tsx @@ -10,6 +10,7 @@ import React from 'react'; import { useValues } from 'kea'; import { + EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiIcon, @@ -25,7 +26,9 @@ import { i18n } from '@kbn/i18n'; import { BetaConnectorCallout } from '../../../../../shared/beta/beta_connector_callout'; import { docLinks } from '../../../../../shared/doc_links'; +import { HttpLogic } from '../../../../../shared/http'; import { CONNECTOR_ICONS } from '../../../../../shared/icons/connector_icons'; +import { KibanaLogic } from '../../../../../shared/kibana'; import { hasConfiguredConfiguration } from '../../../../utils/has_configured_configuration'; import { isConnectorIndex } from '../../../../utils/indices'; @@ -40,6 +43,8 @@ import { ResearchConfiguration } from './research_configuration'; export const NativeConnectorConfiguration: React.FC = () => { const { index } = useValues(IndexViewLogic); + const { config } = useValues(KibanaLogic); + const { errorConnectingMessage } = useValues(HttpLogic); if (!isConnectorIndex(index)) { return <>; @@ -95,6 +100,33 @@ export const NativeConnectorConfiguration: React.FC = () => { + {config.host && config.canDeployEntSearch && errorConnectingMessage && ( + <> + +

+ {i18n.translate( + 'xpack.enterpriseSearch.content.indices.configurationConnector.nativeConnector.entSearchWarning.text', + { + defaultMessage: + 'Native connectors require a running Enterprise Search instance to sync content from source.', + } + )} +

+
+ + + + )}