Skip to content

Commit

Permalink
[ObsUX][Profiling, Infra] Show "No Data" messages when there is no pr…
Browse files Browse the repository at this point in the history
…ofiling data (elastic#173633)

Closes elastic#173153

## Summary

Adds a message when there is no data for flamegraph or top functions.

https://github.com/elastic/kibana/assets/793851/2a6158ca-86d3-4b23-9807-dc177ce0361b
(cherry picked from commit 9215e17)
  • Loading branch information
mykolaharmash committed Jan 3, 2024
1 parent e6b552f commit 8ec667c
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 8ec667c

Please sign in to comment.