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

Item relations edit delete #402

Merged
merged 29 commits into from
Sep 5, 2019

Conversation

Atmire-Kristof
Copy link
Contributor

This PR adds the possibility to remove relationships from an item.

UI

A new tab labeled “Item Relationships” has been added to the item edit page (under sub-route /relationships)
The content of this tab functions much like the “Item Metadata” tab, except it is limited to deleting relationships (no adding or editing yet).

Relationships are also displayed as lists of items instead of a table, separated by relationship type.

Selecting items by clicking the trash bin icon will mark them with a red background.

Clicking “save” will remove the item relationships, display a notification stating the removal was successful (or an error notification for each failed delete request) and eventually reload the lists of relationships.

The other options (such as undo or discard) function the exact same way as it does on the edit item metadata page.

Code changes

A notable code change that was made in this PR is a new abstract item-update component, which contains all the shared code between item-metadata and item-relationships. This is to avoid code duplication between the two components (and open for expansion).

Copy link
Contributor

@paulo-graca paulo-graca 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 @Atmire-Kristof for adding this important feature! The basic feature is implemented but there are some issues regarding this implementation, like when you remove a relationship, the related item is still displayed. Or, on a specific Entity page (author, for instance) the related items listing nor the
Now showing 1 - 10 of 215 is updated. You need to refresh the page to reload all components.

<ng-container *ngVar="(updates$ | async) as updates">
<div *ngIf="updates">
<h5>{{getRelationshipMessageKey(relationshipLabel) | translate}}</h5>
<ng-container *ngVar="(updates | dsObjectValues) as updateValues">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Atmire-Kristof! I found out If you try to edit a Person entity that has more than 20 related items, not all of them are showed. I think we need some kind of paging for each entity type.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @paulo-graca
I would like to handle that use case in a separate PR as it will be dependent on DSpace/DSpace#2450

Once that's in master, we can use paging per relationship type, which would be important for this functionality. This can also be used for item display pages once merged

* Sends a new remove update for this field to the object updates service
*/
remove(): void {
this.objectUpdatesService.saveRemoveFieldUpdate(this.url, this.item);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just after removing the relationship, the related item still appears in the "Items relationships" tab. And you can even try to repeat the same action (you will get an error -
2019-06-18 12_21_29-Item Edit - Relationships
).
You need to switch to any other tab and then go back to Items relationships tab in order to be updated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @paulo-graca
This was apparently caused by some updates in master from REST
Kristof has solved these errors now, and I was able to use delete relationships

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thank you @benbosman! I will perform some more tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @benbosman and @Atmire-Kristof , that fix that issue.
But just after removing that relationship, that item is still showed as a part of Works associated with that Person.
2019-07-01 17_00_40-dev5 rcaap pt_items_3f685bbd-07d9-403e-9de2-b8f0fabe27a7

and you click on that entry, you will see that the item is no longer related:
2019-07-01 17_00_56-dev5 rcaap pt_items_8e4314ca-2f60-4b0d-aa1f-48acb9aee6ed

It seems to me that is a caching issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @paulo-graca
I've asked Kristof to verify it in detail, it seems that no new REST discovery is created for displaying the item page. The discovery cache would need to be invalidated here.

Do you know how this is handled for other situations where the discovery cache has to be invalidated (e.g. a new item is submitted, item metadata has been edited, …)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was indeed a caching issue. This should be fixed now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thank you @Atmire-Kristof and @benbosman! I will perform another test.

@paulo-graca
Copy link
Contributor

I'm sorry but I still see the related items in the list just after delete the relationship between them.
Also, and perhaps this is another issue (not specifically related with this PR), my CPU reach top levels of 90% when I'm loading the page with relations.

Conflicts:
	src/app/+item-page/simple/item-types/shared/item-relationships-utils.ts
@paulo-graca
Copy link
Contributor

my CPU reach top levels of 90% when I'm loading the page with relations

I think this: #458 might be related with what I'm experiencing.

Conflicts:
	resources/i18n/en.json
	src/app/+item-page/edit-item-page/item-metadata/item-metadata.component.ts
	src/app/+search-page/search-service/search.service.ts
	src/app/core/core.module.ts
	src/app/core/shared/item.model.ts
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.

👍 I've reviewed the code and tested this today. It works as expected. However, I didn't test for large numbers of relationships (i.e. the prior performance issues mentioned above). As discussed in yesterday's Entities Meeting, we felt the performance issues are less specific to this PR, and should therefore be handled separately in #458

So, I'm fine with merging this as-is. Performance issues seem more general, and should be in a separate PR.

Copy link
Contributor

@paulo-graca paulo-graca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave a second look to the code and I don't have any code suggestions. 👍 Thank you @Atmire-Kristof !

On our last entities meeting (https://wiki.duraspace.org/display/DSPACE/2019-09-03+DSpace+7+Entities+WG+Meeting) I noted that the process took you almost 5 minutes to complete in your video. There are performance and scalability issues and the usage will be unsustainable on my point of view. I've been reporting some issues that might address these performance issues:
https://jira.duraspace.org/browse/DS-4335
https://jira.duraspace.org/browse/DS-4248
or #458

@benbosman benbosman merged commit c4c6de6 into DSpace:master Sep 5, 2019
@benbosman
Copy link
Member

@paulo-graca Thanks for the analysis on the performance, we'll also verify these tickets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants