-
Notifications
You must be signed in to change notification settings - Fork 446
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
Fix support for adding and removing relationships in relationship-only fields in the submission #1096
Conversation
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've tested this PR, and it seems to solve the remaining issues which were not yet handled in #1092
Using the PR, our standard test configs are functional again
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.
@artlowel : Overall this works & fixes #1094 for me as well.
That said, a few bugs I'm noticing:
- The field "hint" appears seems to be duplicated under any relation. See below screenshot.
- Clicking the delete/trash button next to a current selection doesn't appear to fully work. Sometimes the item in the form remains (e.g. on the Journal Issue form, I cannot seem to delete a selected volume). However, sometimes it appears to work (e.g. on the Person form. I can delete the Publication) but if I click the Lookup button again, I see it's still selected in the popup. (I haven't dug into this deeply, it might be a backend issue or an issue with the deletion request to the backend.)
- For single-valued fields, if you change the selected entity in the Lookup modal, it keeps adding new values to the list on the form. See this screenshot where it appears I have 3 Volumes linked to this new Issue. All I did was open the Lookup modal, select one volume. Close the modal. Open it again, change the selection. Close it. Open it a third time, change the selection and close it. The Submission Form thinks I now have 3 values, but it's just one relationship that has been changed 3 times. If I open the Lookup modal though, I see it only has one current selection.
Overall, the behavior here is much improved! The basics work. So, if one of these is difficult to solve quickly, we could leave it as a "known issue" for now. I just wanted to make sure these bugs were documented somewhere.
The first issue should be fixed now. Issues 2 and 3 are symptoms of the same problem as far as I can tell: the DELETE request for those relationships fails. Rest returns a 400 with the message "Request is invalid or incorrect". It's a fairly straightforward request, the authorization and CSRF headers look to be correct. The relationship to be deleted also definitely still exists, you can still GET it afterwards. So this looks to be a problem on the REST side. |
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.
👍 Thanks @artlowel . I re-tested today and it looks good now.
Somewhat strangely, today the delete button appears to be working correctly for me. I also had Chrome DevTools open and I see the DELETE request succeeds. I'm not sure why it wasn't working yesterday.
I will note though that after clicking the DELETE button, I see the deleted value disappear from the Submission Form, but it's still "cached" in the Lookup window (if I click Lookup it still appears selected there even though the DELETE command to REST succeeded, returning a 204). This is not a significant bug to block this PR, but it's something we may wish to look into further during Testathon. I can log it separately. UPDATE: logged it as #1101
In any case, this looks good to me now.
References
Depends on Repeatable fields with look up still broken in some cases #1092Requires Patch Add entire array with virtual values does not work DSpace#3224Description
This PR will auto update the item input in the submission form when the item changes. That way, when a relationship is added the form will update.
It will also fix an issue where the lookup button wasn't shown for repeatable relationship only fields, when they already had a value
Instructions for Reviewers
You can test this PR by verifying that relationships can be added and removed regardless of whether they're for a mixed field.
This PR seems bigger than it is, because it depends on #1092 You can see only the changes in this PR hereChecklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome). If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
yarn run lint
package.json
), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.