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 caching & same entity type relationship with different left/rightwardtype bugs on edit item relationships #3106

Conversation

alexandrevryghem
Copy link
Member

@alexandrevryghem alexandrevryghem commented Jun 7, 2024

References

Description

This PR fixes 2 remaining bugs. A caching issue where the selected status of the relationship popup modal would stay cached even after deleting a relationship. And also an issue where only one side of the same entity type relationship would be shown on the edit item relationship page (for example both isDepartmentOfDivision & isDivisionOfDepartment should be shown). It also hides the item you are currently on in the search results of the popup modal.

Instructions for Reviewers

List of changes in this PR:

  • When removing a relationship the item you are on is invalidated, but the item on the other side of the relationship wasn't, so this has now been fixed in EditItemRelationshipsService#submit
  • Every search request in the relationship popup modal stayed cached even when it contained an item which was just invalidated. By using addDependency this search request is now linked to every item that is returned in the results, this way when one of the items is invalidated the request is also invalidated.
  • The current item won't be displayed in the search results in the popup modal anymore (because making a relationship with yourself doesn't really make sense). This was only visible for same entity relationships
  • When you have a relationship with the same entity type on both sides it would only show one side. To fix this a new component was created (EditRelationshipListWrapperComponent), which will display both sides of the relationship when a relationship has the same entity type on both sides and has different leftwardType & rightwardType

Guidance for how to test or review this PR:
Caching issues:

  • On the edit relationships tab open click copy the uuid of one of the objects with whom you can create a relationship and use this a query to find results (normally only one results should be displayed).
  • Select the item and save it
  • Open the modal again and search for the same uuid, the checkbox should be selected

Display both side of the relationship:

  • Add the following relationship config to your relationship-types.xml:
    <type>
         <leftType>OrgUnit</leftType>
         <rightType>OrgUnit</rightType>
         <leftwardType>isDepartmentOfDivision</leftwardType>
         <rightwardType>isDivisionOfDepartment</rightwardType>
         <leftCardinality>
             <min>0</min>
         </leftCardinality>
         <rightCardinality>
             <min>0</min>
         </rightCardinality>
         <copyToLeft>true</copyToLeft>
     </type>
     <type>
         <leftType>OrgUnit</leftType>
         <rightType>OrgUnit</rightType>
         <leftwardType>isOrgUnitOfOrgUnit</leftwardType>
         <rightwardType>isOrgUnitOfOrgUnit</rightwardType>
         <leftCardinality>
             <min>0</min>
         </leftCardinality>
         <rightCardinality>
             <min>0</min>
         </rightCardinality>
         <copyToLeft>true</copyToLeft>
     </type>
  • Create the following metadata fields in relationship-formats.xml (can also be done though the UI):
     <dc-type>
         <schema>relation</schema>
         <element>isDepartmentOfDivision</element>
     </dc-type>
     <dc-type>
         <schema>relation</schema>
         <element>isDivisionOfDepartment</element>
     </dc-type>
     <dc-type>
         <schema>relation</schema>
         <element>isOrgUnitOfOrgUnit</element>
     </dc-type>
  • Verify that there are 2 separate sections for the first relationship type: a isDepartmentOfDivision section & isDivisionOfDepartment section
  • Verify that for the isOrgUnitOfOrgUnit only one section is shown
  • Verify that you can't see the item you are on anymore in the list of suggested items

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.

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've tested this today with the instructions you've provided & found no obvious issues. I've also verified everything fixed in #3060 appears to still be working.

@tdonohue tdonohue merged commit f7a14a1 into DSpace:main Jun 11, 2024
13 checks passed
@alexandrevryghem alexandrevryghem deleted the w2p-113560_edit-item-add-relationships-one-by-one_contribute-main branch June 12, 2024 23:05
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
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants