Added embedThumbnail to FindListOptions.

This commit is contained in:
Michael Spalti
2022-09-16 10:07:00 -07:00
parent 7b47c22531
commit ccfa1410c2
4 changed files with 5 additions and 8 deletions

View File

@@ -11,4 +11,5 @@ export class FindListOptions {
sort?: SortOptions;
searchParams?: RequestParam[];
startsWith?: string;
embedThumbnail?: boolean;
}

View File

@@ -122,8 +122,6 @@ describe('RelationshipDataService', () => {
findByHref: createSuccessfulRemoteDataObject$(relatedItems[0])
});
const appConfig = Object.assign({browseBy: {showThumbnails: true}});
function initTestService() {
return new RelationshipDataService(
requestService,
@@ -132,7 +130,6 @@ describe('RelationshipDataService', () => {
objectCache,
itemService,
null,
appConfig,
jasmine.createSpy('paginatedRelationsToItems').and.returnValue((v) => v),
);
}
@@ -149,7 +146,7 @@ describe('RelationshipDataService', () => {
});
describe('composition', () => {
const initService = () => new RelationshipDataService(null, null, null, null, null, null, null, null);
const initService = () => new RelationshipDataService(null, null, null, null, null, null, null);
testSearchDataImplementation(initService);
});
@@ -205,6 +202,7 @@ describe('RelationshipDataService', () => {
});
it('should call getItemRelationshipsByLabel with the correct params', (done) => {
mockOptions = Object.assign(mockOptions, { embedThumbnail: true });
service.getRelatedItemsByLabel(
mockItem,
mockLabel,

View File

@@ -41,7 +41,6 @@ import { RequestEntryState } from './request-entry-state.model';
import { sendRequest } from '../shared/request.operators';
import { RestRequest } from './rest-request.model';
import { FindListOptions } from './find-list-options.model';
import { APP_CONFIG, AppConfig } from '../../../config/app-config.interface';
import { SearchData, SearchDataImpl } from './base/search-data';
import { PutData, PutDataImpl } from './base/put-data';
import { IdentifiableDataService } from './base/identifiable-data.service';
@@ -86,7 +85,6 @@ export class RelationshipDataService extends IdentifiableDataService<Relationshi
protected objectCache: ObjectCacheService,
protected itemService: ItemDataService,
protected appStore: Store<AppState>,
@Inject(APP_CONFIG) private appConfig: AppConfig,
@Inject(PAGINATED_RELATIONS_TO_ITEMS_OPERATOR) private paginatedRelationsToItems: (thisId: string) => (source: Observable<RemoteData<PaginatedList<Relationship>>>) => Observable<RemoteData<PaginatedList<Item>>>,
) {
super('relationships', requestService, rdbService, objectCache, halService, 15 * 60 * 1000);
@@ -261,7 +259,7 @@ export class RelationshipDataService extends IdentifiableDataService<Relationshi
*/
getRelatedItemsByLabel(item: Item, label: string, options?: FindListOptions): Observable<RemoteData<PaginatedList<Item>>> {
let linksToFollow: FollowLinkConfig<Relationship>[];
if (this.appConfig.browseBy.showThumbnails) {
if (options.embedThumbnail) {
linksToFollow = [
followLink('leftItem',{}, followLink('thumbnail')),
followLink('rightItem',{}, followLink('thumbnail')),

View File

@@ -70,6 +70,6 @@ export class RelatedItemsComponent extends AbstractIncrementalListComponent<Obse
* @param page The page to fetch
*/
getPage(page: number): Observable<RemoteData<PaginatedList<Item>>> {
return this.relationshipService.getRelatedItemsByLabel(this.parentItem, this.relationType, Object.assign(this.options, { elementsPerPage: this.incrementBy, currentPage: page }));
return this.relationshipService.getRelatedItemsByLabel(this.parentItem, this.relationType, Object.assign(this.options, { elementsPerPage: this.incrementBy, currentPage: page, embedThumbnail: true }));
}
}