From 3ee8a24c10da4a3d4046509c27d99f01a8e0442e Mon Sep 17 00:00:00 2001 From: iblancof Date: Wed, 16 Oct 2024 14:24:46 +0200 Subject: [PATCH] Move noDataConfig new logic --- .../shared/templates/infra_page_template.tsx | 18 ++++-------------- .../shared/templates/no_data_config.ts | 6 +++++- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/x-pack/plugins/observability_solution/infra/public/components/shared/templates/infra_page_template.tsx b/x-pack/plugins/observability_solution/infra/public/components/shared/templates/infra_page_template.tsx index 3747fed52278e..15b3f71302a35 100644 --- a/x-pack/plugins/observability_solution/infra/public/components/shared/templates/infra_page_template.tsx +++ b/x-pack/plugins/observability_solution/infra/public/components/shared/templates/infra_page_template.tsx @@ -65,7 +65,9 @@ export const InfraPageTemplate = ({ const hasLogsData = isLogsSignal(dataStreams); const noDataConfig = getNoDataConfig({ hasData, - loading: isPending(status), + hasLogsData, + isEntityCentricExperienceEnabled, + loading: isPending(status) || isPending(entitySummaryStatus), onboardingFlow, docsLink: docLinks.links.observability.guide, locators: share.url.locators, @@ -130,22 +132,10 @@ export const InfraPageTemplate = ({ />; } - const evaluateNoDataConfig = () => { - if (entitySummaryStatus === 'failure') { - return noDataConfig; - } - - if (entitySummaryStatus !== 'success') { - return undefined; - } - - return isEntityCentricExperienceEnabled && hasLogsData ? undefined : noDataConfig; - }; - return ( ); diff --git a/x-pack/plugins/observability_solution/infra/public/components/shared/templates/no_data_config.ts b/x-pack/plugins/observability_solution/infra/public/components/shared/templates/no_data_config.ts index faf53cccca4cd..309eb74a3a26a 100644 --- a/x-pack/plugins/observability_solution/infra/public/components/shared/templates/no_data_config.ts +++ b/x-pack/plugins/observability_solution/infra/public/components/shared/templates/no_data_config.ts @@ -101,18 +101,22 @@ const getNoDataConfigDetails = ({ export const getNoDataConfig = ({ hasData, + hasLogsData, loading, locators, onboardingFlow, docsLink, + isEntityCentricExperienceEnabled, }: { hasData: boolean; + hasLogsData?: boolean; loading: boolean; onboardingFlow: OnboardingFlow; locators: LocatorClient; docsLink?: string; + isEntityCentricExperienceEnabled?: boolean; }): NoDataConfig | undefined => { - if (hasData || loading) { + if (hasData || loading || (isEntityCentricExperienceEnabled && hasLogsData)) { return; }