Submission - Replace plaintext with relationship on lookup - main#4911
Submission - Replace plaintext with relationship on lookup - main#4911Atmire-Kristof wants to merge 8 commits intoDSpace:mainfrom
Conversation
…cts-queue' into w2p-136580_Replace-plaintext-relationship-7.6
…aintext-relationship-main
jrcwiok
left a comment
There was a problem hiding this comment.
- Start a submission and for a relationship-controlled field (e.g. author), create multiple plain-text values
- Start a lookup from one of the plain-text value
- Select a couple new relationships in the lookup modal (at least two)
- Close the lookup
- Verify the plain-text value you started the lookup from is not present anymore
- Verify the first selected relationship is placed where the removed plain-text value was
- Verify all other selected relationships are placed at the end of the list
I interpreted the steps as the following:
I tested on the metadata tab using the author element. I entered plain text author names, clicked on the lookup, and replaced with a value in the list.
…-136580_Replace-plaintext-relationship-main
|
Some clarification to my latest changes: There was a bug with selecting multiple relationships in one action (e.g. selecting the entire page of results at once, using the dropdown). The modal would emit
This caused the multiple select to behave in very strange ways, where only one of the selected objects would actually be selected, the others were ignored. The easiest fix here is to remove the manual emission that |
There was a problem hiding this comment.
@Atmire-Kristof : I'm testing this today and the behavior is still a bit buggy to me. That said, the basic behavior you describe works. If I select multiple relationships, it works fine. But, if I select just one relationship, it doesn't seem to work.
For instance, this is what I tried which doesn't work:
- Create a new Publication
- Add two plain text authors to that publication
- Next to one author, click the search button. Select one relationship to add instead
- Go back to the submission form. The plain text author still exists
- Click the search button again. The relationship appears selected still. Close the popup
- Now there are two copies of the same plain text author back on the submission form.
However, this does work:
- Create a new Publication
- Add two plain text authors to that publication
- Next to one author, click the search button. Select two relationships.
- Now, back on the form, the plain text author is replaced with the relationship and the other relationship is listed at the end (as a third author).
So, this PR appears to be a partial fix. It works if you always select multiple relationships. But, if you try to do a 1-to-1 replacement, then it doesn't work. So, it's not a complete fix for #4843
References
Description
This PR changes the submission relationship lookup to make the (first) selected relationship replace the plain text value the lookup started from, if it did.
Instructions for Reviewers
Technical details:
ReplaceRelationshipActionwill be created instead of the usualAddRelationshipAction. This only happens for the first selected relationship, the rest sends aAddRelationshipActionfor each selection.ReplaceRelationshipAction:How to test:
Checklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lintnpm run check-circ-deps)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.