Skip to content

Razwa/import study - #946

Open
ghazwarhili wants to merge 13 commits into
mainfrom
razwa/import-study
Open

Razwa/import study#946
ghazwarhili wants to merge 13 commits into
mainfrom
razwa/import-study

Conversation

@ghazwarhili

@ghazwarhili ghazwarhili commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

PR Summary

Add import a study from a previously exported archive (related to the study export feature), then submit it to explore-server.

  • New "Import study" entry in the directory tree contextual menu (developer-mode only), opening ImportStudyDialog.
  • ImportStudyDialog: form to pick the archive file, name (prefilled from the file name) and description, then calls POST /v1/explore/studies/import with the file as multipart form data plus
    studyName/description/parentDirectoryUuid query params.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 78f2707c-806f-417c-a6bb-ea23f0f4518f

📥 Commits

Reviewing files that changed from the base of the PR and between b09c095 and 8b8de69.

📒 Files selected for processing (3)
  • src/translations/en.json
  • src/translations/fr.json
  • src/utils/rest-api.ts
💤 Files with no reviewable changes (2)
  • src/translations/en.json
  • src/translations/fr.json

📝 Walkthrough

Walkthrough

Changes

The PR adds study ZIP archive import. A validated dialog submits archive metadata and the selected file to the explore service. Writable directories expose the action in developer mode, with English and French translations.

Study archive import

Layer / File(s) Summary
Archive API contracts
src/utils/rest-api.ts, src/utils/UIconstants.ts
Adds importStudy for multipart archive submission and registers the import dialog identifier.
Study archive import dialog
src/components/dialogs/import-study-dialog.tsx, src/translations/en.json, src/translations/fr.json
Adds ZIP validation, filename-based name prefill, import submission, error handling, success closure, and localized messages.
Directory menu integration
src/components/menus/directory-tree-contextual-menu.tsx
Adds the import action for writable directories in developer mode and renders the dialog.

Suggested reviewers: klesaulnier

Sequence Diagram(s)

sequenceDiagram
  participant DirectoryTreeContextualMenu
  participant ImportStudyDialog
  participant importStudy
  participant explore-service
  DirectoryTreeContextualMenu->>ImportStudyDialog: open for selected writable directory
  ImportStudyDialog->>ImportStudyDialog: validate name and ZIP archive
  ImportStudyDialog->>importStudy: submit metadata and archive
  importStudy->>explore-service: POST multipart import request
  explore-service-->>ImportStudyDialog: return import result or error
  ImportStudyDialog-->>DirectoryTreeContextualMenu: close after successful import
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description accurately summarizes the study import workflow, UI changes, REST request, and developer-mode menu entry.
Title check ✅ Passed The title identifies the main change as importing a study, although it includes an unnecessary author prefix.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/dialogs/import-study-dialog.tsx`:
- Around line 139-146: Enable the description input by removing the disabled
styling from the Grid wrapping DescriptionField, including pointerEvents: 'none'
and the related reduced opacity, so users can edit and submit a non-empty
description.
- Around line 56-60: Update the import dialog’s file validation to accept .zip
instead of .gz, and apply the same extension consistently to the filename
prefill and file picker configuration. Use the existing symbols around the
fileType validator and the related name/accept settings, preserving the
localized validation message and rejecting other extensions.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 67b9b4bc-eaa0-415c-9905-20c84315932a

📥 Commits

Reviewing files that changed from the base of the PR and between 1c4e3b3 and af6458f.

📒 Files selected for processing (7)
  • src/components/dialogs/import-study-dialog.tsx
  • src/components/menus/content-contextual-menu.tsx
  • src/components/menus/directory-tree-contextual-menu.tsx
  • src/translations/en.json
  • src/translations/fr.json
  • src/utils/UIconstants.ts
  • src/utils/rest-api.ts

Comment thread src/components/dialogs/import-study-dialog.tsx
Comment thread src/components/dialogs/import-study-dialog.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
src/components/dialogs/import-study-dialog.tsx (1)

56-60: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make ZIP validation case-insensitive.

Line 59 uses a case-sensitive suffix check, while Line 90 removes the suffix case-insensitively. Any file named study.ZIP that reaches this validator is rejected inconsistently. Normalize the filename before checking the suffix.

Proposed fix
-                return file.name.endsWith('.zip');
+                return file.name.toLowerCase().endsWith('.zip');
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/dialogs/import-study-dialog.tsx` around lines 56 - 60, Update
the fileType validator in the import-study dialog to normalize the selected
file’s name before checking its ZIP suffix, so uppercase and mixed-case
extensions such as .ZIP are accepted consistently with the existing
case-insensitive suffix removal.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@src/components/dialogs/import-study-dialog.tsx`:
- Around line 56-60: Update the fileType validator in the import-study dialog to
normalize the selected file’s name before checking its ZIP suffix, so uppercase
and mixed-case extensions such as .ZIP are accepted consistently with the
existing case-insensitive suffix removal.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5b0d5368-af4a-4254-8f4e-6b940c1aa239

📥 Commits

Reviewing files that changed from the base of the PR and between af6458f and b09c095.

📒 Files selected for processing (1)
  • src/components/dialogs/import-study-dialog.tsx

@ghazwarhili
ghazwarhili requested a review from EtienneLt August 13, 2026 13:09
@sonarqubecloud

Copy link
Copy Markdown

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