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
  • !14

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

feat(fe): add client resilience, data viewers, quota UI & full bilingual i18n

Pull Request Overview: Client Resilience, Quota Waiver Policy & Bilingual Localization

This pull request introduces connection resilience, client-side data handling utilities, an automatic quota exemption policy for connection/provider failures, and complete English/Vietnamese bilingual localization across the platform.


Frontend Changes (data-crawler-fe)

1. Real-Time SSE Resilience & Connection Recovery

  • Exponential Backoff Algorithm (use-event-source.ts):
    • Implemented progressive retry intervals: 1s → 2s → 4s → 8s → 16s → max 30s.
    • Added event listeners for online and tab visibilitychange to trigger immediate reconnects when connectivity returns.
  • Visual SSE Status Badge (sse-status-badge.tsx):
    • Emerald (Live): Real-time active stream with ping animation.
    • Amber (Reconnecting): Spinner with countdown timer (Reconnecting (2s)...).
    • Rose (Disconnected): Alert state with an interactive "Retry" button.

2. Network State Detection

  • Offline Banner (network-status-banner.tsx):
    • Sticky earth-orange notification informing users when the browser loses Internet connection.
  • React 19 Compliant Hook (use-network-status.ts):
    • Complies with React 19 rules (initializes via lazy state function to avoid cascading re-renders).

3. Desktop Web Notifications

  • Web Notification Utility (web-notifications.ts):
    • Alerts users upon job completion only when the tab is backgrounded (document.hidden === true).
  • Interactive Toggle Button (notification-toggle-button.tsx):
    • Provides permission requesting, visual state indicators, and feedback toasts.

4. Client Data Handling Utilities

  • JSON Syntax Highlighter (json-viewer.tsx):
    • High-performance tokenized syntax coloring, compact/formatted view toggle, search query filter, and line number gutter.
  • Reusable Copy Button (copy-button.tsx):
    • Smooth 2-second checkmark transition with optional toast notifications.
  • File Downloader Helper (download-helper.ts):
    • Standardized filename generation and automatic URL.revokeObjectURL() memory cleanup.

5. Full Bilingual Localization (English & Vietnamese)

  • Central Dictionary (translations.ts):
    • Added 100% matching translation keys across vi and en for: network, sse, notifications, jsonViewer, copyAction, crawlErrors, quota, and jobDetail.
    • Aligned semantic labels (Nguyên nhân: <-> Reason:).
  • Crawl Error Localization Helper (crawl-error-helper.ts):
    • Translates technical raw errors (HTTP 402, Timeouts, Refused, DNS) into user-friendly explanations according to the active locale.
  • UI Deduplication (crawl-jobs/[id]/page.tsx):
    • Removed duplicate badges and streamlined root cause presentation to a single, concise informational box.
Edited Sep 08, 2026 by ThinhNC

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/resilience-quota-waiver-and-i18n origin/feat/resilience-quota-waiver-and-i18n

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/resilience-quota-waiver-and-i18n

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 31
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!14

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.