Redirecting to item edit page on the bitstream tab, instead of the item viewing page

This commit is contained in:
jonas-atmire
2020-09-30 13:04:34 +02:00
parent 5de774842d
commit aa757cfe23
2 changed files with 10 additions and 10 deletions

View File

@@ -239,17 +239,17 @@ describe('EditBitstreamPageComponent', () => {
}); });
}); });
describe('when navigateToItemEditBitstreams is called, and the component has an itemId', () => { describe('when navigateToItemEditBitstreams is called, and the component has an itemId', () => {
it('should redirect to the item edit path bitstream page', () => { it('should redirect to the item edit page on the bitstreams tab with the itemId from the component', () => {
comp.itemId = 'some-uuid' comp.itemId = 'some-uuid1'
comp.navigateToItemEditBitstreams();
expect(routerStub.navigate).toHaveBeenCalledWith([getItemEditRoute('some-uuid1'), 'bitstreams']);
});
});
describe('when navigateToItemEditBitstreams is called, and the component does not have an itemId', () => {
it('should redirect to the item edit page on the bitstreams tab with the itemId from the bundle links ', () => {
comp.itemId = undefined;
comp.navigateToItemEditBitstreams(); comp.navigateToItemEditBitstreams();
expect(routerStub.navigate).toHaveBeenCalledWith([getItemEditRoute('some-uuid'), 'bitstreams']); expect(routerStub.navigate).toHaveBeenCalledWith([getItemEditRoute('some-uuid'), 'bitstreams']);
}); });
}); });
describe('when navigateToItemEditBitstreams is called, and the component does not have an itemId', () => {
it('should redirect to the item page', () => {
comp.itemId = undefined;
comp.navigateToItemEditBitstreams();
expect(routerStub.navigate).toHaveBeenCalledWith([getItemPageRoute('some-uuid')]);
});
});
}); });

View File

@@ -507,7 +507,7 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
this.bitstream.bundle.pipe(getFirstSucceededRemoteDataPayload(), this.bitstream.bundle.pipe(getFirstSucceededRemoteDataPayload(),
mergeMap((bundle: Bundle) => bundle.item.pipe(getFirstSucceededRemoteDataPayload(), map((item: Item) => item.uuid)))) mergeMap((bundle: Bundle) => bundle.item.pipe(getFirstSucceededRemoteDataPayload(), map((item: Item) => item.uuid))))
.subscribe((item) => { .subscribe((item) => {
this.router.navigate(([getItemPageRoute(item)])); this.router.navigate(([getItemEditRoute(item), 'bitstreams']));
}); });
} }
} }