diff --git a/src/app/core/data/relationship.service.spec.ts b/src/app/core/data/relationship.service.spec.ts index 387593d609..38a3183cac 100644 --- a/src/app/core/data/relationship.service.spec.ts +++ b/src/app/core/data/relationship.service.spec.ts @@ -121,6 +121,8 @@ describe('RelationshipService', () => { findByHref: createSuccessfulRemoteDataObject$(relatedItems[0]) }); + const appConfig = Object.assign({browseBy: {showThumbnails: true}}) + function initTestService() { return new RelationshipService( itemService, @@ -133,6 +135,7 @@ describe('RelationshipService', () => { null, null, null, + appConfig, jasmine.createSpy('paginatedRelationsToItems').and.returnValue((v) => v), ); } @@ -210,8 +213,8 @@ describe('RelationshipService', () => { mockOptions, true, true, - followLink('leftItem'), - followLink('rightItem'), + followLink('leftItem',{}, followLink('thumbnail')), + followLink('rightItem',{}, followLink('thumbnail')), followLink('relationshipType') ); done(); diff --git a/src/app/core/data/relationship.service.ts b/src/app/core/data/relationship.service.ts index 4594e17a11..7d339352d9 100644 --- a/src/app/core/data/relationship.service.ts +++ b/src/app/core/data/relationship.service.ts @@ -46,6 +46,7 @@ import { sendRequest } from '../shared/request.operators'; import { RestRequest } from './rest-request.model'; import { CoreState } from '../core-state.model'; import { FindListOptions } from './find-list-options.model'; +import { APP_CONFIG, AppConfig } from '../../../config/app-config.interface'; const relationshipListsStateSelector = (state: AppState) => state.relationshipLists; @@ -89,6 +90,7 @@ export class RelationshipService extends DataService { protected http: HttpClient, protected comparator: DefaultChangeAnalyzer, protected appStore: Store, + @Inject(APP_CONFIG) private appConfig: AppConfig, @Inject(PAGINATED_RELATIONS_TO_ITEMS_OPERATOR) private paginatedRelationsToItems: (thisId: string) => (source: Observable>>) => Observable>>) { super(); } @@ -183,7 +185,7 @@ export class RelationshipService extends DataService { ]).pipe( filter(([existsInOC, existsInRC]) => !existsInOC && !existsInRC), take(1), - ).subscribe(() => this.itemService.findByHref(item._links.self.href, false)); + ).subscribe(() => this.itemService.findByHref(item._links.self.href, false, true, followLink('thumbnail'))); } /** @@ -256,7 +258,16 @@ export class RelationshipService extends DataService { * @param options */ getRelatedItemsByLabel(item: Item, label: string, options?: FindListOptions): Observable>> { - return this.getItemRelationshipsByLabel(item, label, options, true, true, followLink('leftItem'), followLink('rightItem'), followLink('relationshipType')).pipe(this.paginatedRelationsToItems(item.uuid)); + let linksToFollow: FollowLinkConfig[]; + if (this.appConfig.browseBy.showThumbnails) { + linksToFollow = [ + followLink('leftItem',{}, followLink('thumbnail')), + followLink('rightItem',{}, followLink('thumbnail')), + followLink('relationshipType') ]; + } else { + linksToFollow = [followLink('leftItem'), followLink('rightItem'), followLink('relationshipType')]; + } + return this.getItemRelationshipsByLabel(item, label, options, true, true, ...linksToFollow).pipe(this.paginatedRelationsToItems(item.uuid)); } /** diff --git a/src/app/entity-groups/research-entities/item-pages/org-unit/org-unit.component.html b/src/app/entity-groups/research-entities/item-pages/org-unit/org-unit.component.html index ff4bc4d226..0ce9823ce6 100644 --- a/src/app/entity-groups/research-entities/item-pages/org-unit/org-unit.component.html +++ b/src/app/entity-groups/research-entities/item-pages/org-unit/org-unit.component.html @@ -36,7 +36,7 @@ [label]="'orgunit.page.id'"> -
+
-
+
-->
-
+
-
+