mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-16 14:33:03 +00:00
Retrieve entries url from vocabulary's link
This commit is contained in:
@@ -112,7 +112,7 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
|
||||
* Return an observable that emits created HREF
|
||||
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
|
||||
*/
|
||||
protected buildHrefFromFindOptions(href: string, options: FindListOptions, extraArgs: string[] = [], ...linksToFollow: Array<FollowLinkConfig<T>>): string {
|
||||
public buildHrefFromFindOptions(href: string, options: FindListOptions, extraArgs: string[] = [], ...linksToFollow: Array<FollowLinkConfig<T>>): string {
|
||||
let args = [...extraArgs];
|
||||
|
||||
if (hasValue(options.currentPage) && typeof options.currentPage === 'number') {
|
||||
|
@@ -187,6 +187,7 @@ describe('VocabularyService', () => {
|
||||
const paginatedListEntries = new PaginatedList(pageInfo, arrayEntries);
|
||||
const childrenPaginatedList = new PaginatedList(pageInfo, childrenEntries);
|
||||
const vocabularyRD = createSuccessfulRemoteDataObject(vocabulary);
|
||||
const vocabularyRD$ = createSuccessfulRemoteDataObject$(vocabulary);
|
||||
const vocabularyEntriesRD = createSuccessfulRemoteDataObject$(paginatedListEntries);
|
||||
const vocabularyEntryDetailParentRD = createSuccessfulRemoteDataObject(vocabularyEntryParentDetail);
|
||||
const vocabularyEntryChildrenRD = createSuccessfulRemoteDataObject(childrenPaginatedList);
|
||||
@@ -342,9 +343,11 @@ describe('VocabularyService', () => {
|
||||
rdbService = getMockRemoteDataBuildService(undefined, vocabularyEntriesRD);
|
||||
spyOn(rdbService, 'toRemoteDataObservable').and.callThrough();
|
||||
service = initTestService();
|
||||
spyOn(service, 'findVocabularyById').and.returnValue(vocabularyRD$);
|
||||
});
|
||||
|
||||
describe('getVocabularyEntries', () => {
|
||||
|
||||
it('should configure a new VocabularyEntriesRequest', () => {
|
||||
const expected = new VocabularyEntriesRequest(requestService.generateRequestId(), entriesRequestURL);
|
||||
|
||||
@@ -363,6 +366,7 @@ describe('VocabularyService', () => {
|
||||
});
|
||||
|
||||
describe('getVocabularyEntriesByValue', () => {
|
||||
|
||||
it('should configure a new VocabularyEntriesRequest', () => {
|
||||
const expected = new VocabularyEntriesRequest(requestService.generateRequestId(), entriesByValueRequestURL);
|
||||
|
||||
@@ -382,6 +386,7 @@ describe('VocabularyService', () => {
|
||||
});
|
||||
|
||||
describe('getVocabularyEntryByValue', () => {
|
||||
|
||||
it('should configure a new VocabularyEntriesRequest', () => {
|
||||
const expected = new VocabularyEntriesRequest(requestService.generateRequestId(), entryByValueRequestURL);
|
||||
|
||||
|
@@ -26,6 +26,7 @@ import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../../shared/empty.
|
||||
import {
|
||||
configureRequest,
|
||||
filterSuccessfulResponses,
|
||||
getFirstSucceededRemoteDataPayload,
|
||||
getFirstSucceededRemoteListPayload,
|
||||
getRequestFromRequestHref
|
||||
} from '../../shared/operators';
|
||||
@@ -158,11 +159,13 @@ export class VocabularyService {
|
||||
pageInfo.currentPage
|
||||
);
|
||||
|
||||
return this.vocabularyDataService.getFindAllHref(options, `${vocabularyOptions.name}/entries`).pipe(
|
||||
return this.findVocabularyById(vocabularyOptions.name).pipe(
|
||||
getFirstSucceededRemoteDataPayload(),
|
||||
map((vocabulary: Vocabulary) => this.vocabularyDataService.buildHrefFromFindOptions(vocabulary._links.entries.href, options)),
|
||||
isNotEmptyOperator(),
|
||||
distinctUntilChanged(),
|
||||
getVocabularyEntriesFor(this.requestService, this.rdbService)
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -185,11 +188,13 @@ export class VocabularyService {
|
||||
pageInfo.currentPage
|
||||
);
|
||||
|
||||
return this.vocabularyDataService.getFindAllHref(options, `${vocabularyOptions.name}/entries`).pipe(
|
||||
return this.findVocabularyById(vocabularyOptions.name).pipe(
|
||||
getFirstSucceededRemoteDataPayload(),
|
||||
map((vocabulary: Vocabulary) => this.vocabularyDataService.buildHrefFromFindOptions(vocabulary._links.entries.href, options)),
|
||||
isNotEmptyOperator(),
|
||||
distinctUntilChanged(),
|
||||
getVocabularyEntriesFor(this.requestService, this.rdbService)
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -233,7 +238,9 @@ export class VocabularyService {
|
||||
pageInfo.currentPage
|
||||
);
|
||||
|
||||
return this.vocabularyDataService.getFindAllHref(options, `${vocabularyOptions.name}/entries`).pipe(
|
||||
return this.findVocabularyById(vocabularyOptions.name).pipe(
|
||||
getFirstSucceededRemoteDataPayload(),
|
||||
map((vocabulary: Vocabulary) => this.vocabularyDataService.buildHrefFromFindOptions(vocabulary._links.entries.href, options)),
|
||||
isNotEmptyOperator(),
|
||||
distinctUntilChanged(),
|
||||
getVocabularyEntriesFor(this.requestService, this.rdbService),
|
||||
|
Reference in New Issue
Block a user