Skip to content

Conversation

@PRAteek-singHWY
Copy link
Contributor

⚠️ This PR depends on:

Please review this PR after the above PR is merged.


Scope note (important)

The intended change in this PR is limited to:

  • application/frontend/src/pages/MyOpenCRE/MyOpenCRE.tsx

Any other file diffs shown by GitHub are inherited from branch history / stacking and are not part of the frontend error-handling change itself.

Please let me know if you’d prefer this rebased or split further.


Summary

This PR improves the MyOpenCRE frontend experience by surfacing clear, structured feedback for CSV import results, directly reflecting backend validation responses.

The goal is to make CSV imports easier to understand and debug for users, without changing any backend logic.


What this PR does

Frontend error handling

  • Displays backend validation errors directly in the UI
  • Handles:
    • Empty CSV uploads
    • Invalid CRE format errors
    • Misaligned CSV columns
    • General validation failures
  • Row-level errors are rendered with clear, human-readable messages
    (row number + validation reason)

Success feedback

  • Displays a success message after import
  • Shows:
    • Number of new CREs added
    • Number of standards imported

UX improvements

  • Clears stale success/error messages when a new file is selected
  • Prevents ambiguous or misleading upload states
  • Keeps frontend behavior tightly aligned with backend responses

Screenshots

1. Empty CSV upload
image

2. Invalid CRE entry (bad_cre.csv)
image

3. Misaligned CSV columns (misaligned_columns.csv)
image

4. Successful import (valid.csv)
image

What is intentionally out of scope


Why this approach

The backend now returns clear, structured validation responses.
This PR ensures those responses are presented cleanly in the UI, making CSV imports:

  • Easier to debug
  • Less confusing for users
  • More production-ready without adding frontend-specific validation logic

Feedback welcome

If there are UX improvements, edge cases, or error formats that should be handled differently, I’d really appreciate guidance and am happy to iterate.

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.

1 participant