Skip to content

Commit

Permalink
Fix missing scope parameter issue
Browse files Browse the repository at this point in the history
  • Loading branch information
oye816 committed May 7, 2024
1 parent a77762a commit cf633de
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/app/shared/search/item-export/item-export.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -64,6 +66,7 @@ export class ItemExportListComponent implements OnInit {
resultsRD$: BehaviorSubject<RemoteData<SearchObjects<DSpaceObject>>> = new BehaviorSubject(null);

constructor(
protected itemExportService: ItemExportService,
private paginationService: PaginationService,
private searchManager: SearchManager,
private uuidService: UUIDService) {
Expand All @@ -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
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ export class ItemExportComponent implements OnInit, OnDestroy {
private canExport(): Observable<boolean> {
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(),
Expand Down

0 comments on commit cf633de

Please sign in to comment.