Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
  • Sign in
U
upgrade-data-crawler-fe
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • ThinhNC
  • upgrade-data-crawler-fe
  • Merge Requests
  • !7

Merged
Opened Sep 06, 2026 by ThinhNC@ThinhNC
  • Report abuse
Report abuse

feat(dashboard): integrate live analytics stats, quota widget, and mobile 2-col layout

Summary of Changes

Features & Enhancements

  • Live Dashboard Stats Integration:
    • Replaced mock data in crawler.service.ts with real GET /api/v1/dashboard/stats via Next.js proxy.
    • Connected 5 KPI StatCard items to real-time database figures: Total Jobs, Running Jobs, Crawled Pages, Extracted Records, and Success Rate.
  • Quota & Resource Usage Widget (quota-usage-widget.tsx):
    • Displays user plan quota consumption from GET /api/v1/auth/me/usage (daily pages crawled, daily job count, remaining concurrent task slots).
    • Dynamic visual alert banners triggered at threshold levels ($\ge 80%$ warning, $100%$ limit reached).
    • Deterministic reset countdown timer calculated to midnight UTC.
  • Service Ecosystem Health Bar (service-health-bar.tsx):
    • Live ecosystem status checking via /health/readiness and /health/metrics.
    • Biophilic badges indicating status and response latencies for Supabase PostgreSQL and BullMQ/Redis.
  • Hero & Header Polish:
    • Removed technical stack badge (Next.js 16 + TanStack Query + shadcn/ui) and clean up from both vi and en translations.

Bug Fixes & Resilient Improvements

  • Zero Metrics Success Rate Bug:
    • Fixed logic where successRate defaulted to 100% when totalJobs and totalPages were both 0. It now accurately computes 0%.
    • Disabled misleading Eco and 100% trend chips on cards when no activity exists.
    • Smart numeric check in StatCard to avoid prepending + to non-numeric strings (Live, Eco, Thời gian thực).
  • SSR Hydration Mismatch Resolution:
    • Replaced native .toLocaleString() calls with deterministic formatNumber() using invariant en-US formatting paired with suppressHydrationWarning to eliminate server vs client locale number separator differences (1,000 vs 1.000).
  • Backend Redis Downtime Resilience:
    • Wrapped BullMQ Redis ping and queue checks in health.service.ts with a 1.5s timeout (Promise.race), preventing PostgreSQL from showing false-offline when Redis is stopped.
    • Enabled degraded startup mode in server.ts so API and database remain available when queues are inactive.

Mobile Responsiveness (UX)

  • Upgraded the 5 KPI StatCard grid to grid-cols-2 on mobile viewports ($\ge 2$ columns per row) with the 5th card spanning across columns, eliminating awkward scrolling and orphan rows.
  • Adjusted padding (p-3.5 sm:p-5) and icon sizing on mobile to prevent text truncation.
  • Re-aligned the health bar refresh button on mobile headers to prevent single-button orphan rows.

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b feat/analytics-dashboard-realtime-metrics origin/feat/analytics-dashboard-realtime-metrics

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git fetch origin
git checkout origin/develop
git merge --no-ff feat/analytics-dashboard-realtime-metrics

Step 4. Push the result of the merge to GitLab

git push origin develop

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines.

  • Discussion 0
  • Commits 1
  • Changes 15
Assignee
No assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
0
Labels
None
Assign labels
  • View project labels
Reference: ThinhNC/upgrade-data-crawler-fe!7

Revert this merge request

This will create a new commit in order to revert the existing changes.

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.