diff --git a/x-pack/plugins/infra/public/components/asset_details/tabs/profiling/empty_data_prompt.tsx b/x-pack/plugins/infra/public/components/asset_details/tabs/profiling/empty_data_prompt.tsx new file mode 100644 index 0000000000000..07cf4773fc418 --- /dev/null +++ b/x-pack/plugins/infra/public/components/asset_details/tabs/profiling/empty_data_prompt.tsx @@ -0,0 +1,38 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { EuiEmptyPrompt, EuiSpacer } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; + +export function EmptyDataPrompt() { + return ( + <> + + + {i18n.translate('xpack.infra.profiling.emptyDataPromptTitle', { + defaultMessage: 'No data found', + })} + + } + body={ +

+ {i18n.translate('xpack.infra.profiling.emptyDataPromptBody', { + defaultMessage: + 'Make sure this host is sending profiling data or try selecting a different date range.', + })} +

+ } + /> + + ); +} diff --git a/x-pack/plugins/infra/public/components/asset_details/tabs/profiling/flamegraph.tsx b/x-pack/plugins/infra/public/components/asset_details/tabs/profiling/flamegraph.tsx index a00b9373c2f02..80a7f0ad8539c 100644 --- a/x-pack/plugins/infra/public/components/asset_details/tabs/profiling/flamegraph.tsx +++ b/x-pack/plugins/infra/public/components/asset_details/tabs/profiling/flamegraph.tsx @@ -17,6 +17,7 @@ import { useTabSwitcherContext } from '../../hooks/use_tab_switcher'; import { ContentTabIds } from '../../types'; import { ErrorPrompt } from './error_prompt'; import { ProfilingLinks } from './profiling_links'; +import { EmptyDataPrompt } from './empty_data_prompt'; export function Flamegraph() { const { services } = useKibanaContextForPlugin(); @@ -47,6 +48,10 @@ export function Flamegraph() { return ; } + if (!loading && response?.TotalSamples === 0) { + return ; + } + return ( <> ; } + if (!loading && response?.TotalCount === 0) { + return ; + } + return ( <>