diff --git a/ui/src/dashboard/Entry/DashboardEntry.tsx b/ui/src/dashboard/Entry/DashboardEntry.tsx
index de67341..4822d27 100644
--- a/ui/src/dashboard/Entry/DashboardEntry.tsx
+++ b/ui/src/dashboard/Entry/DashboardEntry.tsx
@@ -67,63 +67,29 @@ const SpecificDashboardEntry: React.FC<{entry: Dashboards_dashboards_items; rang
);
}
+ const firstEntries: Stats_stats_entries[] =
+ (stats.data && stats.data.stats && stats.data.stats[0] && stats.data.stats[0].entries) || [];
+ if (firstEntries.length === 0) {
+ return (
+
+ no data
+
+ );
+ }
const entries = (stats.data && stats.data.stats) || [];
switch (entry.entryType) {
case EntryType.PieChart:
- const data: Stats_stats_entries[] = (stats.data && stats.data.stats && stats.data.stats[0].entries) || [];
- if (data.length === 0) {
- return (
-
- no data
-
- );
- }
- return ;
+ return ;
case EntryType.BarChart:
- if (entries.length === 0) {
- return (
-
- no data
-
- );
- }
return ;
case EntryType.StackedBarChart:
- if (entries.length === 0) {
- return (
-
- no data
-
- );
- }
return ;
case EntryType.LineChart:
- if (entries.length === 0) {
- return (
-
- no data
-
- );
- }
return ;
case EntryType.VerticalTable:
- if (entries.length === 0) {
- return (
-
- no data
-
- );
- }
return ;
case EntryType.HorizontalTable:
- if (entries.length === 0) {
- return (
-
- no data
-
- );
- }
return ;
default:
return expectNever(entry.entryType);