#674 fix community and collection thumblogo

This commit is contained in:
Dániel Péter Sipos
2020-10-28 16:01:26 +01:00
parent 0d8049494f
commit 0ea105c73e
3 changed files with 8 additions and 4 deletions

View File

@@ -18,6 +18,7 @@ import { SearchService } from '../core/shared/search/search.service';
import { currentPath } from '../shared/utils/route.utils'; import { currentPath } from '../shared/utils/route.utils';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Context } from '../core/shared/context.model'; import { Context } from '../core/shared/context.model';
import { followLink } from '../shared/utils/follow-link-config.model';
@Component({ @Component({
selector: 'ds-search', selector: 'ds-search',
@@ -122,8 +123,9 @@ export class SearchComponent implements OnInit {
this.searchLink = this.getSearchLink(); this.searchLink = this.getSearchLink();
this.searchOptions$ = this.getSearchOptions(); this.searchOptions$ = this.getSearchOptions();
this.sub = this.searchOptions$.pipe( this.sub = this.searchOptions$.pipe(
switchMap((options) => this.service.search(options).pipe(getSucceededRemoteData(), startWith(undefined)))) switchMap((options) => this.service.search(options, null, followLink('logo')).pipe(getSucceededRemoteData(), startWith(undefined))))
.subscribe((results) => { .subscribe((results) => {
console.log('result', results)
this.resultsRD$.next(results); this.resultsRD$.next(results);
}); });
this.scopeListRD$ = this.searchConfigService.getCurrentScope('').pipe( this.scopeListRD$ = this.searchConfigService.getCurrentScope('').pipe(

View File

@@ -27,7 +27,7 @@ export class LinkService {
*/ */
public resolveLinks<T extends HALResource>(model: T, ...linksToFollow: Array<FollowLinkConfig<T>>): T { public resolveLinks<T extends HALResource>(model: T, ...linksToFollow: Array<FollowLinkConfig<T>>): T {
linksToFollow.forEach((linkToFollow: FollowLinkConfig<T>) => { linksToFollow.forEach((linkToFollow: FollowLinkConfig<T>) => {
this.resolveLink(model, linkToFollow); this.resolveLink(model, linkToFollow);
}); });
return model; return model;
} }
@@ -39,10 +39,12 @@ export class LinkService {
* @param linkToFollow the {@link FollowLinkConfig} to resolve * @param linkToFollow the {@link FollowLinkConfig} to resolve
*/ */
public resolveLink<T extends HALResource>(model, linkToFollow: FollowLinkConfig<T>): T { public resolveLink<T extends HALResource>(model, linkToFollow: FollowLinkConfig<T>): T {
console.log('model', model, 'links', linkToFollow)
const matchingLinkDef = getLinkDefinition(model.constructor, linkToFollow.name); const matchingLinkDef = getLinkDefinition(model.constructor, linkToFollow.name);
if (hasNoValue(matchingLinkDef)) { if (hasNoValue(matchingLinkDef)) {
throw new Error(`followLink('${linkToFollow.name}') was used for a ${model.constructor.name}, but there is no property on ${model.constructor.name} models with an @link() for ${linkToFollow.name}`); console.error(`followLink('${linkToFollow.name}') was used for a ${model.constructor.name}, but there is no property on ${model.constructor.name} models with an @link() for ${linkToFollow.name}`);
return model;
} else { } else {
const provider = getDataServiceFor(matchingLinkDef.resourceType); const provider = getDataServiceFor(matchingLinkDef.resourceType);

View File

@@ -33,7 +33,7 @@ export class GridThumbnailComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.src$ = new BehaviorSubject<string>(this.defaultImage); this.src$ = new BehaviorSubject<string>(this.defaultImage);
console.log('this.thumbnail', this.thumbnail); // console.log('this.thumbnail', this.thumbnail);
if (isObservable(this.thumbnail)) { if (isObservable(this.thumbnail)) {
this.thumbnail.subscribe((thumbnailRD) => { this.thumbnail.subscribe((thumbnailRD) => {
this.checkThumbnail(thumbnailRD.payload); this.checkThumbnail(thumbnailRD.payload);