-
Notifications
You must be signed in to change notification settings - Fork 437
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
Create new Item Version (basic Items only) #1318
Conversation
…laced with modal, minor fixes
…story (call to REST service TBD) and other fixes
…eanup, added modal for new versions
…ge and other fixes
This pull request introduces 2 alerts when merging cf1c73b into 706cc47 - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging b1b2bd4 into 706cc47 - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a big improvement in usability. Thanks @davidenegretti-4science!
I think this can be merged as soon as the test issues are fixed
@davidenegretti-4science : I'll give this a test today as well. But, I wanted to highlight that this PR is currently failing code coverage, as the coverage drops by -0.54%.... This is a sign that you have too few tests, and that there likely are entire classes with no tests. If you can add more tests to this PR, that'll help get the code coverage back up to where it needs to be to pass. UPDATE: After glancing at the code, it looks to me like nearly all your new service methods don't have corresponding tests. Adding those should bring code coverage back up. You don't need 100% coverage, but currently you are only at 37% in this PR, and you should be more at 70% at least. |
@tdonohue I managed to make the coverage test pass but I won't be able to add more tests today, I can increase the coverage tomorrow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidenegretti-4science and @atarix83 : I tested this today, and it works well.
That said, there are a lot of missing specs here. I see you both improved coverage a bit (this PR now has ~45% coverage... see the "codecov/patch" check results). However, the rest of main
has 75% coverage...so, once we merge this, we'll decrease coverage slightly.
While the decrease in overall coverage isn't significant, I'd still like to see this PR get it's coverage increased into more like a 70% range....especially since I see a lot of new methods which are missing specs in this PR. I've called them out via inline comments below. (A lot of these methods are key functionality in this PR, so they really need specs.)
Overall, I'm +1 this PR. But, I'd like specs added, as they'll help us maintain this code better. Once specs are added, this can be immediately merged. Thanks!
* Invalidate the cache of the item | ||
* @param itemUUID | ||
*/ | ||
invalidateItemCache(itemUUID: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New method missing specs
* @param itemHref the item for which create a new version | ||
* @param summary the summary of the new version | ||
*/ | ||
createVersion(itemHref: string, summary: string): Observable<RemoteData<Version>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the changes in this service are missing specs. So, there's around 8 new methods here that have no tests.
/** | ||
* Open a modal that allows to create a new version starting from the specified item, with optional summary | ||
*/ | ||
onCreateNewVersion(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new method appears to be missing specs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed (specs added)
src/app/shared/item/item-versions/item-versions-shared.service.ts
Outdated
Show resolved
Hide resolved
src/app/shared/item/item-versions/item-versions-shared.service.ts
Outdated
Show resolved
Hide resolved
src/app/shared/item/item-versions/item-versions-shared.service.ts
Outdated
Show resolved
Hide resolved
/** | ||
* Applies changes to version currently being edited | ||
*/ | ||
onSummarySubmit() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New method is missing specs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed (specs added)
* Delete the item and get the result of the operation | ||
* @param item | ||
*/ | ||
deleteItemAndGetResult$(item: Item): Observable<boolean> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New method is missing specs
* @param version the version to be deleted | ||
* @param redirectToLatest force the redirect to the latest version in the history | ||
*/ | ||
deleteVersion(version: Version, redirectToLatest: boolean): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New method is missing specs
* Creates a new version starting from the specified one | ||
* @param version the version from which a new one will be created | ||
*/ | ||
createNewVersion(version: Version) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New method is missing specs
# Conflicts: # src/app/item-page/item-page-routing.module.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidenegretti-4science : Thanks for adding more tests. It's now at a more reasonable 55% test coverage (which isn't 70% but it's better). So, I'm going to approve this and merge as we don't have time to wait for more tests. Please, in the future, do your best to add tests as you go & not wait until all code is completed to go back and add your tests/specs.
That all said, honestly, thank you immensely for your hard work on this new feature. I think the user experience is great & it all works well.
Thank you @tdonohue |
DSC-983 counters component main
References
Description
This feature allows to manage item versions. A new version can be created from item's page, and all versions can be managed (create, delete, edit summary) from the "Version History" tab in "Edit Item" page.
Instructions for Reviewers
List of changes in this PR:
Item's public page
Version's page
/items/version/:versionID
has been addedVersion History table
Authorization features
canCreateVersion
canEditVersion
canDeleteVersion
Data services
VersionHistoryDataService
Tests
All tests are still TBD
Checklist
yarn run lint
package.json
), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.