[ObsUX][Profiling, Infra] Show "No Data" messages when there is no profiling data (#173633)

Closes https://github.com/elastic/kibana/issues/173153

## Summary

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


2a6158ca-86d3-4b23-9807-dc177ce0361b
This commit is contained in:
Mykola Harmash 2024-01-03 14:13:09 +01:00 committed by GitHub
parent 366a4afe02
commit 9215e17cb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 0 deletions

View file

@ -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>
}
/>
</>
);
}

View file

@ -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 <ErrorPrompt />;
}
if (!loading && response?.TotalSamples === 0) {
return <EmptyDataPrompt />;
}
return (
<>
<ProfilingLinks

View file

@ -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();
@ -50,6 +51,10 @@ export function Functions() {
return <ErrorPrompt />;
}
if (!loading && response?.TotalCount === 0) {
return <EmptyDataPrompt />;
}
return (
<>
<ProfilingLinks