From efd0ef692cc14b1045c91afb5d415c22e2de517c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Efe=20G=C3=BCrkan=20YALAMAN?= Date: Fri, 25 Aug 2023 17:06:55 +0200 Subject: [PATCH] Add cloud context --- .../search_index/connector/connector_configuration.tsx | 4 ++++ .../components/search_index/connector/constants.ts | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration.tsx index bfed22c06a504..0667451d8e761 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration.tsx @@ -28,6 +28,7 @@ import { FormattedMessage } from '@kbn/i18n-react'; import { ConnectorStatus } from '../../../../../../common/types/connectors'; import { BetaConnectorCallout } from '../../../../shared/beta/beta_connector_callout'; +import { useCloudDetails } from '../../../../shared/cloud_details/cloud_details'; import { docLinks } from '../../../../shared/doc_links'; import { generateEncodedPath } from '../../../../shared/encode_path_params'; import { EuiButtonTo, EuiLinkTo } from '../../../../shared/react_router_helpers'; @@ -53,6 +54,8 @@ export const ConnectorConfiguration: React.FC = () => { const { index, recheckIndexLoading } = useValues(IndexViewLogic); const { indexName } = useValues(IndexNameLogic); const { recheckIndex } = useActions(IndexViewLogic); + const cloudContext = useCloudDetails(); + if (!isConnectorIndex(index)) { return <>; } @@ -157,6 +160,7 @@ export const ConnectorConfiguration: React.FC = () => { id: index.connector.id, service_type: index.connector.service_type, }, + host: cloudContext.elasticsearchUrl, })} diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/constants.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/constants.ts index 6f3008de1fab6..b53628fa82a5a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/constants.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/constants.ts @@ -170,12 +170,14 @@ export const BETA_CONNECTORS = CONNECTORS.filter(({ isBeta }) => isBeta); export const getConnectorTemplate = ({ apiKeyData, connectorData, + host, }: { apiKeyData: ApiKey | undefined; connectorData: { id: string; service_type: string | null; }; + host?: string; }) => dedent`connectors: - connector_id: "${connectorData.id}" @@ -187,6 +189,6 @@ export const getConnectorTemplate = ({ } elasticsearch: - host: "https://locahost:9200", + host: "${host || 'https://locahost:9200'}" api_key: "${apiKeyData?.encoded || ''}" `;