[Streams 🌊] Handle no data screen for simulation (#225322)

## 📓 Summary

Fixes an issue where the no-data warning for the stream simulation was
hiding the simulation filters.



https://github.com/user-attachments/assets/965f22f6-3faf-4378-883e-26b002a9cdcd
This commit is contained in:
Marco Antonio Ghiani 2025-06-26 09:22:05 +02:00 committed by GitHub
parent 69971435e4
commit e78d4faaa5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -35,14 +35,14 @@ import { selectPreviewDocuments } from './state_management/simulation_state_mach
import { isGrokProcessor } from './utils';
import { selectDraftProcessor } from './state_management/stream_enrichment_state_machine/selectors';
import { WithUIAttributes } from './types';
import { AssetImage } from '../../asset_image';
export const ProcessorOutcomePreview = () => {
const isLoading = useSimulatorSelector(
(snapshot) => snapshot.matches('debouncingChanges') || snapshot.matches('runningSimulation')
);
const previewDocuments = useSimulatorSelector((snapshot) =>
selectPreviewDocuments(snapshot.context)
);
const samples = useSimulatorSelector((snapshot) => snapshot.context.samples);
const areDataSourcesLoading = useStreamEnrichmentSelector((state) =>
state.context.dataSourcesRefs.some((ref) => {
@ -53,7 +53,7 @@ export const ProcessorOutcomePreview = () => {
})
);
if (isEmpty(previewDocuments)) {
if (isEmpty(samples)) {
if (areDataSourcesLoading) {
return (
<EuiFlexGroup justifyContent="center" alignItems="center" style={{ minHeight: 200 }}>
@ -301,6 +301,33 @@ const OutcomePreviewTable = () => {
setPreviewColumnsOrder(visibleColumns);
};
if (isEmpty(previewDocuments)) {
return (
<EuiEmptyPrompt
icon={<AssetImage type="noResults" />}
titleSize="s"
title={
<h2>
{i18n.translate(
'xpack.streams.streamDetailView.managementTab.enrichment.processor.outcomePreviewTable.noFilteredDocumentsTitle',
{ defaultMessage: 'No documents available' }
)}
</h2>
}
body={
<p>
{i18n.translate(
'xpack.streams.streamDetailView.managementTab.enrichment.processor.outcomePreviewTable.noFilteredDocumentsBody',
{
defaultMessage: 'The current filter settings do not match any documents.',
}
)}
</p>
}
/>
);
}
return (
<PreviewTable
documents={previewDocuments}