Skip to content

Fully autonomous AI Agents system capable of performing complex penetration testing tasks

feat: enhance ChartCard component to display a no-data state with a bar chart icon

Dmitry Ng01987b60fc78
diff --git a/frontend/src/components/dashboard/chart-card.tsx b/frontend/src/components/dashboard/chart-card.tsx
index 0f115f96..c44b79db 100644
--- a/frontend/src/components/dashboard/chart-card.tsx
+++ b/frontend/src/components/dashboard/chart-card.tsx
@@ -1,6 +1,6 @@
import type { ReactNode } from 'react';
-import { Loader2 } from 'lucide-react';
+import { BarChart2, Loader2 } from 'lucide-react';
import { ResponsiveContainer } from 'recharts';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
@@ -9,6 +9,7 @@ export const ChartCard = ({
children,
className,
description,
+ empty,
height = 300,
loading,
title,
@@ -16,6 +17,7 @@ export const ChartCard = ({
children: ReactNode;
className?: string;
description?: ReactNode;
+ empty?: boolean;
height?: number;
loading?: boolean;
title: ReactNode;
@@ -33,6 +35,14 @@ export const ChartCard = ({
>
<Loader2 className="text-muted-foreground size-6 animate-spin" />
</div>
+ ) : empty ? (
+ <div
+ className="flex flex-col items-center justify-center gap-2"
+ style={{ height }}
+ >
+ <BarChart2 className="text-muted-foreground/30 size-10" />
+ <p className="text-muted-foreground text-sm">No data for this period</p>
+ </div>
) : (
<ResponsiveContainer
height={height}
diff --git a/frontend/src/pages/dashboard/dashboard-analytics.tsx b/frontend/src/pages/dashboard/dashboard-analytics.tsx
index 78194a4c..a7f6c77f 100644
--- a/frontend/src/pages/dashboard/dashboard-analytics.tsx
+++ b/frontend/src/pages/dashboard/dashboard-analytics.tsx
@@ -91,6 +91,7 @@ export const DashboardAnalytics = ({ period }: { period: UsageStatsPeriod }) =>
<div className="flex flex-col gap-6">
<ChartCard
description="Flows, tasks, and subtasks created per day"
+ empty={!flowsByPeriodLoading && flowsChartData.length === 0}
height={320}
loading={flowsByPeriodLoading}
title="Flows Activity Over Time"
@@ -138,6 +139,7 @@ export const DashboardAnalytics = ({ period }: { period: UsageStatsPeriod }) =>
<div className="grid gap-6 lg:grid-cols-2">
<ChartCard
description="Number of tool executions per day"
+ empty={!toolcallsByPeriodLoading && toolcallsChartData.length === 0}
loading={toolcallsByPeriodLoading}
title="Tool Calls Over Time"
>
@@ -171,6 +173,7 @@ export const DashboardAnalytics = ({ period }: { period: UsageStatsPeriod }) =>
<ChartCard
description="Input and output tokens processed daily"
+ empty={!usageByPeriodLoading && usageChartData.length === 0}
loading={usageByPeriodLoading}
title="Token Usage Over Time"
>
@@ -220,6 +223,7 @@ export const DashboardAnalytics = ({ period }: { period: UsageStatsPeriod }) =>
<ChartCard
description="LLM spending per day. May stay near zero when using local engines — this is expected."
+ empty={!usageByPeriodLoading && usageChartData.length === 0}
height={240}
loading={usageByPeriodLoading}
title="Cost Over Time"