mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
55693: Map tab excludes already mapped items
This commit is contained in:
@@ -19,6 +19,7 @@ import { RestResponse } from '../../core/cache/response-cache.models';
|
|||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { CollectionDataService } from '../../core/data/collection-data.service';
|
import { CollectionDataService } from '../../core/data/collection-data.service';
|
||||||
import { Item } from '../../core/shared/item.model';
|
import { Item } from '../../core/shared/item.model';
|
||||||
|
import { hasValue, isNotEmpty } from '../../shared/empty.util';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-collection-item-mapper',
|
selector: 'ds-collection-item-mapper',
|
||||||
@@ -98,9 +99,8 @@ export class CollectionItemMapperComponent implements OnInit {
|
|||||||
);
|
);
|
||||||
this.mappingItemsRD$ = collectionAndOptions$.pipe(
|
this.mappingItemsRD$ = collectionAndOptions$.pipe(
|
||||||
switchMap(([collectionRD, options]) => {
|
switchMap(([collectionRD, options]) => {
|
||||||
return this.searchService.search(Object.assign(options, {
|
return this.searchService.search(Object.assign(new PaginatedSearchOptions(options), {
|
||||||
// TODO: Exclude items already mapped to collection without overwriting search query
|
query: this.buildQuery(collectionRD.payload.id, options.query),
|
||||||
// query: `-location.coll:\"${collectionRD.payload.id}\"`,
|
|
||||||
scope: undefined,
|
scope: undefined,
|
||||||
dsoType: DSpaceObjectType.ITEM,
|
dsoType: DSpaceObjectType.ITEM,
|
||||||
sort: this.defaultSortOptions
|
sort: this.defaultSortOptions
|
||||||
@@ -175,4 +175,13 @@ export class CollectionItemMapperComponent implements OnInit {
|
|||||||
return this.router.url;
|
return this.router.url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildQuery(collectionId: string, query: string): string {
|
||||||
|
const excludeColQuery = `-location.coll:\"${collectionId}\"`;
|
||||||
|
if (isNotEmpty(query)) {
|
||||||
|
return `${excludeColQuery} AND ${query}`;
|
||||||
|
} else {
|
||||||
|
return excludeColQuery;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user