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 7 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.

If you want to temporarily enable a checkbox for testing, you can manually add the following code snippet at line 384 of dataverse.xhtml. This will render a checkbox in the collection settings UI to toggle the displayOnCreate property:

<td>
    <p:selectBooleanCheckbox id="DisplayOnCreate#{dsft.id}" 
                             value="#{dsft.displayOnCreate}" 
                             widgetVar="DisplayOnCreateOpt#{dsft.id}" 
                             disabled="#{DataversePage.editInputLevel == false}"
                             rendered="#{!dsft.hasParent and (!dsft.required or (dsft.hasParent and !dsft.parentDatasetFieldType.required))}">
        <p:ajax update="@widgetVar(DisplayOnCreateOpt#{dsft.id})" 
                listener="#{DataversePage.updateDisplayOnCreate(mdb.id, dsft.id, dsft.displayOnCreate)}" />
    </p:selectBooleanCheckbox>
</td>

Once the UI implementation is complete, this manual addition will no longer be necessary.

Suggestions on how to test this:

  1. Create or edit a collection.
  2. Navigate to the metadata fields selection section.
  3. Verify that the displayOnCreate checkbox appears next to metadata fields.
  4. Enable displayOnCreate for a field and save the configuration.
  5. Create a new dataset in the collection and confirm that the selected metadata field appears in the dataset creation form.

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

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.737% (-0.03%) from 22.762%
when pulling c27a51d on 10476-display-on-create-field-option
into 3aea148 on develop.

This comment has been minimized.

@stevenwinship stevenwinship self-assigned this Feb 11, 2025
@@ -66,6 +67,7 @@ public DataverseFieldTypeInputLevel (DatasetFieldType fieldType, Dataverse datav
this.dataverse = dataverse;
this.required = required;
this.include = include;
this.displayOnCreate = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

My concern with this is that the displayOnCreate isn't passed in to the constructor.
This means that the value isn't able to be passed from Dataverses.parseInputLevels.
export JSON='[{"datasetFieldTypeName":"geographicCoverage", "required":true, "include":true}, {"datasetFieldTypeName":"country", "required":true, "include":true}]'
API /api/dataverses/$ID/inputLevels

Copy link
Contributor

Choose a reason for hiding this comment

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

I would also like to see a test where the displayOnCreate is set and retrieved vis API

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

- 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

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: In Review 🔎
Development

Successfully merging this pull request may close these issues.

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