Skip to content

Commit 19a09c0

Browse files
committed
addressing more code review issues
1 parent 77b70d9 commit 19a09c0

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

kaizen/frontend/api/routes.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def get_dashboard() -> dict[str, Any]:
4444
# 3. Entity counts and recent entities across namespaces
4545
# For MVP, we will aggregate from all available namespaces up to the limit
4646
total_entities = 0
47-
type_breakdown: dict[str, int] = {}
47+
approximate_type_breakdown: dict[str, int] = {}
4848
recent_entities: list[dict[str, Any]] = []
4949

5050
for ns in namespaces:
@@ -55,7 +55,7 @@ def get_dashboard() -> dict[str, Any]:
5555

5656
for entity in ns_entities:
5757
etype = entity.type or "unknown"
58-
type_breakdown[etype] = type_breakdown.get(etype, 0) + 1
58+
approximate_type_breakdown[etype] = approximate_type_breakdown.get(etype, 0) + 1
5959

6060
# Safely handle non-string content before slicing
6161
content = entity.content
@@ -86,7 +86,8 @@ def get_dashboard() -> dict[str, Any]:
8686
"health": health,
8787
"namespace_count": namespace_count,
8888
"total_entities": total_entities,
89-
"type_breakdown": [{"type": k, "count": v} for k, v in type_breakdown.items()],
89+
"approximate_type_breakdown": [{"type": k, "count": v} for k, v in approximate_type_breakdown.items()],
90+
"type_breakdown_is_approx": True,
9091
"recent_entities": recent_entities,
9192
}
9293

kaizen/frontend/ui/src/components/Dashboard.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ interface DashboardData {
1919
health: boolean;
2020
namespace_count: number;
2121
total_entities: number;
22-
type_breakdown: TypeBreakdown[];
22+
approximate_type_breakdown: TypeBreakdown[];
23+
type_breakdown_is_approx: boolean;
2324
recent_entities: Entity[];
2425
}
2526

@@ -90,21 +91,28 @@ export default function Dashboard() {
9091

9192
<div className="charts-row">
9293
<div className="glass-panel section-card">
93-
<h3 className="section-title">Entity Types</h3>
94+
<h3 className="section-title">
95+
Entity Types
96+
{data.type_breakdown_is_approx && (
97+
<span className="text-secondary" style={{ marginLeft: 10, fontSize: '0.8rem', fontWeight: "normal" }}>
98+
(Approximate from sample)
99+
</span>
100+
)}
101+
</h3>
94102
<div className="chart-container">
95-
{data.type_breakdown.length > 0 ? (
103+
{data.approximate_type_breakdown.length > 0 ? (
96104
<ResponsiveContainer width="100%" height="100%">
97105
<PieChart>
98106
<Pie
99-
data={data.type_breakdown}
107+
data={data.approximate_type_breakdown}
100108
innerRadius={60}
101109
outerRadius={80}
102110
paddingAngle={5}
103111
dataKey="count"
104112
nameKey="type"
105113
stroke="none"
106114
>
107-
{data.type_breakdown.map((_entry, index) => (
115+
{data.approximate_type_breakdown.map((_entry, index) => (
108116
<Cell key={`cell-${index}`} fill={COLORS[index % COLORS.length]} />
109117
))}
110118
</Pie>

0 commit comments

Comments
 (0)