Skip to content

Commit c058850

Browse files
committed
Re-factored code for display of bitstreams in FileSection Component.
1 parent 8cbb852 commit c058850

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

src/app/item-page/simple/field-components/file-section/file-section.component.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ export class FileSectionComponent implements OnInit {
151151
getFirstCompletedRemoteData(),
152152
).subscribe((bitstreamsRD: RemoteData<PaginatedList<Bitstream>>) => {
153153
if (bitstreamsRD.errorMessage) {
154+
console.log('Error retrieving ORIGINAL bitstreams:', bitstreamsRD.errorMessage);
154155
this.notificationsService.error(this.translateService.get('file-section.error.header'), `${bitstreamsRD.statusCode} ${bitstreamsRD.errorMessage}`);
155156
} else if (hasValue(bitstreamsRD.payload)) {
156157
const current: Bitstream[] = this.bitstreams$.getValue();
@@ -161,26 +162,30 @@ export class FileSectionComponent implements OnInit {
161162
this.bitstreams$.next([...current, ...bitstreamsRD.payload.page]);
162163
this.isLoading = false;
163164
this.isLastPage = this.currentPage === bitstreamsRD.payload.totalPages;
165+
} else {
166+
this.isLoading = false;
167+
}
164168
// Now subscribe to license$
165169
license$.pipe(
166170
getFirstCompletedRemoteData(),
167171
).subscribe((licenseRD: RemoteData<PaginatedList<Bitstream>>) => {
168172
if (licenseRD.errorMessage) {
173+
console.log('Error retrieving CC-LICENSE bitstreams:', licenseRD.errorMessage);
169174
this.notificationsService.error(this.translateService.get('file-section.error.header'), `${licenseRD.statusCode} ${licenseRD.errorMessage}`);
170175
} else if (hasValue(licenseRD.payload)) {
171176
const updated: Bitstream[] = this.bitstreams$.getValue();
172177
// For debugging.
173-
// licenseRD.payload.page.forEach(bitstream => {
174-
// console.log('Bitstream:', bitstream);
175-
// });
178+
licenseRD.payload.page.forEach(bitstream => {
179+
console.log('Bitstream:', bitstream);
180+
});
176181
this.bitstreams$.next([...updated, ...licenseRD.payload.page]);
177182
}
178183
this.isLoading = false;
179184
});
180185

181-
} else {
182-
this.isLoading = false;
183-
}
186+
// } else {
187+
// this.isLoading = false;
188+
// }
184189
});
185190
}
186191
}

0 commit comments

Comments
 (0)