feat: add "isInReviewState" to API responses about dataset versions#12008
feat: add "isInReviewState" to API responses about dataset versions#12008vera wants to merge 11 commits intoIQSS:developfrom
Conversation
src/main/java/edu/harvard/iq/dataverse/util/json/JsonPrinter.java
Outdated
Show resolved
Hide resolved
stevenwinship
left a comment
There was a problem hiding this comment.
Change isInReviewState to isInReview since this is not a state. Being in review is a lock
|
@vera - FWIW: I think we have design questions about this. Being in review is because of a review lock and we already have an API for locks: https://guides.dataverse.org/en/latest/api/native-api.html#dataset-locks . While understanding that it can be convenient to get all useful info in a single call, having multiple ways to get the same info can be confusing. Further, making the output of a GET different from what's allowed in a PUT can also be confusing and make it harder for API users to deal with round trip changes. We certainly have cases where we've allowed extra info in GETs for convenience already, but we're starting to question doing more of that. In this case, I think there's an additional question too: are we starting down a road where we will also have entries for all the other possible locks in the version response? I think the things were discussing are:
|
|
I think it useful to add isInReview to the API response - although we haven't implemented the Submit for Review feature yet in the SPA, we do need to display an 'In Review' label in the View Dataset page, and we already are returning 'In Review' in the search results on the Collection Page. |
|
@ekraffmiller Does it make sense for the localization to be done in the backend? Wouldn't it make more sense to return a fixed value that can be localized by the UI? |
|
Hi @vera, thanks for your PR! We discussed it and think that for maintainability, it would be better to return a list of current locks on the dataset, rather than having a flag for the existence of a particular lock. That way if more locks are added in the future, the API code won't need to be updated. |
This is a good point. We have discussed handling multiple languages in general by adding a requested language in the API header. We we implement that, this data could be returned in the requested language, rather than translated in the frontend. |
Yes, here's an (unmerged) example: 99fcede And here's the (merged) language switcher: |
|
@vera |
@stevenwinship yes, I'm sorry for the delay. I am out of office next week and hope to address the comments as soon as possible after I return |
|
Thank you all for your feedback and for discussing this PR @qqmyers @ekraffmiller @stevenwinship and sorry again for the delay in responding. I have made the changes requested (returning a list of current locks, not returning the single flag). Since locks are dataset-level, not version-level, I felt like it makes sense to return the info from I assumed that it makes sense to return only a list of the lock types, since I don't want to clutter up the API response, and all other details about the lock(s) like start time or user can be retrieved using the already existing Example API response: (Just FYI, I had initially used the "My data" API response as inspiration, which returns a flag called ) |
What this PR does / why we need it:
This PR adds "isInReviewState" to API responses about dataset versions, which is useful information.This PR adds a list of locks currently active on a dataset to the API response sent by
GET /api/datasets/$ID.Which issue(s) this PR closes:
Not aware of any issue.
Special notes for your reviewer:
/
Suggestions on how to test this:
I've extended the API test:mvn test -Dtest="DatasetsIT#testDatasetVersionsAPI"mvn test -Dtest="DatasetsIT#testDatasetLocksApi"mvn test -Dtest="InReviewWorkflowIT"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?:
I've added a short release note.
Additional documentation:
/