Skip to content

fix(documents): translate document's files from js to ts - #7611

Open
Camille Roux (camrrx) wants to merge 4 commits into
mainfrom
issue/documents-tsx
Open

fix(documents): translate document's files from js to ts#7611
Camille Roux (camrrx) wants to merge 4 commits into
mainfrom
issue/documents-tsx

Conversation

@camrrx

Copy link
Copy Markdown
Member

Proposed changes

  • Translate all document's files from js to ts

Testing Instructions

  1. Test all the actions related to documents

Copilot AI lite review requested due to automatic review settings August 26, 2026 13:16
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

📖 Documentation check — ✅ Passed

21 functional file(s), 0 doc file(s) changed.

No documentation gaps detected.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the Documents feature (admin UI) from legacy .jsx/react-final-form patterns to TypeScript + React Hook Form, aligning document creation/editing with typed inputs and newer queryable pagination patterns.

Changes:

  • Converted Documents list, creation flow, and helper components from .jsx to .tsx (including a new DocumentForm based on React Hook Form + Zod).
  • Added a React Hook Form-compatible file upload controller (FileFieldController) and updated scenario/simulation selectors to support RHF multiple selection.
  • Tightened action typings for document creation (FormData support) and exercise lookups (typed request body).

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
openaev-front/src/components/fields/SimulationField.tsx Adds RHF multiple-selection mode for simulations/exercises; updates imports and props typing.
openaev-front/src/components/fields/ScenarioField.tsx Adds RHF controller-based multiple-selection mode and introduces disabled prop support.
openaev-front/src/components/fields/FileFieldController.tsx New RHF controller for file selection with filtering and helper text rendering.
openaev-front/src/components/ExerciseField.jsx Removes deprecated legacy ExerciseField (react-final-form).
openaev-front/src/admin/components/components/documents/DocumentType.tsx New TypeScript functional version of the DocumentType chip renderer.
openaev-front/src/admin/components/components/documents/DocumentType.jsx Removes legacy class-based DocumentType implementation.
openaev-front/src/admin/components/components/documents/Documents.tsx New TypeScript documents list using Queryable V2 pagination + prefetching related exercises/scenarios by id.
openaev-front/src/admin/components/components/documents/Documents.jsx Removes legacy documents list implementation.
openaev-front/src/admin/components/components/documents/DocumentPopover.tsx Refactors edit/delete/remove flows to typed inputs + RHF-based form and updated dialog usage.
openaev-front/src/admin/components/components/documents/DocumentForm.tsx New RHF + Zod document form with typed input model and conditional file requirement.
openaev-front/src/admin/components/components/documents/DocumentForm.jsx Removes legacy react-final-form document form.
openaev-front/src/admin/components/components/documents/CreateDocument.tsx New TypeScript create flow using FormData + typed initial values from context.
openaev-front/src/admin/components/components/documents/CreateDocument.jsx Removes legacy connected create component.
openaev-front/src/admin/components/common/articles/ArticleForm.tsx Updates DocumentPopover usage to match new component API.
openaev-front/src/admin/components/common/articles/ArticleAddDocuments.tsx Aligns create callback types and normalizes filters to undefined instead of null.
openaev-front/src/actions/scenarios/scenario-helper.d.ts Extends helper typing with getScenariosMap() used by Documents list.
openaev-front/src/actions/Exercise.ts Fixes fetchExercisesById to accept the endpoint’s typed request body.
openaev-front/src/actions/Document.ts Allows addDocument to accept FormData for multipart document creation.
Suppressed comments (1)

openaev-front/src/admin/components/components/documents/DocumentPopover.tsx:79

  • issue (blocking): documentId falls back to an empty string when document.document_id is missing, but it is then used for update/delete/fetch calls, which can hit incorrect endpoints (e.g. /api/documents//relations). Treat document_id as required (or guard and disable actions) instead of defaulting to ''.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread openaev-front/src/components/fields/SimulationField.tsx Outdated
Comment thread openaev-front/src/components/fields/ScenarioField.tsx Outdated
Comment thread openaev-front/src/components/fields/FileFieldController.tsx

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two files ScenarioFieldController.tsx and SimulationFieldController.tsx are almost identical; shouldn't we merge them to make them easier to maintain EntityMultiSelectFieldController ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dead code left behind: exerciseOptions and scenarioOptions (src/utils/Option.ts) no longer have any callers since the removal of DocumentPopover.jsx.

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

Labels

filigran team Item from the Filigran team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants