-
+
diff --git a/src/app/shared/object-list/my-dspace-result-list-element/pool-search-result/pool-search-result-list-element.component.spec.ts b/src/app/shared/object-list/my-dspace-result-list-element/pool-search-result/pool-search-result-list-element.component.spec.ts
index ab5652138e..0e5b2eaa6f 100644
--- a/src/app/shared/object-list/my-dspace-result-list-element/pool-search-result/pool-search-result-list-element.component.spec.ts
+++ b/src/app/shared/object-list/my-dspace-result-list-element/pool-search-result/pool-search-result-list-element.component.spec.ts
@@ -110,6 +110,7 @@ describe('PoolSearchResultListElementComponent', () => {
jasmine.objectContaining({ name: 'action' })
);
expect(component.workflowitem$.value).toEqual(workflowitem);
+ expect(component.item$.value).toEqual(item);
}));
it('should have properly status', () => {
diff --git a/src/app/shared/object-list/my-dspace-result-list-element/pool-search-result/pool-search-result-list-element.component.ts b/src/app/shared/object-list/my-dspace-result-list-element/pool-search-result/pool-search-result-list-element.component.ts
index a42b3d04d6..046763eb98 100644
--- a/src/app/shared/object-list/my-dspace-result-list-element/pool-search-result/pool-search-result-list-element.component.ts
+++ b/src/app/shared/object-list/my-dspace-result-list-element/pool-search-result/pool-search-result-list-element.component.ts
@@ -1,6 +1,7 @@
import { Component, Inject, OnDestroy, OnInit } from '@angular/core';
-import { BehaviorSubject, Observable } from 'rxjs';
+import { BehaviorSubject, EMPTY, Observable } from 'rxjs';
+import { mergeMap, tap } from 'rxjs/operators';
import { ViewMode } from '../../../../core/shared/view-mode.model';
import { RemoteData } from '../../../../core/data/remote-data';
@@ -21,6 +22,8 @@ import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
import { APP_CONFIG, AppConfig } from '../../../../../config/app-config.interface';
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
+import { Item } from '../../../../core/shared/item.model';
+import { isNotEmpty } from '../../../empty.util';
/**
* This component renders pool task object for the search result in the list view.
@@ -44,6 +47,11 @@ export class PoolSearchResultListElementComponent extends SearchResultListElemen
*/
public status = MyDspaceItemStatusType.WAITING_CONTROLLER;
+ /**
+ * The item object that belonging to the result object
+ */
+ public item$: BehaviorSubject
- = new BehaviorSubject
- (null);
+
/**
* The workflowitem object that belonging to the result object
*/
@@ -75,15 +83,29 @@ export class PoolSearchResultListElementComponent extends SearchResultListElemen
ngOnInit() {
super.ngOnInit();
this.linkService.resolveLinks(this.dso, followLink('workflowitem', {},
- followLink('item'), followLink('submitter')
+ followLink('item', {}, followLink('bundles')),
+ followLink('submitter')
), followLink('action'));
+
(this.dso.workflowitem as Observable>).pipe(
- getFirstCompletedRemoteData()
- ).subscribe((wfiRD: RemoteData) => {
- if (wfiRD.hasSucceeded) {
- this.workflowitem$.next(wfiRD.payload);
- }
- });
+ getFirstCompletedRemoteData(),
+ mergeMap((wfiRD: RemoteData) => {
+ if (wfiRD.hasSucceeded) {
+ this.workflowitem$.next(wfiRD.payload);
+ return (wfiRD.payload.item as Observable>).pipe(
+ getFirstCompletedRemoteData()
+ );
+ } else {
+ return EMPTY;
+ }
+ }),
+ tap((itemRD: RemoteData
- ) => {
+ if (isNotEmpty(itemRD) && itemRD.hasSucceeded) {
+ this.item$.next(itemRD.payload);
+ }
+ })
+ ).subscribe();
+
this.showThumbnails = this.appConfig.browseBy.showThumbnails;
}