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

Duplicate data from an existing Item to a new WorskpaceItem, aka clone/copy item #3076

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MMilosz
Copy link

@MMilosz MMilosz commented May 24, 2024

References

Description

This PR introduces the ability to create a new WorkspaceItem by reusing properties from an existing Item, kind of like how versioning works now, but resulting in a partially completed edit form of a new Item. Some existing code from the versioning infrastructure was adapted and integrated as two new methods, copy and clone, within the ItemService, and tweaked, just to make things work more smoothly.

Here's a preview:

dspace_clone_item_feat.mp4

Instructions for Reviewers

As my REST PR introduces a change in the existing endpoint, pressing the clone button will not work without the REST PR.

On the Angular side:

  • Login as admin and either deposit a new item or locate an existing one.
  • Navigate to the item management page (edit -> status).
  • Between move and delete, a new button should be visible for cloning the item. Click it, select any collection, then click save.
  • The browser should redirect the user to the edit form, similar to what happens after creating a new item. However, most of the metadata should be copied from the previous item.

On the REST side:

Example request (endpoint, header, body):

POST /api/submission/workspaceitems?owningCollection=:collectionUuid
Content-Type: text/uri-list

http://localhost:8080/server/api/core/items/:itemUuid

Response should show a new WorkspaceItem with some of the metadata copied from the specified :itemUuid. Although some of the metadata will be omitted to prevent duplicates or multiple values in places they shouldn't occur – see nonCopyableMetadataFields in core-services.xml.

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.

@MMilosz MMilosz marked this pull request as ready for review May 27, 2024 11:25
@tdonohue tdonohue added component: administrative tools Related to the admin menu or tools component: Item (Archived) Item display or editing new feature labels May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: administrative tools Related to the admin menu or tools component: Item (Archived) Item display or editing new feature
Projects
Status: 🙋 Needs Reviewers Assigned
Development

Successfully merging this pull request may close these issues.

Copying existing item
2 participants