Skip to content

Add StorageDriver select component to CollectionForm.tsx#997

Open
ekraffmiller wants to merge 12 commits into
developfrom
929-collection-storage-driver
Open

Add StorageDriver select component to CollectionForm.tsx#997
ekraffmiller wants to merge 12 commits into
developfrom
929-collection-storage-driver

Conversation

@ekraffmiller

@ekraffmiller ekraffmiller commented May 29, 2026

Copy link
Copy Markdown
Contributor

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:

@coveralls

coveralls commented May 29, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 97.362% (-0.03%) from 97.389% — 929-collection-storage-driver into develop

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

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.

Comment thread src/shared/hooks/useGetCollectionAllowedStorageDrivers.ts
Comment thread src/shared/hooks/useGetCollectionStorageDriver.ts Outdated
newOrUpdatedCollection,
collectionIdOrParentCollectionId
)
.then((newCollectionIdentifier) => setSelectedStorageDriver(newCollectionIdentifier))
})
} else {
editCollection(collectionRepository, newOrUpdatedCollection, collectionIdOrParentCollectionId)
.then(() => setSelectedStorageDriver(collectionIdOrParentCollectionId))
ekraffmiller and others added 5 commits May 29, 2026 11:47
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>
@ekraffmiller ekraffmiller linked an issue Jun 1, 2026 that may be closed by this pull request
@ekraffmiller ekraffmiller marked this pull request as ready for review June 3, 2026 12:03
@ekraffmiller ekraffmiller moved this to Ready for Review ⏩ in IQSS Dataverse Project Jun 3, 2026
@ekraffmiller ekraffmiller added Size: 3 A percentage of a sprint. 2.1 hours. GREI Re-arch GREI re-architecture-related FY26 Sprint 24 FY26 Sprint 24 (2026-05-20 - 2026-06-03) labels Jun 3, 2026
@cmbz cmbz added the FY26 Sprint 25 FY26 Sprint 25 (2026-06-03 - 2026-06-17) label Jun 3, 2026
@ChengShi-1 ChengShi-1 self-assigned this Jun 10, 2026
@ChengShi-1 ChengShi-1 self-requested a review June 10, 2026 15:57
@ChengShi-1 ChengShi-1 moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Jun 10, 2026

@ChengShi-1 ChengShi-1 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.

Looks really good, just two comments.

While checking JSF, I noticed that there are two S3 options available. I'm not sure why there are two options. Are they the same, or do they serve different purposes?
Image

Comment thread package.json Outdated
"@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",

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.

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)

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.

Could you also write unit tests for these two hooks (useGetCollectionAllowedStorageDrivers.ts, and
useGetCollectionStorageDriver.ts), to help improve the overall test coverage?

@cmbz cmbz added the FY26 Sprint 26 FY26 Sprint 26 (2026-06-17 - 2026-07-01) label Jun 18, 2026
@ekraffmiller

Copy link
Copy Markdown
Contributor Author

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.

@ekraffmiller ekraffmiller removed their assignment Jun 25, 2026

@ChengShi-1 ChengShi-1 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.

Thanks for the changes! Approving

@github-project-automation github-project-automation Bot moved this from In Review 🔎 to Ready for QA ⏩ in IQSS Dataverse Project Jun 25, 2026
@ChengShi-1 ChengShi-1 removed their assignment Jun 25, 2026
@cmbz cmbz added the FY27 Sprint 1 FY27 Sprint 1 (2026-07-01 - 2026-07-15) label Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY26 Sprint 24 FY26 Sprint 24 (2026-05-20 - 2026-06-03) FY26 Sprint 25 FY26 Sprint 25 (2026-06-03 - 2026-06-17) FY26 Sprint 26 FY26 Sprint 26 (2026-06-17 - 2026-07-01) FY27 Sprint 1 FY27 Sprint 1 (2026-07-01 - 2026-07-15) GREI Re-arch GREI re-architecture-related Size: 3 A percentage of a sprint. 2.1 hours.

Projects

Status: Ready for QA ⏩

Development

Successfully merging this pull request may close these issues.

Create/Edit Collection: Add StorageDriver input

5 participants