Add StorageDriver select component to CollectionForm.tsx#997
Add StorageDriver select component to CollectionForm.tsx#997ekraffmiller wants to merge 12 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds superuser-only collection storage driver selection to the create/edit collection form, backed by new collection repository methods and js-dataverse-client support.
Changes:
- Adds storage driver domain models, use cases, hooks, repository methods, and form UI.
- Persists selected storage driver after create/edit submissions when changed by a superuser.
- Updates tests, Storybook mock data, package version, and dev environment storage configuration.
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
tests/component/sections/shared/edit-create-collection-form/EditCreateCollectionForm.spec.tsx |
Adds component coverage for storage field visibility/options and submit behavior. |
src/stories/create-collection/CreateCollection.stories.tsx |
Adds a superuser story with selectable storage drivers. |
src/stories/collection/CollectionMockRepository.ts |
Adds mock storage-driver repository methods. |
src/shared/hooks/useGetCollectionStorageDriver.ts |
Adds hook to fetch current/effective storage driver. |
src/shared/hooks/useGetCollectionAllowedStorageDrivers.ts |
Adds hook to fetch allowed storage drivers. |
src/sections/shared/form/EditCreateCollectionForm/types.ts |
Changes form storage value type to string. |
src/sections/shared/form/EditCreateCollectionForm/EditCreateCollectionForm.tsx |
Loads storage-driver data and passes it into the form. |
src/sections/shared/form/EditCreateCollectionForm/collection-form/useSubmitCollection.ts |
Sets selected storage driver after collection create/edit. |
src/sections/shared/form/EditCreateCollectionForm/collection-form/top-fields-section/TopFieldsSection.tsx |
Replaces disabled storage placeholder with conditional storage field. |
src/sections/shared/form/EditCreateCollectionForm/collection-form/top-fields-section/StorageField.tsx |
Adds storage driver select field component. |
src/sections/shared/form/EditCreateCollectionForm/collection-form/CollectionForm.tsx |
Wires storage props and submit behavior through the form. |
src/collection/infrastructure/repositories/CollectionJSDataverseRepository.ts |
Implements storage-driver calls through js-dataverse-client. |
src/collection/domain/useCases/setCollectionDriver.ts |
Adds use case to set collection storage driver. |
src/collection/domain/useCases/getCollectionStorageDriver.ts |
Adds use case to get collection storage driver. |
src/collection/domain/useCases/getCollectionAllowedStorageDrivers.ts |
Adds use case to get allowed storage drivers. |
src/collection/domain/repositories/CollectionRepository.ts |
Extends repository interface with storage-driver operations. |
src/collection/domain/models/StorageDriver.ts |
Adds storage driver model. |
src/collection/domain/models/AllowedStorageDrivers.ts |
Adds allowed storage drivers map type. |
package.json |
Updates js-dataverse-client dependency version. |
package-lock.json |
Locks updated js-dataverse-client dependency. |
dev-env/docker-compose-dev.yml |
Adds local filesystem storage driver configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| newOrUpdatedCollection, | ||
| collectionIdOrParentCollectionId | ||
| ) | ||
| .then((newCollectionIdentifier) => setSelectedStorageDriver(newCollectionIdentifier)) |
| }) | ||
| } else { | ||
| editCollection(collectionRepository, newOrUpdatedCollection, collectionIdOrParentCollectionId) | ||
| .then(() => setSelectedStorageDriver(collectionIdOrParentCollectionId)) |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…SS/dataverse-frontend into 929-collection-storage-driver
| "@dnd-kit/utilities": "3.2.2", | ||
| "@faker-js/faker": "7.6.0", | ||
| "@iqss/dataverse-client-javascript": "2.1.0-alpha.4", | ||
| "@iqss/dataverse-client-javascript": "2.2.0-alpha.4", |
There was a problem hiding this comment.
Could you update to 2.2.0-alpha.9 as our latest js-dataverse alpha ver.?
| collectionRepository.create = cy.stub().resolves(1) | ||
| collectionRepository.edit = cy.stub().resolves({}) | ||
| collectionRepository.getFacets = cy.stub().resolves(collectionFacets) | ||
| collectionRepository.getAllowedStorageDrivers = cy.stub().resolves(allowedStorageDrivers) |
There was a problem hiding this comment.
Could you also write unit tests for these two hooks (useGetCollectionAllowedStorageDrivers.ts, and
useGetCollectionStorageDriver.ts), to help improve the overall test coverage?
|
Thanks for the review, @ChengShi-1! That was a good catch about the default storage driver. 👍 I updated the logic to include that. I also increased code coverage, and the e2e tests are failing because of the changes to file permissions, which are addressed in the Review Sidebar PR. |
ChengShi-1
left a comment
There was a problem hiding this comment.
Thanks for the changes! Approving

What this PR does / why we need it: Implements the feature of selecting a storage drivers from a list of available storage drivers to the Create and Edit Collection page
Which issue(s) this PR closes:
Special notes for your reviewer:
To test this locally, update the docker-compose-dev.yml with additional JVM arguments, for example:
-Ddataverse.files.file1.type=file
-Ddataverse.files.file1.label=FileSystem
-Ddataverse.files.file1.storage-location=/dv/files/file1
Suggestions on how to test this:
Create and Edit collections for superuser and non-superuser. This is a superuser only function. Non-superusers should not see the select dropdown
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
no
Is there a release notes or changelog update needed for this change?:
Additional documentation: