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

Edit collection item template #749

Merged
merged 39 commits into from Jul 2, 2020

Conversation

Atmire-Kristof
Copy link
Contributor

@Atmire-Kristof Atmire-Kristof commented Jul 2, 2020

References

This PR closes #662

Description

This PR adds the ability to edit the template item of collections.
This PR is something we created a while back, but was never completely finished due to the reduced priority of the item template feature. However, this PR fixes issue #662, so we'd like to contribute this now.

Instructions for Reviewers

Changes made:

  • Added ItemTemplateDataService
  • Added EditItemTemplatePageComponent at route /collection/${collection-uuid}/itemtemplate. This page displays the metadata of the collection's template item and the ability to edit them (similar to edit metadata of a regular item, it uses the same child component)
  • Added template item section on top of the edit metadata page of a collection. When no template item is present yet, an "Add" button is displayed. Clicking this button will create a template item and redirect the user to the edit page. When a template item is present, an "Edit" and "Delete" button will be displayed.

How to test:

  • Go to a collection's edit page
  • Create a new template item and edit some of its metadata
  • Go back to the collection's edit page, it should now show an "Edit" and "Delete" button
  • Clicking "Edit" should bring you back to the edit metadata page of the template item
  • Clicking "Delete" should delete the template item
  • Starting a new submission in a collection that contains a template item should fill in the metadata from the template item automatically into the new submission. But that doesn't work at the moment: Collection template item metadata not used in the submission UI #748. That's unrelated to this PR

Checklist

This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome). If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!

  • 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 TSLint validation using yarn run lint
  • 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 for any bug fixes, improvements or new features. A few reminders about what constitutes good tests:
    • Include tests for different user types (if behavior differs), including: (1) Anonymous user, (2) Logged in user (non-admin), and (3) Administrator.
    • Include tests for error scenarios, e.g. when errors/warnings should appear (or buttons should be disabled).
    • For bug fixes, include a test that reproduces the bug and proves it is fixed. For clarity, it may be useful to provide the test in a separate commit from the bug fix.
  • If my PR includes new, third-party dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.

Conflicts:
	resources/i18n/en.json5
	src/app/+collection-page/collection-page-routing.module.ts
	src/app/+collection-page/collection-page.module.ts
	src/app/core/core.module.ts
	src/app/core/data/data.service.ts
	src/app/shared/shared.module.ts
Conflicts:
	resources/i18n/en.json5
	src/app/+collection-page/collection-page.module.ts
	src/app/+collection-page/edit-collection-page/collection-metadata/collection-metadata.component.html
	src/app/+collection-page/edit-collection-page/collection-metadata/collection-metadata.component.spec.ts
	src/app/+collection-page/edit-collection-page/collection-metadata/collection-metadata.component.ts
	src/app/core/core.module.ts
	src/app/core/data/data.service.ts
	src/app/shared/shared.module.ts
… keep them stored in the object-updates store
Conflicts:
	src/app/+collection-page/collection-page-routing.module.ts
	src/app/+item-page/edit-item-page/abstract-item-update/abstract-item-update.component.ts
	src/app/+item-page/edit-item-page/edit-item-page.module.ts
	src/app/+item-page/edit-item-page/item-metadata/item-metadata.component.ts
	src/app/core/cache/server-sync-buffer.effects.ts
	src/app/core/core.module.ts
	src/app/core/data/data.service.ts
	src/app/core/data/dso-change-analyzer.service.ts
	src/app/core/data/object-updates/object-updates.service.ts
Conflicts:
	src/app/+collection-page/edit-collection-page/collection-metadata/collection-metadata.component.spec.ts
	src/app/+item-page/edit-item-page/abstract-item-update/abstract-item-update.component.ts
	src/app/+item-page/edit-item-page/edit-item-page.module.ts
	src/app/+item-page/edit-item-page/item-metadata/item-metadata.component.ts
	src/app/core/core.module.ts
	src/app/core/data/data.service.ts
Conflicts:
	src/app/core/auth/auth-request.service.ts
	src/app/core/core.module.ts
@lgtm-com
Copy link

lgtm-com bot commented Jul 2, 2020

This pull request introduces 3 alerts and fixes 7 when merging b77fd69 into 2fe9965 - view on LGTM.com

new alerts:

  • 3 for Unused variable, import, function or class

fixed alerts:

  • 7 for Unused variable, import, function or class

@lgtm-com
Copy link

lgtm-com bot commented Jul 2, 2020

This pull request fixes 10 alerts when merging 92e47de into 2fe9965 - view on LGTM.com

fixed alerts:

  • 10 for Unused variable, import, function or class

@tdonohue tdonohue added this to Needs Reviewers Assigned in DSpace 7 Beta 3 via automation Jul 2, 2020
@tdonohue tdonohue added this to the 7.0beta3 milestone Jul 2, 2020
@tdonohue tdonohue moved this from Needs Reviewers Assigned to Under Review in DSpace 7 Beta 3 Jul 2, 2020
@tdonohue tdonohue self-requested a review July 2, 2020 14:13
@tdonohue tdonohue added the 1 APPROVAL pull request only requires a single approval to merge label Jul 2, 2020
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.

👍 Looks good to me. I've tested and this both fixes #662 and adds in Item Template functionality. The Item Template functionality works as described, though there are two known bugs (already created): #750 (which is referenced by TODOs in the code) and #748 (which is out of scope for this PR)

DSpace 7 Beta 3 automation moved this from Under Review to Reviewer approved Jul 2, 2020
@tdonohue tdonohue merged commit b731301 into DSpace:master Jul 2, 2020
DSpace 7 Beta 3 automation moved this from Reviewer approved to Done Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 APPROVAL pull request only requires a single approval to merge bug high priority
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Edit item's metadata doesn't work
3 participants