Skip to content

Conversation

@PRAteek-singHWY
Copy link
Contributor

@PRAteek-singHWY PRAteek-singHWY commented Dec 31, 2025

⚠️ This PR depends on

Please review this PR after the above PR has been merged.


📝 Note for reviewers

This PR intentionally limits its scope to frontend-only changes in the following files:

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

No backend files, APIs, or import logic were modified.

Any additional file diffs shown by GitHub are inherited from branch history or stacked branches and are not part of this change.


Summary

This PR improves the MyOpenCRE CSV import experience by introducing a frontend-only preview and confirmation flow before an import is executed.

The goal is to make CSV imports safer, more transparent, and more intentional for users — without changing backend behavior, APIs, or dependencies.

This enhancement directly aligns with the original MyOpenCRE workflow and acceptance criteria described in #584.


What changed

✅ CSV import preview (frontend-only)

  • Parses the selected CSV client-side and displays:
    • Total rows detected
    • Number of CRE mappings found
    • Number of unique standard sections
    • Detected CRE columns (e.g. CRE 0, CRE 1, …)
  • Allows users to verify file structure before starting an import.

✅ Explicit confirmation step

  • Import does not start automatically on file selection.
  • Users must explicitly click “Confirm Import” after reviewing the preview.
  • Prevents accidental or unintended uploads.

✅ Clear import states & feedback

  • All backend outcomes are clearly reflected in the UI:
    • Successful imports
    • No-op imports
    • Empty CSV uploads
    • Validation or server errors
  • Confirmation and preview state reset correctly on:
    • Cancel
    • File change
    • Validation errors
    • Import completion

✅ UX safeguards & polish

  • Upload button remains disabled until:
    • A valid CSV is selected
    • The preview is confirmed
  • Preview closes automatically on invalid file selection.
  • File input is reset intentionally to allow:
    • Re-selecting the same file
    • Avoiding accidental re-imports
  • File name visibility and messaging are handled explicitly to reduce confusion.

Scope & constraints

  • Frontend-only change
  • No backend logic changes
  • No API changes
  • No new dependencies introduced
  • Existing backend feature flags (e.g. CRE_ALLOW_IMPORT) are fully respected

Why this helps

  • Reduces user error during CSV imports
  • Makes import behavior predictable and intentional
  • Improves transparency without adding backend complexity
  • Brings the MyOpenCRE UI closer to the original product intent in MyOpenCRE: create frontend #584

Screenshots

Before

Before

After — CSV preview

Preview

After — confirmation state

Confirmed

After — successful import feedback

Success

PRAteek-singHWY and others added 16 commits December 15, 2025 12:06
- Validate file type, encoding, and required headers
- Accept CSVs generated from CRE catalogue export
- Skip empty and padding rows present in exported templates
- Validate CRE format only when CRE references exist
- Guard against misaligned rows with extra columns
- Return structured validation errors before import

This keeps the importer aligned with the exporter while
preventing malformed inputs from causing server errors.
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