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

Fix support for adding and removing relationships in relationship-only fields in the submission #1096

Merged
merged 4 commits into from
Apr 14, 2021

Conversation

artlowel
Copy link
Member

@artlowel artlowel commented Apr 13, 2021

References

Description

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 here

Checklist

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!

  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes TSLint validation using yarn run lint
  • My PR doesn't introduce circular dependencies
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • If my PR includes new, third-party dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.

Copy link
Member

@benbosman benbosman left a 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

@artlowel artlowel changed the base branch from main to or2018 April 13, 2021 17:22
@artlowel artlowel changed the base branch from or2018 to main April 13, 2021 17:22
Copy link
Member

@tdonohue tdonohue left a 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:

  1. The field "hint" appears seems to be duplicated under any relation. See below screenshot.
    small-bug
  2. 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.)
  3. 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.
    another-bug

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.

@artlowel
Copy link
Member Author

@tdonohue

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.

Copy link
Member

@tdonohue tdonohue left a 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.

@tdonohue tdonohue merged commit 9920aab into DSpace:main Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Most relation fields (except Author) do not display their relations in the Submission form.
4 participants