Skip to content

feat: add more cards to dashboard#405

Merged
mattdjenkinson merged 1 commit intomainfrom
feat/dashboard-update
Apr 14, 2026
Merged

feat: add more cards to dashboard#405
mattdjenkinson merged 1 commit intomainfrom
feat/dashboard-update

Conversation

@mattdjenkinson
Copy link
Copy Markdown
Contributor

Summary

Transforms the dashboard from a single Recent Users widget into a full Operator Command Center with KPI counters, fraud alerts, pending approvals, quota utilization, and real-time cluster health monitoring via MCP.

What's New

KPI Counter Row

  • Four compact counter cards at the top: Users, Organizations, Projects, Fraud Evaluations
  • Each card links to its respective list page
  • Shared useResourceCount hook with skeleton loading states

Fraud Alerts Widget

  • Shows the latest fraud evaluations flagged for review
  • Displays user, composite score (color-coded), decision badge, and age
  • Links through to individual fraud evaluation detail pages

Pending Approvals Widget

  • Lists users awaiting registration approval
  • Shows name, email (truncated), and waiting duration
  • "View All" links to the filtered users list

Quota Utilization Widget

  • Displays resource quota usage across organizations
  • Groups quotas by organization with owner email
  • Color-coded utilization bars (green/amber/red) with human-readable quota names

Cluster Health Widget (MCP-powered)

  • Real-time cluster and PoP health via VictoriaMetrics queries through the MCP
  • Runs 8 parallel PromQL queries per refresh:
    • Node readiness (kube_node_status_condition{condition="Ready"})
    • Gateway/PoP health (gatewayapi_gateway_status)
    • Memory, Disk, and PID pressure conditions
    • Envoy request rate per cluster
    • Certificate expiry (days remaining)
    • Container restart counts (>5 restarts)
  • Responsive grid layout — scales from 2 columns on mobile to 8 on wide screens
  • Each cluster cell shows health status icon, region name, and metric chips
  • Color-coded backgrounds: green (healthy), amber (pressure/warnings), red (critical)
  • Pressure pills (MEM/DISK/PID) and metric indicators with tooltips
  • Only rendered when MCP is configured (MCP_URL + MCP_API_KEY env vars)
  • Environment-aware: uses different cluster filters for staging vs production
  • Server-side region name mapping (e.g., ae-north-1-alice → "UAE North")

Files Changed

New Files (13)

File Purpose
app/features/dashboard/components/cluster-health-widget.tsx Cluster health grid UI
app/features/dashboard/components/fraud-alerts-widget.tsx Fraud alerts table
app/features/dashboard/components/kpi-counter-card.tsx Reusable KPI counter
app/features/dashboard/components/pending-approvals-widget.tsx Pending approvals table
app/features/dashboard/components/quota-utilization-widget.tsx Quota usage bars
app/features/dashboard/hooks/use-cluster-health.ts Cluster health data hook
app/features/dashboard/hooks/use-fraud-alerts-widget.ts Fraud alerts data hook
app/features/dashboard/hooks/use-pending-approvals-widget.ts Pending approvals data hook
app/features/dashboard/hooks/use-quota-utilization-widget.ts Quota utilization data hook
app/features/dashboard/hooks/use-resource-count.ts Generic resource count hook
app/server/routes/cluster.ts Server route for MCP-proxied VictoriaMetrics queries

Modified Files (9)

File Change
app/features/dashboard/index.ts Barrel exports for new widgets
app/hooks/use-env.ts Added MCP_ENABLED to public env interface
app/root.tsx Exposes MCP_ENABLED flag to client
app/routes/dashboard/index.tsx New dashboard layout with all widgets
app/server/routes/api.ts Mounts /cluster route
app/routes/fraud/detail/index.tsx Minor fix
app/features/dashboard/components/recent-users-widget.tsx Minor update
app/modules/i18n/locales/en.po New translation strings
app/modules/i18n/locales/fr.po New translation strings

Architecture

Browser (React)
  └─ ClusterHealthWidget
       └─ useClusterHealth hook
            └─ POST /api/cluster/health
                 └─ Hono route (cluster.ts)
                      └─ getMcpClient()
                           └─ victoria-metrics-mcp-server__query (×8 parallel)
                                └─ VictoriaMetrics / Prometheus
Screenshot 2026-04-14 at 19 38 38

@mattdjenkinson mattdjenkinson requested a review from a team April 14, 2026 18:45
@kevwilliams
Copy link
Copy Markdown
Contributor

Just curious because of other conversation today but, hows this look on mobile?

@mattdjenkinson mattdjenkinson merged commit 0d8e17d into main Apr 14, 2026
10 checks passed
@mattdjenkinson
Copy link
Copy Markdown
Contributor Author

@kevwilliams it stacks but still doesn't look great because the rest of the app doesn't scale to mobile well yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants