diff --git a/x-pack/platform/plugins/shared/streams_app/public/components/data_management/stream_detail_enrichment/processor_outcome_preview.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/data_management/stream_detail_enrichment/processor_outcome_preview.tsx index 7a64c74cfbb6a..3baa5d7be112f 100644 --- a/x-pack/platform/plugins/shared/streams_app/public/components/data_management/stream_detail_enrichment/processor_outcome_preview.tsx +++ b/x-pack/platform/plugins/shared/streams_app/public/components/data_management/stream_detail_enrichment/processor_outcome_preview.tsx @@ -20,7 +20,6 @@ import { isEmpty } from 'lodash'; import { Sample } from '@kbn/grok-ui'; import { GrokProcessorDefinition } from '@kbn/streams-schema'; import { PreviewTable } from '../preview_table'; -import { AssetImage } from '../../asset_image'; import { useSimulatorSelector, useStreamEnrichmentEvents, @@ -38,9 +37,41 @@ import { WithUIAttributes } from './types'; export const ProcessorOutcomePreview = () => { const isLoading = useSimulatorSelector( - (state) => state.matches('debouncingChanges') || state.matches('runningSimulation') + (snapshot) => snapshot.matches('debouncingChanges') || snapshot.matches('runningSimulation') + ); + const previewDocuments = useSimulatorSelector((snapshot) => + selectPreviewDocuments(snapshot.context) ); + if (isEmpty(previewDocuments)) { + return ( + + {i18n.translate( + 'xpack.streams.streamDetailView.managementTab.enrichment.processor.outcomePreviewTable.noDataTitle', + { defaultMessage: 'No data available to validate processor changes' } + )} + + } + body={ +

+ {i18n.translate( + 'xpack.streams.streamDetailView.managementTab.enrichment.processor.outcomePreviewTable.noDataBody', + { + defaultMessage: + 'Changes will be applied, but we can’t confirm they’ll work as expected. Proceed with caution.', + } + )} +

+ } + /> + ); + } + return ( <> @@ -246,34 +277,6 @@ const OutcomePreviewTable = () => { setPreviewColumnsOrder(visibleColumns); }; - if (!previewDocuments || isEmpty(previewDocuments)) { - return ( - } - title={ -

- {i18n.translate( - 'xpack.streams.streamDetailView.managementTab.rootStreamEmptyPrompt.noDataTitle', - { defaultMessage: 'Unable to generate a preview' } - )} -

- } - body={ -

- {i18n.translate( - 'xpack.streams.streamDetailView.managementTab.enrichment.processor.outcomePreviewTable.noDataBody', - { - defaultMessage: - "There are no sample documents to test the processors. Try updating the time range or ingesting more data, it might be possible we could not find any matching documents with the processors' source fields.", - } - )} -

- } - /> - ); - } - return (