mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 09:42:13 +08:00
Dashboard: Fix Drawer validation to avoid errors with empty request
objects (#68214)
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import { isEmpty } from 'lodash';
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import { CoreApp, DataSourceApi, formattedValueToString, getValueFormat, PanelData, PanelPlugin } from '@grafana/data';
|
||||
@ -114,7 +115,8 @@ export const InspectContent = ({
|
||||
|
||||
function formatStats(data: PanelData) {
|
||||
const { request } = data;
|
||||
if (!request) {
|
||||
|
||||
if (!request || isEmpty(request)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ export const InspectStatsTab = ({ data, timeZone }: InspectStatsTabProps) => {
|
||||
}
|
||||
stats.push({
|
||||
displayName: t('dashboard.inspect-stats.queries', 'Number of queries'),
|
||||
value: data.request.targets.length,
|
||||
value: data.request.targets?.length ?? 0,
|
||||
});
|
||||
stats.push({
|
||||
displayName: t('dashboard.inspect-stats.rows', 'Total number rows'),
|
||||
|
Reference in New Issue
Block a user