-
Notifications
You must be signed in to change notification settings - Fork 531
Metadata fields can be "display on create" per collection #11312
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
Metadata fields can be "display on create" per collection #11312
Conversation
This comment has been minimized.
This comment has been minimized.
| .where( | ||
| criteriaBuilder.equal(subqueryRoot.get("dataverse"), dataverseRoot), | ||
| criteriaBuilder.equal(subqueryRoot.get("datasetFieldType"), datasetFieldTypeJoin) | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggested changing this in the earlier PR since, at that point, displayOnCreate could be false incorrectly due to the default of setting it false in the code changes above. Is this still an issue - i.e. the default should be null and this subquery should only return 1 if displayOnCreate is not null (so that line 84 below lets you get the default value)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qqmyers You raise a good point. Currently, when no input level is configured, displayOnCreate defaults to false, which might hide fields that should be shown by default. We should consider making displayOnCreate nullable in DatasetFieldType and only setting it to false when explicitly configured in the input level. This would allow the default displayOnCreate value from the field type to be used when no input level is specified. Do you agree? Or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - that's what I was suggesting - I think you then have to adjust this subquery to add a check for displayOnCreate not null so that you get the default when it is null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry - Or maybe not - I think the nullable Boolean is needed on the DataverseFieldTypeInputLevel and not on the DatasetFieldType - the field type will always be true or false, but the input level might not be set it at all.
- Added @column annotation for displayOnCreate field in DatasetFieldType - Updated JsonPrinter to include displayOnCreate in display condition
|
First fix: Resolved an issue where the Specific Changes:
Verification:
|
This comment has been minimized.
This comment has been minimized.
|
The test Behavior:
Root Cause: Impact: |
src/main/java/edu/harvard/iq/dataverse/util/json/JsonPrinter.java
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
- Clarify that required fields are always displayed regardless of displayOnCreate setting
|
It seems that the build is still failing. I've run the 4 failing tests locally and they all pass successfully:
This suggests there might be an environment difference in Jenkins causing these failures. Could you please check the Jenkins logs for any specific details about why these tests are failing? Any hints or tips on how I should proceed would be very helpful. I have run the tests one by one by restarting the application. I did the tests in the commit 3c4e5cc. |
- Change displayOnCreate to nullable Boolean in DatasetFieldType - Update API and service methods to handle null displayOnCreate values - Modify native API documentation to explain null displayOnCreate behavior - Add null checks in MetadataBlockServiceBean queries
- Modified JsonPrinter to handle null values for displayOnCreate - Updated BriefJsonPrinter to use null-safe comparison
- Update MetadataBlock to safely check displayOnCreate with null values - Modify JsonPrinter to default displayOnCreate to false when null - Ensure consistent null-safe handling of displayOnCreate across components
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
|
📦 Pushed preview images as 🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name. |
| - ``include``: Whether the field is included (boolean) | ||
| - ``displayOnCreate`` (optional): Whether the field is displayed during dataset creation, even when not required (boolean) | ||
|
|
||
| .. code-block:: bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by the way - the "fully expanded" example down below here has bad data - "required": true, "included": false
| - ``datasetFieldTypeName``: Name of the metadata field | ||
| - ``required``: Whether the field is required (boolean) | ||
| - ``include``: Whether the field is included (boolean) | ||
| - ``displayOnCreate`` (optional): Whether the field is displayed during dataset creation, even when not required (boolean) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the code currently allows this to be optional - line 806 in Dataverses sets it to false by default. I've tried to handle this in #11330, which should be ~ up to date with this PR, but still checking to see if I've broken tests. (I also added a test updating an inputLevel with no displayOnCreate value in that PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the doc can we just say that it default to false if omitted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm the dummy who wrote the migration script and didn't default the column to false. Should I add another update? Are we ready for more flyway migration errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be a backward incompatibility - if you don't include displayOnCreate you will override any true on the datasetfieldtype itself. If that's OK, then yes a doc change could address it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. didn't think of that.
\
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better if it's omitted that the value would come from the table for that datasetFieldType?
sekmiller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Saw a minor doc issue - noted below, but it existed prior to this PR.
Thanks for all of your hard work on this, Alexis
|
Merging PR - no issues found. |




This PR restores the previous changes for metadata block handling in #11224 that were reverted, and addresses the test failures that led to the revert. The changes include:
See #11224 for screenshots and more details about the feature.
Current status: Investigating the root cause of the test failures to ensure proper functionality of the restored changes.