Skip to content

[Port dspace-8_x] Edit bitstream page refactor #4103

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

Draft
wants to merge 17 commits into
base: dspace-8_x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ng-container *ngVar="(bitstreamRD$ | async) as bitstreamRD">
<div class="container">
<div class="row" *ngIf="bitstreamRD?.hasSucceeded">
<div class="row" *ngIf="bitstreamRD?.hasSucceeded && (isLoading$ | async) === false">
<div class="col-md-2">
<ds-thumbnail [thumbnail]="bitstreamRD?.payload"></ds-thumbnail>
</div>
Expand All @@ -27,7 +27,7 @@ <h1 class="h2">{{dsoNameService.getName(bitstreamRD?.payload)}} <span class="tex
</div>
</div>
<ds-error *ngIf="bitstreamRD?.hasFailed" message="{{'error.bitstream' | translate}}"></ds-error>
<ds-loading *ngIf="!bitstreamRD || bitstreamRD?.isLoading"
<ds-loading *ngIf="!bitstreamRD || bitstreamRD?.isLoading || (isLoading$ | async)"
message="{{'loading.bitstream' | translate}}"></ds-loading>
</div>
</ng-container>
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ describe('EditBitstreamPageComponent', () => {

bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', {
findAll: createSuccessfulRemoteDataObject$(createPaginatedList(allFormats)),
findByHref: createSuccessfulRemoteDataObject$(selectedFormat),
});

notificationsService = jasmine.createSpyObj('notificationsService',
Expand Down Expand Up @@ -161,6 +162,7 @@ describe('EditBitstreamPageComponent', () => {
});

describe('EditBitstreamPageComponent no IIIF fields', () => {
const dsoNameServiceReturnValue = 'ORIGINAL';

beforeEach(waitForAsync(() => {
bundle = {
Expand All @@ -176,7 +178,6 @@ describe('EditBitstreamPageComponent', () => {
},
})),
};
const bundleName = 'ORIGINAL';

bitstream = Object.assign(new Bitstream(), {
uuid: bitstreamID,
Expand All @@ -196,6 +197,7 @@ describe('EditBitstreamPageComponent', () => {
format: createSuccessfulRemoteDataObject$(selectedFormat),
_links: {
self: 'bitstream-selflink',
format: 'format-link',
},
bundle: createSuccessfulRemoteDataObject$(bundle),
});
Expand All @@ -209,9 +211,10 @@ describe('EditBitstreamPageComponent', () => {
});
bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', {
findAll: createSuccessfulRemoteDataObject$(createPaginatedList(allFormats)),
findByHref: createSuccessfulRemoteDataObject$(selectedFormat),
});
dsoNameService = jasmine.createSpyObj('dsoNameService', {
getName: bundleName,
getName: dsoNameServiceReturnValue,
});

TestBed.configureTestingModule({
Expand Down Expand Up @@ -253,7 +256,7 @@ describe('EditBitstreamPageComponent', () => {
});

it('should fill in the bitstream\'s title', () => {
expect(rawForm.fileNamePrimaryContainer.fileName).toEqual(bitstream.name);
expect(rawForm.fileNamePrimaryContainer.fileName).toEqual(dsoNameServiceReturnValue);
});

it('should fill in the bitstream\'s description', () => {
Expand Down Expand Up @@ -432,7 +435,7 @@ describe('EditBitstreamPageComponent', () => {
});
describe('when navigateToItemEditBitstreams is called', () => {
it('should redirect to the item edit page on the bitstreams tab with the itemId from the component', () => {
comp.itemId = 'some-uuid1';
comp.item.uuid = 'some-uuid1';
comp.navigateToItemEditBitstreams();
expect(router.navigate).toHaveBeenCalledWith([getEntityEditRoute(null, 'some-uuid1'), 'bitstreams']);
});
Expand Down Expand Up @@ -481,6 +484,7 @@ describe('EditBitstreamPageComponent', () => {
format: createSuccessfulRemoteDataObject$(allFormats[1]),
_links: {
self: 'bitstream-selflink',
format: 'format-link',
},
bundle: createSuccessfulRemoteDataObject$({
_links: {
Expand Down Expand Up @@ -605,6 +609,7 @@ describe('EditBitstreamPageComponent', () => {
format: createSuccessfulRemoteDataObject$(allFormats[2]),
_links: {
self: 'bitstream-selflink',
format: 'format-link',
},
bundle: createSuccessfulRemoteDataObject$({
_links: {
Expand Down
Loading
Loading