Skip to content

11391 display on create with template#11411

Merged
ofahimIQSS merged 28 commits into
developfrom
11391-displayOnCreate-with-template
May 29, 2025
Merged

11391 display on create with template#11411
ofahimIQSS merged 28 commits into
developfrom
11391-displayOnCreate-with-template

Conversation

@sekmiller
Copy link
Copy Markdown
Contributor

@sekmiller sekmiller commented Apr 8, 2025

What this PR does / why we need it: Makes fields set "display on Create" at the Dataverse level visible on dataset create in the presence of a default template for that dataset (especially if the template does not have default values for that Metadata block)

Which issue(s) this PR closes:

Special notes for your reviewer: Not sure why the "isDisplayOnCreate" in the Metadata block doesn't work. I added a transient boolean that is updated in the DatasetVersionUI when the metadata blocks are added. Again no clear reason why 11421 stopped working - a test was added to make sure that if a parent dataset field type has required children it will be set to required. Necessary for "display on create" and validation.

Suggestions on how to test this:
Set dataset field types outside of the citation block to "displayOnCreate" for a given Dataverse -

curl -X PUT -H "X-Dataverse-key:27987dd2-8ae1-4b6d-b3f8-78a2ccfcad4d" -H "Content-Type:application/json" "http://localhost:8080/api/dataverses/temp-doc/inputLevels" -d '[{"datasetFieldTypeName":"geographicCoverage", "required":false, "include":true,  "displayOnCreate":true}, {"datasetFieldTypeName":"country", "required":false, "include":true, "displayOnCreate":true}]'

Add a template to the dataset, but don't set default values in the metadata block where you set "displayOnCreate". Make that template the default.

Add a dataset - the dataset fields set as display on create should be available for edit.

Also, you can try it with no default template but select one after "add dataset" - as above, the dataset fields set as display on create should be available for edit.

For 11421 set child fields as "required" and make sure that they are included in "display on create". Also that they must be filled in so that a dataset version is valid.

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

Is there a release notes update needed for this change?:

Additional documentation:

@github-actions github-actions Bot added FY25 Sprint 20 FY25 Sprint 20 (2025-03-26 - 2025-04-09) Size: 20 A percentage of a sprint. 14 hours. Type: Bug a defect labels Apr 8, 2025
@sekmiller sekmiller moved this to Ready for Review ⏩ in IQSS Dataverse Project Apr 8, 2025
@sekmiller sekmiller added this to the 6.7 milestone Apr 8, 2025
@github-actions

This comment has been minimized.

@cmbz cmbz added Size: 10 A percentage of a sprint. 7 hours. FY25 Sprint 21 FY25 Sprint 21 (2025-04-09 - 2025-04-23) and removed Size: 20 A percentage of a sprint. 14 hours. labels Apr 9, 2025
@sekmiller sekmiller moved this from Ready for Review ⏩ to In Progress 💻 in IQSS Dataverse Project Apr 10, 2025
@sekmiller sekmiller self-assigned this Apr 10, 2025
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 10, 2025

Coverage Status

coverage: 23.076% (-0.003%) from 23.079%
when pulling c2ac931 on 11391-displayOnCreate-with-template
into 43547e7 on develop.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@sekmiller sekmiller moved this from In Progress 💻 to Ready for Review ⏩ in IQSS Dataverse Project Apr 17, 2025
@sekmiller sekmiller removed their assignment Apr 17, 2025
@github-actions

This comment has been minimized.

@cmbz cmbz added the FY25 Sprint 23 FY25 Sprint 23 (2025-05-07 - 2025-05-21) label May 7, 2025
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@sekmiller sekmiller requested a review from qqmyers May 21, 2025 15:18
@cmbz cmbz added the FY25 Sprint 24 FY25 Sprint 24 (2025-05-21 - 2025-06-04) label May 22, 2025
@github-actions
Copy link
Copy Markdown

📦 Pushed preview images as

ghcr.io/gdcc/dataverse:11391-displayOnCreate-with-template
ghcr.io/gdcc/configbaker:11391-displayOnCreate-with-template

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

Copy link
Copy Markdown
Member

@qqmyers qqmyers left a comment

Choose a reason for hiding this comment

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

OK - looks good - thanks for the explanations. As noted, I made a small PR against this one (#11538) that has some suggested cleanup, but this PR works as is, so I'll approve and let you decide whether to merge the other one.

FWIW: I did do some testing on this following the testing instructions to set displayOnCreate for some geo block fields - and verified that I see the geo block when there's no template, when there's a default template, and when you select a non-default template.

}
return hasRequiredChildrenDV;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You understand the difference better than I do, but I was mostly talking about a mechanical refactor. I made a quick PR against this branch with a refactor to drop the separate variable and reduce duplicate code. It shouldn't change functionality at all.

}

public boolean isDisplayOnCreate() {
// relying on "should" doesn't seem to work in context of a template
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Got it - I still wonder a bit about the order of those lines, but digging some more I realized why shouldDisplayOnCreate can't work in the MetadataBlock.isDisplayOnCreate call - the fieldTypes being checked there are straight from the db and not the ones from the workingVersion datasetfield.getDatasetFieldType list which has been localized to the local collection. Given that - it's clear why your solution is needed - the metadatablock localDisplayOnCreate has to be set by checking the localized field types from the working version, which is what the code in DatasetVersionUI does.
In the small PR I made against this one, I tried to edit the comments and did a little cleanup to avoid double looping. - I made comments in the PR about it.

@github-project-automation github-project-automation Bot moved this from In Review 🔎 to Ready for QA ⏩ in IQSS Dataverse Project May 28, 2025
@qqmyers qqmyers removed their assignment May 28, 2025
@ofahimIQSS ofahimIQSS assigned ofahimIQSS and unassigned ofahimIQSS May 29, 2025
@ofahimIQSS ofahimIQSS moved this from Ready for QA ⏩ to QA ✅ in IQSS Dataverse Project May 29, 2025
@ofahimIQSS ofahimIQSS self-assigned this May 29, 2025
@ofahimIQSS
Copy link
Copy Markdown
Contributor

ofahimIQSS commented May 29, 2025

Adding testing evidences below:

**
image
**
image

image

image

Looks good to me - merging

@ofahimIQSS ofahimIQSS merged commit 5db10ea into develop May 29, 2025
27 checks passed
@ofahimIQSS ofahimIQSS deleted the 11391-displayOnCreate-with-template branch May 29, 2025 14:32
@github-project-automation github-project-automation Bot moved this from QA ✅ to Merged 🚀 in IQSS Dataverse Project May 29, 2025
@ofahimIQSS ofahimIQSS removed their assignment May 29, 2025
@pdurbin pdurbin moved this from Merged 🚀 to Done 🧹 in IQSS Dataverse Project May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY25 Sprint 20 FY25 Sprint 20 (2025-03-26 - 2025-04-09) FY25 Sprint 21 FY25 Sprint 21 (2025-04-09 - 2025-04-23) FY25 Sprint 22 FY25 Sprint 22 (2025-04-23 - 2025-05-07) FY25 Sprint 23 FY25 Sprint 23 (2025-05-07 - 2025-05-21) FY25 Sprint 24 FY25 Sprint 24 (2025-05-21 - 2025-06-04) Size: 10 A percentage of a sprint. 7 hours. Type: Bug a defect

Projects

Status: Done 🧹

6 participants