Skip to content

Commit

Permalink
Show charts if metadata fetch fails
Browse files Browse the repository at this point in the history
  • Loading branch information
jennypavlova committed Jul 6, 2023
1 parent d21dd63 commit 7735c1c
Showing 1 changed file with 29 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,36 +55,6 @@ export const Overview = ({
metadata,
} = useMetadata(nodeName, nodeType, inventoryModel.requiredMetrics, sourceId, currentTimeRange);

if (fetchMetadataError) {
return (
<EuiCallOut
title={i18n.translate('xpack.infra.assetDetailsEmbeddable.overview.errorTitle', {
defaultMessage: 'Sorry, there was an error',
})}
color="danger"
iconType="error"
data-test-subj="infraMetadataErrorCallout"
>
<FormattedMessage
id="xpack.infra.assetDetailsEmbeddable.overview.errorMessage"
defaultMessage="There was an error loading your data. Try to {reload} and open the host details again."
values={{
reload: (
<EuiLink
data-test-subj="infraMetadataReloadPageLink"
onClick={() => window.location.reload()}
>
{i18n.translate('xpack.infra.assetDetailsEmbeddable.overview.errorAction', {
defaultMessage: 'reload the page',
})}
</EuiLink>
),
}}
/>
</EuiCallOut>
);
}

return (
<EuiFlexGroup direction="column">
<EuiFlexItem grow={false}>
Expand All @@ -95,9 +65,36 @@ export const Overview = ({
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<MetadataSummary metadata={metadata} metadataLoading={metadataLoading} />
{fetchMetadataError ? (
<EuiCallOut
title={i18n.translate('xpack.infra.assetDetailsEmbeddable.overview.errorTitle', {
defaultMessage: 'Sorry, there was an error',
})}
color="danger"
iconType="error"
data-test-subj="infraMetadataErrorCallout"
>
<FormattedMessage
id="xpack.infra.assetDetailsEmbeddable.overview.errorMessage"
defaultMessage="There was an error loading your host metadata. Try to {reload} and open the host details again."
values={{
reload: (
<EuiLink
data-test-subj="infraMetadataReloadPageLink"
onClick={() => window.location.reload()}
>
{i18n.translate('xpack.infra.assetDetailsEmbeddable.overview.errorAction', {
defaultMessage: 'reload the page',
})}
</EuiLink>
),
}}
/>
</EuiCallOut>
) : (
<MetadataSummary metadata={metadata} metadataLoading={metadataLoading} />
)}
</EuiFlexItem>
<EuiFlexItem grow={false} />
</EuiFlexGroup>
);
};

0 comments on commit 7735c1c

Please sign in to comment.