From 40dedf9b94fbea42bb8aba74f2a0db1ba0027509 Mon Sep 17 00:00:00 2001 From: Rodney Norris Date: Fri, 30 Sep 2022 14:02:50 -0500 Subject: [PATCH] [Enterprise Search] pipelines copy tweaks Updated copy on the pipelines tab and modal when using an API-based index to explicitly call-out required actions in API requests to run the ingest pipeline. --- .../pipelines/ingest_pipeline_modal.tsx | 53 ++++++++++++----- .../search_index/pipelines/pipelines.tsx | 59 ++++++++++++++----- 2 files changed, 83 insertions(+), 29 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ingest_pipeline_modal.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ingest_pipeline_modal.tsx index b60da157ebf1f..a245c5db97882 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ingest_pipeline_modal.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ingest_pipeline_modal.tsx @@ -25,6 +25,7 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n-react'; import { DEFAULT_PIPELINE_NAME } from '../../../../../../common/constants'; @@ -91,21 +92,43 @@ export const IngestPipelineModal: React.FC = ({ - {displayOnly - ? i18n.translate( - 'xpack.enterpriseSearch.content.index.pipelines.ingestModal.modalBodyAPIText', - { - defaultMessage: - 'This pipeline runs automatically on all Crawler and Connector indices created through Enterprise Search. To use this configuration on API-based indices you can use the sample cURL request below.', - } - ) - : i18n.translate( - 'xpack.enterpriseSearch.content.index.pipelines.ingestModal.modalBodyConnectorText', - { - defaultMessage: - 'This pipeline runs automatically on all Crawler and Connector indices created through Enterprise Search.', - } - )} + {displayOnly ? ( + <> +

+ + {i18n.translate( + 'xpack.enterpriseSearch.content.index.pipelines.ingestModal.apiIndex', + { defaultMessage: 'This is an API-based index.' } + )} + + ), + }} + /> +

+

+ {i18n.translate( + 'xpack.enterpriseSearch.content.index.pipelines.ingestModal.modalBodyAPITextCont', + { + defaultMessage: + "In order to use this pipeline on your API-based indices you'll need to explicitly reference it in your API requests.", + } + )} +

+ + ) : ( + i18n.translate( + 'xpack.enterpriseSearch.content.index.pipelines.ingestModal.modalBodyConnectorText', + { + defaultMessage: + 'This pipeline runs automatically on all Crawler and Connector indices created through Enterprise Search.', + } + ) + )}
diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipelines.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipelines.tsx index 949e9610954c1..07be63b54f3b5 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipelines.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipelines.tsx @@ -15,6 +15,7 @@ import { i18n } from '@kbn/i18n'; import { DataPanel } from '../../../../shared/data_panel/data_panel'; import { docLinks } from '../../../../shared/doc_links'; +import { isApiIndex } from '../../../utils/indices'; import { IngestPipelinesCard } from './ingest_pipelines_card'; import { AddMLInferencePipelineButton } from './ml_inference/add_ml_inference_button'; @@ -23,9 +24,15 @@ import { MlInferencePipelineProcessorsCard } from './ml_inference_pipeline_proce import { PipelinesLogic } from './pipelines_logic'; export const SearchIndexPipelines: React.FC = () => { - const { showAddMlInferencePipelineModal } = useValues(PipelinesLogic); + const { + showAddMlInferencePipelineModal, + hasIndexIngestionPipeline, + index, + pipelineState: { name: pipelineName }, + } = useValues(PipelinesLogic); const { closeAddMlInferencePipelineModal, openAddMlInferencePipelineModal } = useActions(PipelinesLogic); + const apiIndex = isApiIndex(index); return ( <> @@ -54,12 +61,23 @@ export const SearchIndexPipelines: React.FC = () => { )} } - subtitle={i18n.translate( - 'xpack.enterpriseSearch.content.indices.pipelines.ingestionPipeline.subtitle', - { - defaultMessage: 'Ingest pipelines optimize your index for search applications', - } - )} + subtitle={ + apiIndex + ? i18n.translate( + 'xpack.enterpriseSearch.content.indices.pipelines.ingestionPipeline.apiIndexSubtitle', + { + defaultMessage: + "Ingest pipelines optimize your index for search applications. If you'd like to use these pipelines in your API-based index, you'll need to reference them explicitly in your API requests.", + } + ) + : i18n.translate( + 'xpack.enterpriseSearch.content.indices.pipelines.ingestionPipeline.subtitle', + { + defaultMessage: + 'Ingest pipelines optimize your index for search applications', + } + ) + } iconType="logstashInput" > @@ -88,13 +106,26 @@ export const SearchIndexPipelines: React.FC = () => { )} } - subtitle={i18n.translate( - 'xpack.enterpriseSearch.content.indices.pipelines.mlInferencePipelines.subtitle', - { - defaultMessage: - 'Inference pipelines will be run as processors from the Enterprise Search Ingest Pipeline', - } - )} + subtitle={ + apiIndex && hasIndexIngestionPipeline + ? i18n.translate( + 'xpack.enterpriseSearch.content.indices.pipelines.mlInferencePipelines.subtitleAPIindex', + { + defaultMessage: + "Inference pipelines will be run as processors from the Enterprise Search Ingest Pipeline. In order to use these pipeline on API-based indices you'll need to reference the {pipelineName} pipeline in your API requests.", + values: { + pipelineName, + }, + } + ) + : i18n.translate( + 'xpack.enterpriseSearch.content.indices.pipelines.mlInferencePipelines.subtitle', + { + defaultMessage: + 'Inference pipelines will be run as processors from the Enterprise Search Ingest Pipeline', + } + ) + } iconType="compute" action={ openAddMlInferencePipelineModal()} />