Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

10476 display on create field option #11224

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

Saixel
Copy link
Contributor

@Saixel Saixel commented Feb 6, 2025

What this PR does / why we need it:

This PR introduces the displayOnCreate property to the DataverseFieldTypeInputLevel class, allowing administrators to configure metadata fields to appear during dataset creation, even if they are not required.

Previously, metadata fields selected for a collection would only appear during dataset creation if they were marked as required (or displayOnCreate by default). This change grants collection administrators control over metadata visibility, improving metadata completeness and discoverability.

Which issue(s) this PR closes:

Special notes for your reviewer:

This PR implements the functionality for displayOnCreate, but the UI implementation is not included yet.

The implementation includes:

  • New property displayOnCreate in DataverseFieldTypeInputLevel
  • API endpoint to update the displayOnCreate setting
  • Integration tests to verify the functionality

Testing via API:

  1. Create a test collection:
curl -X POST -H "X-Dataverse-key: YOUR_API_KEY" -H "Content-Type: application/json" \
-d '{
  "name": "Test Collection",
  "alias": "test-collection",
  "dataverseContacts": [{"contactEmail": "[email protected]"}],
  "metadataBlockIds": ["citation", "socialscience"]
}' \
http://localhost:8080/api/dataverses/:root
  1. Configure a field to display on create:
curl -X PUT -H "X-Dataverse-key: YOUR_API_KEY" -H "Content-Type: application/json" \
-d '[
  {
    "datasetFieldTypeName": "unitOfAnalysis",
    "required": false,
    "include": true,
    "displayOnCreate": true
  }
]' \
http://localhost:8080/api/dataverses/test-collection/inputLevels
  1. Create a dataset in the collection and verify that the field appears in the creation form.

Automated Tests:

Run the integration test:

mvn test -Dtest=DataversesIT#testUpdateInputLevelDisplayOnCreate

Does this PR introduce a user interface change?:

No UI changes in this PR. A separate issue will track the UI implementation.

Additional documentation:

image
image

- Added updateDisplayOnCreate method to DataversePage
- Added displayOnCreate handling in DataverseServiceBean
- Added displayOnCreate checkbox to dataverse.xhtml
- Added displayOnCreate field to DataverseFieldTypeInputLevel
- Remove javadoc comment from updateDisplayOnCreate method in DataversePage.java
- Remove inline comment from displayOnCreate setter in DataverseServiceBean.java
- Remove selector changes from dataverse.xhtml as they will be implemented in a separate task focusing on UI improvements
@Saixel Saixel added NIH CAFE Issues related to and/or funded by the NIH CAFE project FY25 Sprint 16 FY25 Sprint 16 (2025-01-29 - 2025-02-12) labels Feb 6, 2025
@coveralls
Copy link

coveralls commented Feb 6, 2025

Coverage Status

coverage: 22.724% (-0.01%) from 22.736%
when pulling 4625a3a on 10476-display-on-create-field-option
into 2210d16 on develop.

This comment has been minimized.

@stevenwinship stevenwinship self-assigned this Feb 11, 2025
@cmbz cmbz added the FY25 Sprint 17 FY25 Sprint 17 (2025-02-12 - 2025-02-26) label Feb 12, 2025
@Saixel Saixel mentioned this pull request Feb 13, 2025
16 tasks
…ructor

- Modified constructor to require displayOnCreate parameter
- Updated all constructor calls to pass the correct displayOnCreate value

This comment has been minimized.

- Update displayOnCreate handling in MetadataBlockServiceBean
- Refactor predicates for better input level handling
- Add default value handling for displayOnCreate
- Update service methods to consider input level configuration
- Add displayOnCreate check method in Dataverse
- Update displayOnCreate handling in DatasetPage
- Add save method for input levels in service
- Update template handling for displayOnCreate
- Improve code formatting
@stevenwinship
Copy link
Contributor

Please address the merge conflicts along with the review comments. Thanks

@ofahimIQSS
Copy link
Contributor

This PR has a merge conflict.

Copy link

📦 Pushed preview images as

ghcr.io/gdcc/dataverse:10476-display-on-create-field-option
ghcr.io/gdcc/configbaker:10476-display-on-create-field-option

🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name.

@Saixel
Copy link
Contributor Author

Saixel commented Feb 21, 2025

@stevenwinship @ofahimIQSS I have added all the adjustments and the test.
I have also finished resolving the conflicts.
Let me know if any adjustments are needed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FY25 Sprint 16 FY25 Sprint 16 (2025-01-29 - 2025-02-12) FY25 Sprint 17 FY25 Sprint 17 (2025-02-12 - 2025-02-26) NIH CAFE Issues related to and/or funded by the NIH CAFE project
Projects
Status: Ready for QA ⏩
Development

Successfully merging this pull request may close these issues.

Ensure Visibility of Non-Required Metadata Blocks on Dataset Creation
5 participants