mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
LogsPanel: Show message and actions if panel cannot visualize data (#42878)
This commit is contained in:
parent
e555221523
commit
d76dd7d14b
@ -64,7 +64,8 @@ function getMessageFor(
|
||||
return message;
|
||||
}
|
||||
|
||||
if (!data.series || data.series.length === 0) {
|
||||
// In some cases there is a data frame but with no fields
|
||||
if (!data.series || data.series.length === 0 || (data.series.length === 1 && data.series[0].fields.length === 0)) {
|
||||
return 'No data';
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@ import { Options } from './types';
|
||||
import { dataFrameToLogsModel, dedupLogRows } from 'app/core/logs_model';
|
||||
import { getFieldLinksForExplore } from 'app/features/explore/utils/links';
|
||||
import { COMMON_LABELS } from '../../../core/logs_model';
|
||||
import { PanelDataErrorView } from 'app/features/panel/components/PanelDataErrorView';
|
||||
|
||||
interface LogsPanelProps extends PanelProps<Options> {}
|
||||
|
||||
@ -32,6 +33,7 @@ export const LogsPanel: React.FunctionComponent<LogsPanelProps> = ({
|
||||
enableLogDetails,
|
||||
},
|
||||
title,
|
||||
id,
|
||||
}) => {
|
||||
const isAscending = sortOrder === LogsSortOrder.Ascending;
|
||||
const style = useStyles2(getStyles(title, isAscending));
|
||||
@ -80,12 +82,8 @@ export const LogsPanel: React.FunctionComponent<LogsPanelProps> = ({
|
||||
[data]
|
||||
);
|
||||
|
||||
if (!data) {
|
||||
return (
|
||||
<div className="panel-empty">
|
||||
<p>No data found in response</p>
|
||||
</div>
|
||||
);
|
||||
if (!data || logRows.length === 0) {
|
||||
return <PanelDataErrorView panelId={id} data={data} needsStringField />;
|
||||
}
|
||||
|
||||
const renderCommonLabels = () => (
|
||||
|
Loading…
Reference in New Issue
Block a user