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

Administrative Item Edit #362

Merged
merged 22 commits into from Mar 1, 2019

Conversation

Projects
None yet
4 participants
@LotteHofstede
Copy link
Contributor

LotteHofstede commented Feb 21, 2019

This PR depends on #355.
This PR closes #363.

When logged on as an administrator, a user can now edit an item's metadata.

The edit metadata page can be found at [dspace-url]/items/[item-uuid]/edit/metadata.

On this page you will be able to add, delete and edit metadata fields. The changes you make will be stored in the ngrx store - even if you don't immediately save them - and will be available as long as you don't refresh the page.

Add

To add a new metadata field, click the large green + Add button at the top of the page. A new (green) row will be added to the metadata table which you can edit.

Remove

To remove an existing metadata field, click the red trash icon in the last column of the field you would like to remove. The row of the field you removed will turn red.
You can't edit or remove an already removed field.

Edit

To edit an existing metadata field, click the blue edit icon in the last column of the field you would like to edit. All fields will turn into an input field which you can edit. Whenever you make an actual change, the row will turn orange.
This edit button will only be when the field is not in edit mode.

Close edit mode

To close edit mode and display a field without the input fields, click the green check icon.
This check button will only be available when the field is in edit mode.

Discard changes of a single field

To undo all changes made to a single field, click the orange undo icon in the last column of the field to which changes were made.
An added field will disappear, a removed or editted field will lose its red/orange background color and reset to its initial value.
Note that the undo icon will only be enabled when there are changes to undo.

Discard all changes to all fields

To discard all changes you made, click the orange 'Discard' button at the top of the page.
This will immediately remove all current changes.
When clicking the discard button, you will be shown a notification stating that you discarded all changes, but that you can still undo this by clicking the Undo button at the top of the page.*
When clicking the undo button at the top of the page, all your changes will be reinstated.
When you don't click the Undobutton, your changes will be permanently removed when the notification disappears.

Note that you can only use the Discard button when you made actual changes to the metadata.
The Undo button will only be available when there are changes to undo and the notification is still present.

Save

To save all the changes you made to the item, click the save button. This will send an actual request to the backend and update the item.
The save button will only be enabled when there are changes to save.

MetadataField input - Help & Validation

To make sure you cannot enter invalid data, validation was added to the MetadataField input field.
When entering something into this field, a dropdown with metadata fields - that match your input - will be shown from which you can choose.
If the user still enters a non-existing or invalid metadata field, an error message will be shown and you will not be able to save your changes.

General clean up / refactoring

I got rid of al the occurrences of TNormalized in the DataServices (and the RemoteDataBuildService). Each TDomain has a single TNormalized, so carrying around both seemed unnecessary. In my opinion this makes the DataServices and RemoteDataBuildService easier to understand and maintain.

*) Note that ideally we would have liked this Undo button to be part of the notification, but because of #357 this is not possible yet.

LotteHofstede added some commits Jan 25, 2019

Merge branch 'delete-communities-and-collections' into w2p-59334_edit…
…-item-metadata-branch

Conflicts:
	src/app/+community-page/community-page.component.ts
	src/app/+item-page/edit-item-page/item-delete/item-delete.component.spec.ts
	src/app/+item-page/edit-item-page/item-delete/item-delete.component.ts
	src/app/+item-page/edit-item-page/item-private/item-private.component.ts
	src/app/+item-page/edit-item-page/item-public/item-public.component.spec.ts
	src/app/+item-page/edit-item-page/item-public/item-public.component.ts
	src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.spec.ts
	src/app/+item-page/edit-item-page/item-reinstate/item-reinstate.component.ts
	src/app/+item-page/edit-item-page/item-withdraw/item-withdraw.component.spec.ts
	src/app/+item-page/edit-item-page/item-withdraw/item-withdraw.component.ts
	src/app/+item-page/edit-item-page/simple-item-action/abstract-simple-item-action.component.spec.ts
	src/app/core/auth/server-auth.service.ts
	src/app/core/cache/response.models.ts
	src/app/core/data/item-data.service.spec.ts
	src/app/core/data/item-data.service.ts
	src/app/core/data/request.models.ts
	src/app/core/index/index.effects.ts
	src/app/core/metadata/metadata.service.spec.ts
	src/app/core/shared/operators.spec.ts
	src/app/header/header.component.spec.ts
	src/app/shared/form/form.component.ts

@artlowel artlowel changed the title Edit item metadata Administrative Item Edit Feb 21, 2019

LotteHofstede added some commits Feb 25, 2019

Merge branch 'master' into w2p-59334_edit-item-metadata-branch
Conflicts:
	src/app/+community-page/community-page.component.ts
	src/app/core/auth/server-auth.service.ts
	src/app/core/data/dso-response-parsing.service.ts
	src/app/core/data/item-data.service.ts
	src/app/core/data/metadata-schema-data.service.ts
	src/app/core/data/request.models.ts
	src/app/core/metadata/metadata.service.spec.ts
	src/app/core/metadata/normalized-metadata-schema.model.ts
	src/app/core/shared/metadatum.model.ts
	src/app/core/shared/operators.spec.ts
	src/app/shared/shared.module.ts
@paulo-graca
Copy link

paulo-graca left a comment

Overall, this is PR it's ok by me. I just have minor change suggestions.

One strange thing that happed with me... when I was first testing this PR, the changes I made to metadata it only be visible at DB layer, I had to do a page refresh after saving to see those changes. But this stopped occuring and I couldn't replicate it anymore.

@tdonohue
Copy link
Member

tdonohue left a comment

@LotteHofstede : I gave this a thorough review and test today. It's honestly looking great overall. Thank you so much for all the detailed TypeDocs & inline comments! Thank you also for the refactoring work -- I agree it's much easier to understand now. That said, I did add a few (minor) inline comments that I'd like addressed.

With regards to testing, the functionality works great! I like the overall design & look and feel. I only had one minor usability issue that I encountered:

  • If I edit one or more fields, and then click the "Discard" button, the notification and the "Undo" button appear (to undo my discard). But, both the notification & "Undo" button seem to appear very briefly (maybe for ~5 seconds), and then they disappear. I suspect we may want both of these to appear for a longer period of time (at least the Undo button should). For me, I felt like I barely had enough time to read the notification and then the Undo button was already gone.

I don't see that as a major bug that warrants fixing immediately. But, I think it is a usability issue, and we should log it as a known bug, if we decide not to fix it in this PR.

So, overall, I think this is great work 👍 . I'd be in favor of merging this once the outstanding comments (from @paulo-graca and I) are all addressed.

LotteHofstede added some commits Mar 1, 2019

@LotteHofstede

This comment has been minimized.

Copy link
Contributor Author

LotteHofstede commented Mar 1, 2019

@tdonohue and @paulo-graca Thanks for your feedback. I added the missing TypeDoc, fixed the typo and made sure the notification and Undo-button now show for 10 seconds. I also made this timeout easily configurable in the environment configuration.

@paulo-graca
Copy link

paulo-graca left a comment

👍 thank you @LotteHofstede for adding the fixes!

@tdonohue
Copy link
Member

tdonohue left a comment

👍 Looks great now. Thanks @LotteHofstede for the quick updates, and for making the notification timeout configurable (which seems like a good addition here). As this is now at +2, I'll go ahead and merge it.

@tdonohue tdonohue merged commit cebea75 into DSpace:master Mar 1, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.3%) to 78.526%
Details

@wafflebot wafflebot bot removed the needs review label Mar 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.