mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06: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 React, { useState } from 'react';
|
||||||
|
|
||||||
import { CoreApp, DataSourceApi, formattedValueToString, getValueFormat, PanelData, PanelPlugin } from '@grafana/data';
|
import { CoreApp, DataSourceApi, formattedValueToString, getValueFormat, PanelData, PanelPlugin } from '@grafana/data';
|
||||||
@@ -114,7 +115,8 @@ export const InspectContent = ({
|
|||||||
|
|
||||||
function formatStats(data: PanelData) {
|
function formatStats(data: PanelData) {
|
||||||
const { request } = data;
|
const { request } = data;
|
||||||
if (!request) {
|
|
||||||
|
if (!request || isEmpty(request)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export const InspectStatsTab = ({ data, timeZone }: InspectStatsTabProps) => {
|
|||||||
}
|
}
|
||||||
stats.push({
|
stats.push({
|
||||||
displayName: t('dashboard.inspect-stats.queries', 'Number of queries'),
|
displayName: t('dashboard.inspect-stats.queries', 'Number of queries'),
|
||||||
value: data.request.targets.length,
|
value: data.request.targets?.length ?? 0,
|
||||||
});
|
});
|
||||||
stats.push({
|
stats.push({
|
||||||
displayName: t('dashboard.inspect-stats.rows', 'Total number rows'),
|
displayName: t('dashboard.inspect-stats.rows', 'Total number rows'),
|
||||||
|
|||||||
Reference in New Issue
Block a user