From 5d50eba82271320405b60afd838a7cfe0447cdbc Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Wed, 3 Jan 2024 09:38:02 -0500 Subject: [PATCH] [8.12] [ObsUX][Profiling, Infra] Show "No Data" messages when there is no profiling data (#173633) (#174163) # Backport This will backport the following commits from `main` to `8.12`: - [[ObsUX][Profiling, Infra] Show "No Data" messages when there is no profiling data (#173633)](https://github.com/elastic/kibana/pull/173633) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Mykola Harmash --- .../tabs/profiling/empty_data_prompt.tsx | 38 +++++++++++++++++++ .../tabs/profiling/flamegraph.tsx | 5 +++ .../tabs/profiling/functions.tsx | 5 +++ 3 files changed, 48 insertions(+) create mode 100644 x-pack/plugins/infra/public/components/asset_details/tabs/profiling/empty_data_prompt.tsx 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 ( <>