mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-06 17:44:11 +00:00
Fix to set Edit Collection to utilize findAdminAuthorized instead of findSubmitAuthorized
This commit is contained in:
@@ -77,11 +77,11 @@ export class CollectionDataService extends ComColDataService<Collection> {
|
||||
* requested after the response becomes stale
|
||||
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which
|
||||
* {@link HALLink}s should be automatically resolved
|
||||
* @param searchHref The backend search endpoint to use (default to submit)
|
||||
* @return Observable<RemoteData<PaginatedList<Collection>>>
|
||||
* collection list
|
||||
*/
|
||||
getAuthorizedCollection(query: string, options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<Collection>[]): Observable<RemoteData<PaginatedList<Collection>>> {
|
||||
const searchHref = 'findSubmitAuthorized';
|
||||
getAuthorizedCollection(query: string, options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, searchHref: string = 'findSubmitAuthorized', ...linksToFollow: FollowLinkConfig<Collection>[]): Observable<RemoteData<PaginatedList<Collection>>> {
|
||||
options = Object.assign({}, options, {
|
||||
searchParams: [new RequestParam('query', query)],
|
||||
});
|
||||
|
@@ -144,6 +144,12 @@ export class CollectionDropdownComponent implements OnInit, OnDestroy {
|
||||
*/
|
||||
@Input() entityType: string;
|
||||
|
||||
/**
|
||||
* Search endpoint to use for finding authorized collections.
|
||||
* Defaults to 'findSubmitAuthorized', but can be overridden (e.g. to 'findAdminAuthorized')
|
||||
*/
|
||||
@Input() searchHref = 'findSubmitAuthorized';
|
||||
|
||||
/**
|
||||
* Emit to notify whether search is complete
|
||||
*/
|
||||
@@ -252,7 +258,7 @@ export class CollectionDropdownComponent implements OnInit, OnDestroy {
|
||||
followLink('parentCommunity'));
|
||||
} else {
|
||||
searchListService$ = this.collectionDataService
|
||||
.getAuthorizedCollection(query, findOptions, true, true, followLink('parentCommunity'));
|
||||
.getAuthorizedCollection(query, findOptions, true, true, this.searchHref, followLink('parentCommunity'));
|
||||
}
|
||||
this.searchListCollection$ = searchListService$.pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
|
@@ -83,5 +83,19 @@ describe('AuthorizedCollectionSelectorComponent', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when using searchHref', () => {
|
||||
it('should call getAuthorizedCollection with "findAdminAuthorized" when overridden', (done) => {
|
||||
component.searchHref = 'findAdminAuthorized';
|
||||
|
||||
component.search('', 1).subscribe(() => {
|
||||
expect(collectionService.getAuthorizedCollection).toHaveBeenCalledWith(
|
||||
'', jasmine.any(Object), true, false, 'findAdminAuthorized', jasmine.anything()
|
||||
);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
@@ -66,6 +66,12 @@ export class AuthorizedCollectionSelectorComponent extends DSOSelectorComponent
|
||||
*/
|
||||
@Input() entityType: string;
|
||||
|
||||
/**
|
||||
* Search endpoint to use for finding authorized collections.
|
||||
* Defaults to 'findSubmitAuthorized', but can be overridden (e.g. to 'findAdminAuthorized')
|
||||
*/
|
||||
@Input() searchHref = 'findSubmitAuthorized';
|
||||
|
||||
constructor(
|
||||
protected searchService: SearchService,
|
||||
protected collectionDataService: CollectionDataService,
|
||||
@@ -104,7 +110,7 @@ export class AuthorizedCollectionSelectorComponent extends DSOSelectorComponent
|
||||
findOptions);
|
||||
} else {
|
||||
searchListService$ = this.collectionDataService
|
||||
.getAuthorizedCollection(query, findOptions, useCache, false, followLink('parentCommunity'));
|
||||
.getAuthorizedCollection(query, findOptions, useCache, false, this.searchHref, followLink('parentCommunity'));
|
||||
}
|
||||
return searchListService$.pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
|
@@ -59,16 +59,13 @@ describe('AuthorizedCommunitySelectorComponent', () => {
|
||||
});
|
||||
|
||||
describe('search', () => {
|
||||
describe('when has no entity type', () => {
|
||||
it('should call getAuthorizedCommunity and return the authorized community in a SearchResult', (done) => {
|
||||
component.search('', 1).subscribe((resultRD) => {
|
||||
expect(communityService.getAuthorizedCommunity).toHaveBeenCalled();
|
||||
expect(resultRD.payload.page.length).toEqual(1);
|
||||
expect(resultRD.payload.page[0].indexableObject).toEqual(community);
|
||||
done();
|
||||
});
|
||||
it('should call getAuthorizedCommunity and return the authorized community in a SearchResult', (done) => {
|
||||
component.search('', 1).subscribe((resultRD) => {
|
||||
expect(communityService.getAuthorizedCommunity).toHaveBeenCalled();
|
||||
expect(resultRD.payload.page.length).toEqual(1);
|
||||
expect(resultRD.payload.page[0].indexableObject).toEqual(community);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
@@ -9,6 +9,7 @@
|
||||
}
|
||||
<ds-authorized-collection-selector [currentDSOId]="dsoRD?.payload.uuid"
|
||||
[types]="selectorTypes"
|
||||
searchHref="findAdminAuthorized"
|
||||
(onSelect)="selectObject($event)"></ds-authorized-collection-selector>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user