Skip to content

feat: folder system for datasets#694

Merged
cristian-tamblay merged 6 commits into
developfrom
feat/folders
Jun 15, 2026
Merged

feat: folder system for datasets#694
cristian-tamblay merged 6 commits into
developfrom
feat/folders

Conversation

@Felipedino

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a Folder model (dedicated DB table) with a nullable folder_id FK on Dataset (ondelete="SET NULL" so deleting a folder never deletes its datasets).
  • REST endpoints: GET/POST /api/v1/folder, PATCH/DELETE /api/v1/folder/{id}.
  • PATCH /api/v1/dataset/{id} extended to accept folder_id (uses model_fields_set to distinguish "not sent" from null).
  • Seed datasets are auto-assigned to an "Example datasets" folder on first run.
  • New DatasetFolderList component replaces the flat CollapsibleList in both the Datasets/Notebooks and Models sidebars. Features:
    • Collapsible folder sections with dataset count badge.
    • Drag & drop between folders (@dnd-kit/core, 5px activation distance to preserve click/edit).
    • Optimistic UI updates with rollback on failure.
    • Create, rename, delete folders inline (3-dots menu per folder).
    • "No folder" virtual section as drop target for unassigned datasets.
  • i18n keys added for all 5 locales (en, es, de, pt, zh).

Migration

Alembic revision f1a2b3c4d5e6 — runs automatically on startup. Uses op.batch_alter_table for SQLite FK compatibility.

Test plan

  • alembic upgrade head / alembic downgrade -1 clean round-trip.
  • First run: all seed datasets appear under "Example datasets" folder.
  • Create a folder, drag a dataset into it — persists on reload.
  • Delete a folder — its datasets move to "No folder".
  • Click to open dataset and inline rename still work (drag not triggered on click).
  • Both sidebars (Datasets/Notebooks and Models) show the folder list.
  • pytest tests/back/ and yarn lint pass.

Notes (optional)

Additional context or considerations.

- Added folder creation, renaming, and deletion functionalities.
- Integrated folder management into the ModelsContext and ModelsLeftBar components.
- Created DatasetFolderList component for displaying datasets organized in folders.
- Implemented drag-and-drop functionality for moving datasets between folders.
- Updated dataset type to include folder_id for association with folders.
- Enhanced internationalization support for folder-related messages.
Copilot AI review requested due to automatic review settings June 9, 2026 21:15

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

Introduces a first-class folder system for organizing datasets end-to-end: DB schema + API endpoints + frontend sidebar UI (including drag & drop), with seed-data initialization and i18n updates.

Changes:

  • Backend: adds Folder model/table, nullable Dataset.folder_id FK (SET NULL), folder CRUD endpoints, and extends dataset PATCH to accept folder_id.
  • Frontend: adds folder API/types/hooks and replaces flat dataset lists in sidebars with a folder-based list supporting DnD and inline folder management.
  • Operations/i18n: new Alembic migration, seed datasets assigned to an “Example datasets” folder, and locale strings added across 5 languages.

Reviewed changes

Copilot reviewed 24 out of 25 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
DashAI/front/yarn.lock Locks new @dnd-kit/* transitive dependencies for drag & drop.
DashAI/front/package.json Adds @dnd-kit/core dependency for DnD support.
DashAI/front/src/utils/i18n/locales/en/datasets.json Adds folder-related labels/messages/errors (EN).
DashAI/front/src/utils/i18n/locales/es/datasets.json Adds folder-related labels/messages/errors (ES).
DashAI/front/src/utils/i18n/locales/de/datasets.json Adds folder-related labels/messages/errors (DE).
DashAI/front/src/utils/i18n/locales/pt/datasets.json Adds folder-related labels/messages/errors (PT).
DashAI/front/src/utils/i18n/locales/zh/datasets.json Adds folder-related labels/messages/errors (ZH).
DashAI/front/src/types/folder.ts Introduces frontend IFolder type.
DashAI/front/src/types/dataset.ts Adds folder_id to dataset type.
DashAI/front/src/api/folders.ts Implements folder REST API client wrapper.
DashAI/front/src/hooks/datasets/useFolders.js Adds folder state + CRUD hook with snackbar feedback.
DashAI/front/src/hooks/datasets/useDatasets.js Adds optimistic dataset move-to-folder action.
DashAI/front/src/components/threeSectionLayout/DatasetFolderList.jsx New folder-aware sidebar list with DnD + inline folder CRUD UI.
DashAI/front/src/components/notebooks/DatasetNotebookLeftBar.jsx Swaps dataset list to DatasetFolderList and wires folder actions.
DashAI/front/src/components/models/ModelsLeftBar.jsx Swaps dataset list to DatasetFolderList and wires folder actions.
DashAI/front/src/components/models/ModelsContext.jsx Exposes folder state/actions in models context and triggers initial fetch.
DashAI/front/src/components/custom/contexts/DatasetsAndNotebooksContext.jsx Exposes folder state/actions in datasets/notebooks context.
DashAI/back/dependencies/database/models.py Adds Folder ORM model and Dataset.folder_id relationship/FK.
DashAI/back/api/api_v1/schemas/folders_params.py Adds Pydantic schemas for folder create/update/response.
DashAI/back/api/api_v1/schemas/datasets_params.py Extends dataset schemas to include folder_id.
DashAI/back/api/api_v1/endpoints/folders.py Adds folder CRUD endpoints under /api/v1/folder.
DashAI/back/api/api_v1/endpoints/datasets.py Extends dataset PATCH endpoint to handle folder_id.
DashAI/back/api/api_v1/api.py Registers the new folders router.
DashAI/back/seeds/init.py Creates “Example datasets” folder and assigns seeded datasets to it.
DashAI/alembic/versions/f1a2b3c4d5e6_add_folder_system.py Migration creating folder table and adding dataset.folder_id FK.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread DashAI/front/src/components/threeSectionLayout/DatasetFolderList.jsx Outdated
Comment thread DashAI/front/src/components/models/ModelsLeftBar.jsx
Comment thread DashAI/front/src/components/models/ModelsContext.jsx
Comment thread DashAI/back/api/api_v1/schemas/folders_params.py Outdated
Comment thread DashAI/back/seeds/__init__.py Outdated
Comment thread DashAI/back/api/api_v1/endpoints/datasets.py
- Move dnd-kit imports before styled component in DatasetFolderList
- Add missing title prop to DatasetFolderList in ModelsLeftBar
- Remove redundant fetchFolders() call in ModelsContext useEffect
- Migrate folders_params schema to Pydantic v2 ConfigDict
- Fix _get_or_create_example_folder return type to int | None
- Update update_dataset docstring to mention folder_id

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

Copilot reviewed 24 out of 25 changed files in this pull request and generated 4 comments.

Comment thread DashAI/back/api/api_v1/endpoints/folders.py Outdated
Comment thread DashAI/back/api/api_v1/endpoints/folders.py
Comment thread DashAI/back/api/api_v1/endpoints/folders.py
Comment thread DashAI/front/src/hooks/datasets/useDatasets.js
@Felipedino Felipedino marked this pull request as draft June 11, 2026 01:42
@Felipedino Felipedino marked this pull request as ready for review June 12, 2026 12:22
@cristian-tamblay cristian-tamblay merged commit e7cdee1 into develop Jun 15, 2026
19 checks passed
@cristian-tamblay cristian-tamblay deleted the feat/folders branch June 15, 2026 13:10
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.

3 participants