Skip to content

Commit

Permalink
[8.12] [ObsUX][Profiling, Infra] Show "No Data" messages wh…
Browse files Browse the repository at this point in the history
…en 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)](#173633)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Mykola
Harmash","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-01-03T13:13:09Z","message":"[ObsUX][Profiling,
Infra] Show \"No Data\" messages when there is no profiling data
(#173633)\n\nCloses
https://github.com/elastic/kibana/issues/173153\r\n\r\n##
Summary\r\n\r\nAdds a message when there is no data for flamegraph or
top
functions.\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/793851/2a6158ca-86d3-4b23-9807-dc177ce0361b","sha":"9215e17cb7c9ce49e7b9347ea578ec363d50dd8e","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v8.12.0","Team:obs-ux-infra_services","v8.13.0"],"title":"[ObsUX][Profiling,
Infra] Show \"No Data\" messages when there is no profiling
data","number":173633,"url":"https://github.com/elastic/kibana/pull/173633","mergeCommit":{"message":"[ObsUX][Profiling,
Infra] Show \"No Data\" messages when there is no profiling data
(#173633)\n\nCloses
https://github.com/elastic/kibana/issues/173153\r\n\r\n##
Summary\r\n\r\nAdds a message when there is no data for flamegraph or
top
functions.\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/793851/2a6158ca-86d3-4b23-9807-dc177ce0361b","sha":"9215e17cb7c9ce49e7b9347ea578ec363d50dd8e"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/173633","number":173633,"mergeCommit":{"message":"[ObsUX][Profiling,
Infra] Show \"No Data\" messages when there is no profiling data
(#173633)\n\nCloses
https://github.com/elastic/kibana/issues/173153\r\n\r\n##
Summary\r\n\r\nAdds a message when there is no data for flamegraph or
top
functions.\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/793851/2a6158ca-86d3-4b23-9807-dc177ce0361b","sha":"9215e17cb7c9ce49e7b9347ea578ec363d50dd8e"}}]}]
BACKPORT-->

Co-authored-by: Mykola Harmash <[email protected]>
  • Loading branch information
kibanamachine and mykolaharmash authored Jan 3, 2024
1 parent a82ad1d commit 5d50eba
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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 (
<>
<EuiSpacer />
<EuiEmptyPrompt
color="subdued"
iconType="search"
titleSize="xs"
title={
<h2>
{i18n.translate('xpack.infra.profiling.emptyDataPromptTitle', {
defaultMessage: 'No data found',
})}
</h2>
}
body={
<p>
{i18n.translate('xpack.infra.profiling.emptyDataPromptBody', {
defaultMessage:
'Make sure this host is sending profiling data or try selecting a different date range.',
})}
</p>
}
/>
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -47,6 +48,10 @@ export function Flamegraph() {
return <ErrorPrompt />;
}

if (!loading && response?.TotalSamples === 0) {
return <EmptyDataPrompt />;
}

return (
<>
<ProfilingLinks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 Functions() {
const { services } = useKibanaContextForPlugin();
Expand Down Expand Up @@ -50,6 +51,10 @@ export function Functions() {
return <ErrorPrompt />;
}

if (!loading && response?.TotalCount === 0) {
return <EmptyDataPrompt />;
}

return (
<>
<ProfilingLinks
Expand Down

0 comments on commit 5d50eba

Please sign in to comment.