Skip to content

Commit

Permalink
Move noDataConfig new logic
Browse files Browse the repository at this point in the history
  • Loading branch information
iblancof committed Oct 16, 2024
1 parent a81193c commit 3ee8a24
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 (
<PageTemplate
data-test-subj={hasData ? _dataTestSubj : 'noDataPage'}
noDataConfig={evaluateNoDataConfig()}
noDataConfig={noDataConfig}
{...pageTemplateProps}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 3ee8a24

Please sign in to comment.