From d2fe3c9822a4ce94eadb41f9a8c93a530b0e4849 Mon Sep 17 00:00:00 2001 From: minottic Date: Tue, 13 Dec 2022 18:39:46 +0100 Subject: [PATCH] Avoid returning thumbnail when on the dashboard --- src/app/dashboard/dashboard.component.ts | 10 +++++++--- src/app/datasource.service.ts | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index 01c2426c..658713a3 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -40,12 +40,14 @@ export class DashboardComponent { { name: "creator", icon: "group", sort: true, inList: true }, { name: "doi", icon: "label", sort: true, inList: true }, ]; + itemFields = {thumbnail: false}; params: any = this.datasourceService.queryParams( this.itemsPerPage, this.currentPage, this.sortColumn, - this.sortDirection + this.sortDirection, + this.itemFields, ); publications$: Observable< PublishedData[] @@ -72,7 +74,8 @@ export class DashboardComponent { this.itemsPerPage, this.currentPage, this.sortColumn, - this.sortDirection + this.sortDirection, + this.itemFields, ); this.publications$ = this.datasourceService.getPublications(this.params); } @@ -85,7 +88,8 @@ export class DashboardComponent { this.itemsPerPage, this.currentPage, this.sortColumn, - this.sortDirection + this.sortDirection, + this.itemFields, ); this.publications$ = this.datasourceService.getPublications(this.params); } diff --git a/src/app/datasource.service.ts b/src/app/datasource.service.ts index 5816ce34..e56ce768 100644 --- a/src/app/datasource.service.ts +++ b/src/app/datasource.service.ts @@ -36,13 +36,15 @@ export class DatasourceService { itemsPerPage: number, currentPage: number, sortColumn: string, - sortDirection: string + sortDirection: string, + itemFields: Partial<{[key in keyof PublishedData]: boolean}> ): string { return this.appConfig.directMongoAccess ? JSON.stringify({ order: sortColumn + " " + sortDirection, skip: itemsPerPage * currentPage, limit: itemsPerPage, + fields: itemFields, }) : "(" + "skip=" + @@ -53,6 +55,8 @@ export class DatasourceService { sortColumn + ",sortDirection=" + sortDirection + + ",excludeFields=" + + Object.keys(itemFields).filter(k => !itemFields[k]).join("|") + ")"; } }