Commits
jonas-atmire authored a45bc349cc8
490 490 | } |
491 491 | |
492 492 | /** |
493 493 | * Cancel the form and return to the previous page |
494 494 | */ |
495 495 | onCancel() { |
496 496 | this.navigateToItemEditBitstreams(); |
497 497 | } |
498 498 | |
499 499 | /** |
500 - | * When the item ID is present, navigate back to the item's edit bitstreams page, otherwise go back to the previous |
501 - | * page the user came from |
500 + | * When the item ID is present, navigate back to the item's edit bitstreams page, |
501 + | * otherwise retrieve the item ID based on the owning bundle's link |
502 502 | */ |
503 503 | navigateToItemEditBitstreams() { |
504 504 | if (hasValue(this.itemId)) { |
505 505 | this.router.navigate([getItemEditRoute(this.itemId), 'bitstreams']); |
506 506 | } else { |
507 507 | this.bitstream.bundle.pipe(getFirstSucceededRemoteDataPayload(), |
508 508 | mergeMap((bundle: Bundle) => bundle.item.pipe(getFirstSucceededRemoteDataPayload(), map((item: Item) => item.uuid)))) |
509 509 | .subscribe((item) => { |
510 510 | this.router.navigate(([getItemEditRoute(item), 'bitstreams'])); |
511 511 | }); |