[8.12] [Search] Fix web crawler enabled without enterprise search (#174453) (#174456)

# Backport

This will backport the following commits from `main` to `8.12`:
- [[Search] Fix web crawler enabled without enterprise search
(#174453)](https://github.com/elastic/kibana/pull/174453)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Sander
Philipse","email":"94373878+sphilipse@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-01-08T14:43:33Z","message":"[Search]
Fix web crawler enabled without enterprise search (#174453)\n\n##
Summary\r\n\r\nThis fixes the web crawler being accessible in Search
without a running\r\nEnterprise Search
node.","sha":"01093201f27a30995ac88c4f70c928aff34606aa","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:EnterpriseSearch","v8.12.0","v8.13.0"],"title":"[Search]
Fix web crawler enabled without enterprise
search","number":174453,"url":"https://github.com/elastic/kibana/pull/174453","mergeCommit":{"message":"[Search]
Fix web crawler enabled without enterprise search (#174453)\n\n##
Summary\r\n\r\nThis fixes the web crawler being accessible in Search
without a running\r\nEnterprise Search
node.","sha":"01093201f27a30995ac88c4f70c928aff34606aa"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/174453","number":174453,"mergeCommit":{"message":"[Search]
Fix web crawler enabled without enterprise search (#174453)\n\n##
Summary\r\n\r\nThis fixes the web crawler being accessible in Search
without a running\r\nEnterprise Search
node.","sha":"01093201f27a30995ac88c4f70c928aff34606aa"}}]}] BACKPORT-->

Co-authored-by: Sander Philipse <94373878+sphilipse@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2024-01-08 11:07:43 -05:00 committed by GitHub
parent dbd31e8195
commit 8b64cecfbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 2 deletions

View file

@ -24,6 +24,7 @@ import { FormattedMessage } from '@kbn/i18n-react';
import { INGESTION_METHOD_IDS } from '../../../../../common/constants';
import { generateEncodedPath } from '../../../shared/encode_path_params';
import { HttpLogic } from '../../../shared/http';
import { KibanaLogic } from '../../../shared/kibana';
import { handlePageChange } from '../../../shared/table_pagination';
import {
@ -35,6 +36,8 @@ import {
import { EnterpriseSearchContentPageTemplate } from '../layout';
import { SelectConnector } from '../new_index/select_connector/select_connector';
import { CannotConnect } from '../search_index/components/cannot_connect';
import { ConnectorStats } from './connector_stats';
import { ConnectorsLogic } from './connectors_logic';
import { ConnectorsTable } from './connectors_table';
@ -52,6 +55,7 @@ export interface ConnectorsProps {
export const Connectors: React.FC<ConnectorsProps> = ({ isCrawler }) => {
const { fetchConnectors, onPaginate, setIsFirstRequest } = useActions(ConnectorsLogic);
const { data, isLoading, searchParams, isEmpty, connectors } = useValues(ConnectorsLogic);
const { errorConnectingMessage } = useValues(HttpLogic);
const [searchQuery, setSearchValue] = useState('');
useEffect(() => {
@ -122,6 +126,7 @@ export const Connectors: React.FC<ConnectorsProps> = ({ isCrawler }) => {
]
: [
<EuiButton
disabled={Boolean(errorConnectingMessage)}
key="newCrawler"
color="primary"
iconType="plusInCircle"
@ -141,6 +146,12 @@ export const Connectors: React.FC<ConnectorsProps> = ({ isCrawler }) => {
],
}}
>
{Boolean(errorConnectingMessage) && (
<>
<CannotConnect />
<EuiSpacer />
</>
)}
<ConnectorStats isCrawler={isCrawler} />
<EuiSpacer />

View file

@ -6,14 +6,18 @@
*/
import React from 'react';
import { useValues } from 'kea';
import { EuiButton, EuiEmptyPrompt, EuiPanel } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { generateEncodedPath } from '../../../shared/encode_path_params';
import { HttpLogic } from '../../../shared/http';
import { KibanaLogic } from '../../../shared/kibana';
import { NEW_INDEX_METHOD_PATH } from '../../routes';
export const CrawlerEmptyState: React.FC = () => {
const { errorConnectingMessage } = useValues(HttpLogic);
return (
<EuiPanel hasBorder>
<EuiEmptyPrompt
@ -39,6 +43,7 @@ export const CrawlerEmptyState: React.FC = () => {
actions={
<EuiButton
color="primary"
disabled={Boolean(errorConnectingMessage)}
fill
iconType="plusInCircle"
onClick={() =>

View file

@ -13,6 +13,7 @@ import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { Status } from '../../../../../../common/types/api';
import { docLinks } from '../../../../shared/doc_links';
import { HttpLogic } from '../../../../shared/http';
import { KibanaLogic } from '../../../../shared/kibana';
import { LicensingLogic } from '../../../../shared/licensing';
import {
@ -20,6 +21,7 @@ import {
LICENSING_FEATURE,
} from '../../../../shared/licensing_callout/licensing_callout';
import { CreateCrawlerIndexApiLogic } from '../../../api/crawler/create_crawler_index_api_logic';
import { CannotConnect } from '../../search_index/components/cannot_connect';
import { NewSearchIndexTemplate } from '../new_search_index_template';
import { MethodCrawlerLogic } from './method_crawler_logic';
@ -29,6 +31,7 @@ export const MethodCrawler: React.FC = () => {
const { makeRequest } = useActions(CreateCrawlerIndexApiLogic);
const { isCloud } = useValues(KibanaLogic);
const { hasPlatinumLicense } = useValues(LicensingLogic);
const { errorConnectingMessage } = useValues(HttpLogic);
const isGated = !isCloud && !hasPlatinumLicense;
@ -41,11 +44,16 @@ export const MethodCrawler: React.FC = () => {
<LicensingCallout feature={LICENSING_FEATURE.CRAWLER} />
</EuiFlexItem>
)}
{Boolean(errorConnectingMessage) && (
<EuiFlexItem>
<CannotConnect />
</EuiFlexItem>
)}
<EuiFlexItem>
<NewSearchIndexTemplate
type="crawler"
onSubmit={(indexName, language) => makeRequest({ indexName, language })}
disabled={isGated}
disabled={isGated || Boolean(errorConnectingMessage)}
buttonLoading={status === Status.LOADING}
docsUrl={docLinks.crawlerOverview}
/>

View file

@ -147,7 +147,9 @@ export const NewSearchIndexPage: React.FC = () => {
<EuiIcon type={getIngestionMethodIconType(type)} size="xxl" />
</EuiFlexItem>
<EuiFlexItem grow={false}>{getTitle(type, serviceType)}</EuiFlexItem>
<EuiFlexItem grow={false}>{getConnectorModeBadge(isNative)}</EuiFlexItem>
{type === INGESTION_METHOD_IDS.CONNECTOR && (
<EuiFlexItem grow={false}>{getConnectorModeBadge(isNative)}</EuiFlexItem>
)}
</EuiFlexGroup>
),
}}