diff --git a/src/app/shared/search/item-export/item-export.service.ts b/src/app/shared/search/item-export/item-export.service.ts index b574be2dd85..3c5d595b2cc 100644 --- a/src/app/shared/search/item-export/item-export.service.ts +++ b/src/app/shared/search/item-export/item-export.service.ts @@ -102,4 +102,17 @@ export class ItemExportService { }; } + /** + * Get the UUID from a searchOptions + * @param searchOptions + */ + public getScopeUUID(searchOptions: SearchOptions): string { + if (searchOptions.fixedFilter) { + const fixedFilter = searchOptions.fixedFilter.split('='); + if (fixedFilter.length === 2 && fixedFilter[0] === 'scope') { + return fixedFilter[1]; + } + } + return null; + } } diff --git a/src/app/shared/search/item-export/item-export/item-export-list/item-export-list.component.ts b/src/app/shared/search/item-export/item-export/item-export-list/item-export-list.component.ts index e2d916638f1..d49362474d0 100644 --- a/src/app/shared/search/item-export/item-export/item-export-list/item-export-list.component.ts +++ b/src/app/shared/search/item-export/item-export/item-export-list/item-export-list.component.ts @@ -15,6 +15,8 @@ import { fadeIn } from '../../../../animations/fade'; import { PaginatedSearchOptions } from '../../../models/paginated-search-options.model'; import { UUIDService } from '../../../../../core/shared/uuid.service'; +import { ItemExportService } from '../../item-export.service'; + @Component({ selector: 'ds-item-export-list', templateUrl: './item-export-list.component.html', @@ -64,6 +66,7 @@ export class ItemExportListComponent implements OnInit { resultsRD$: BehaviorSubject>> = new BehaviorSubject(null); constructor( + protected itemExportService: ItemExportService, private paginationService: PaginationService, private searchManager: SearchManager, private uuidService: UUIDService) { @@ -74,6 +77,7 @@ export class ItemExportListComponent implements OnInit { this.currentPagination$ = this.paginationService.getCurrentPagination(this.initialPagination.id, this.initialPagination); this.currentPagination$.subscribe((paginationOptions: PaginationComponentOptions) => { this.searchOptions = Object.assign(new PaginatedSearchOptions({}), this.searchOptions, { + scope: this.itemExportService.getScopeUUID(this.searchOptions), fixedFilter: `f.entityType=${this.itemEntityType},equals`, pagination: paginationOptions }); diff --git a/src/app/shared/search/item-export/item-export/item-export.component.ts b/src/app/shared/search/item-export/item-export/item-export.component.ts index 6b7640ea148..c5f5f47ce3b 100644 --- a/src/app/shared/search/item-export/item-export/item-export.component.ts +++ b/src/app/shared/search/item-export/item-export/item-export.component.ts @@ -260,6 +260,7 @@ export class ItemExportComponent implements OnInit, OnDestroy { private canExport(): Observable { return this.searchManager.search( Object.assign(new PaginatedSearchOptions({}), this.searchOptions, { + scope: this.itemExportService.getScopeUUID(this.searchOptions), fixedFilter: `f.entityType=${this.itemType.label},equals`, pagination: Object.assign(new PaginationComponentOptions(), { id: this.uuidService.generate(),