Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 (
<EuiEmptyPrompt
color="warning"
iconType="warning"
titleSize="s"
title={
<h2>
{i18n.translate(
'xpack.streams.streamDetailView.managementTab.enrichment.processor.outcomePreviewTable.noDataTitle',
{ defaultMessage: 'No data available to validate processor changes' }
)}
</h2>
}
body={
<p>
{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.',
}
)}
</p>
}
/>
);
}

return (
<>
<EuiFlexItem grow={false}>
Expand Down Expand Up @@ -246,34 +277,6 @@ const OutcomePreviewTable = () => {
setPreviewColumnsOrder(visibleColumns);
};

if (!previewDocuments || isEmpty(previewDocuments)) {
return (
<EuiEmptyPrompt
titleSize="xs"
icon={<AssetImage type="unableToGeneratePreview" />}
title={
<h2>
{i18n.translate(
'xpack.streams.streamDetailView.managementTab.rootStreamEmptyPrompt.noDataTitle',
{ defaultMessage: 'Unable to generate a preview' }
)}
</h2>
}
body={
<p>
{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.",
}
)}
</p>
}
/>
);
}

return (
<PreviewTable
documents={previewDocuments}
Expand Down