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

Fixed creation & deletion of relationships not working correctly & added same entity type relationship support #3060

Conversation

alexandrevryghem
Copy link
Member

@alexandrevryghem alexandrevryghem commented May 16, 2024

References

Description

This component fixes various bugs related to the Edit Item > Relationships tab. This PR fixes the bugs preventing relationships to be created, adds support for adding relationships between the same type of entities and it also fixes the bug where removing a relationship while explicitly saying that you want to keep the virtual metadata as plaintext metadata fields.

Instructions for Reviewers

List of changes in this PR:

  • Moved all the logic to create the relationships and display the success/ error notifications to EditItemRelationshipsService
  • Fixed multiple bugs in EditRelationshipListComponent that prevented the submitModal to emit (which caused the modal never to close after clicking save)
  • Added support for same entity type relationships
  • Refactored the way relationships are added/removed by doing them sequentially one at a time in order to ensure that all relationships operations were executed before closing the modal

Checklist

  • 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 ESLint validation using yarn lint
  • My PR doesn't introduce circular dependencies (verified via yarn check-circ-deps)
  • 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 libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

artlowel and others added 8 commits May 16, 2024 13:20
(cherry picked from commit e4b098e)
…ldn't arrive in the edit relationships component

(cherry picked from commit 9f3ee32)
…orking-between-same-types_contribute-7.6' into w2p-113560_edit-item-add-relationships-one-by-one

(cherry picked from commit 1c50dbf)
(cherry picked from commit cb59c05)
… the second submit onwards

(cherry picked from commit 4541788)
…relationship types have changed

(cherry picked from commit a658bf4)
- Fixed issue making it impossible to add new relationships until the page is refreshed after deleting an existing one (only when you refreshed the page after creating the initial relationship)
- Fixed NPE in DsDynamicLookupRelationModalComponent
- Grouped buttons on relationship page in order to assure that they always have the same behaviour
@alexandrevryghem alexandrevryghem force-pushed the w2p-113560_edit-item-add-relationships-one-by-one_contribute-main branch from 4167943 to df80c33 Compare May 17, 2024 18:08
@alexandrevryghem alexandrevryghem mentioned this pull request May 17, 2024
8 tasks
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.

👍 Thank you @alexandrevryghem ! I gave this a review/test today. I've verified that the two bugs are fixed (#2978 and #2998). I've also tested relationships in the Submission form (both selecting existing entities & importing new ones) and editing them (add/delete) for archived items. Everything seems to be working well.

I didn't find an easy way to test #1511 (as there's no default entity relationship defined of that sort), but the code itself looks like it should work.

Because this solves the major bugs, I think this should be merged quickly. That said, I'll give @atarix83 a few days to review before merging.

@alexandrevryghem
Copy link
Member Author

These changes fix a bug where the selected status in the popup modal would stay cached even after adding and then removing a relationship without refreshing the page. And also fix a very small bug where the incorrect nameVariant was retrieved when creating the delete relationship object in the store. This issue was never seen before because type any was used.

@alexandrevryghem alexandrevryghem requested a review from tdonohue May 28, 2024 12:18
@tdonohue
Copy link
Member

@alexandrevryghem : I'm retesting this today, and adding/removing relationships is now very buggy again.

Here's what I'm doing:

  • Find/create a Publication with no relationships
  • Edit it, go to the Relationships Tab
  • Add 3 (local) Persons as authors. Click Save
  • Back on the Relationships Tab, I now see 6 persons linked. Each Person appears to be listed twice? Some are highlighted in green (meaning they are not yet saved) but some are saved immediately (and I have an immediate option to delete).

This seemed to all work well before your last two changes. If necessary, I can retest tomorrow the older version of the code, to see if that's still working for me.

@alexandrevryghem alexandrevryghem force-pushed the w2p-113560_edit-item-add-relationships-one-by-one_contribute-main branch from e43bab3 to 9b0736c Compare May 30, 2024 15:04
@alexandrevryghem alexandrevryghem force-pushed the w2p-113560_edit-item-add-relationships-one-by-one_contribute-main branch from 9b0736c to 62e07e7 Compare May 30, 2024 15:07
@alexandrevryghem
Copy link
Member Author

@tdonohue: I removed the commit that caused this issue. But that commit fixed the bug where the selected status of items in the popup modal were cached & also an issue where the save button wouldn't be disabled when it should be. If you want we can already merge this PR as is, and I can open an additional PR later to fix this (but that will probably only be next week).

To reproduce the issue where the disabled button is still shown:

  • Add an item as a relationship
  • Remove the relationship
  • The save button will still be clickable

@tdonohue
Copy link
Member

Thanks @alexandrevryghem . I think rolling back that change makes sense for now. It can be treated as a separate bug, as it seems less significant then the bugs this PR fixes. That said, please do send an additional PR if you find a way to solve that separate bug...as I'd definitely like to find a way to solve it in 8.0 if possible.

I'll retest this later today and verify it's still working for me.

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 @alexandrevryghem ! I can verify this is working again with your recent changes removed.

As for the new bug you are seeing, I'm not sure that I can reproduce it. But, perhaps I'm not understanding the steps involved. Here's what I tried:

  • Go to a Publication with no Relationships. Edit it and go to "Relationships" tab
  • Add 3 Person relationships. After saving in the popup window, all three appear on the Relationships tab & an green success notice appears.
  • Now, on Relationships tab, click delete (trash icon) next to any of the new Person relationships. The Save button enables (as it should). Clicking "Save" will confirm the deletion. The page reloads and the relationship is removed.

In my opinion this is ready to be merged as-is. Any additional bugs can be addressed separately.

@tdonohue
Copy link
Member

Merging immediately as this works well and fixes the major bugs. Follow-up work is welcome in a separate PR. @atarix83 : if you have feedback on this after OR2024, we can address that in follow-up work.

@tdonohue tdonohue merged commit ebf9469 into DSpace:main May 31, 2024
13 checks passed
@alexandrevryghem alexandrevryghem deleted the w2p-113560_edit-item-add-relationships-one-by-one_contribute-main branch June 3, 2024 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component: configurable entities related to configurable entities high priority testathon Reported by a tester during Community Testathon
Projects
No open projects
Status: ✅ Done
3 participants