mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-16 22:43: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
|
* Return an observable that emits created HREF
|
||||||
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
|
* @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];
|
let args = [...extraArgs];
|
||||||
|
|
||||||
if (hasValue(options.currentPage) && typeof options.currentPage === 'number') {
|
if (hasValue(options.currentPage) && typeof options.currentPage === 'number') {
|
||||||
|
@@ -187,6 +187,7 @@ describe('VocabularyService', () => {
|
|||||||
const paginatedListEntries = new PaginatedList(pageInfo, arrayEntries);
|
const paginatedListEntries = new PaginatedList(pageInfo, arrayEntries);
|
||||||
const childrenPaginatedList = new PaginatedList(pageInfo, childrenEntries);
|
const childrenPaginatedList = new PaginatedList(pageInfo, childrenEntries);
|
||||||
const vocabularyRD = createSuccessfulRemoteDataObject(vocabulary);
|
const vocabularyRD = createSuccessfulRemoteDataObject(vocabulary);
|
||||||
|
const vocabularyRD$ = createSuccessfulRemoteDataObject$(vocabulary);
|
||||||
const vocabularyEntriesRD = createSuccessfulRemoteDataObject$(paginatedListEntries);
|
const vocabularyEntriesRD = createSuccessfulRemoteDataObject$(paginatedListEntries);
|
||||||
const vocabularyEntryDetailParentRD = createSuccessfulRemoteDataObject(vocabularyEntryParentDetail);
|
const vocabularyEntryDetailParentRD = createSuccessfulRemoteDataObject(vocabularyEntryParentDetail);
|
||||||
const vocabularyEntryChildrenRD = createSuccessfulRemoteDataObject(childrenPaginatedList);
|
const vocabularyEntryChildrenRD = createSuccessfulRemoteDataObject(childrenPaginatedList);
|
||||||
@@ -342,9 +343,11 @@ describe('VocabularyService', () => {
|
|||||||
rdbService = getMockRemoteDataBuildService(undefined, vocabularyEntriesRD);
|
rdbService = getMockRemoteDataBuildService(undefined, vocabularyEntriesRD);
|
||||||
spyOn(rdbService, 'toRemoteDataObservable').and.callThrough();
|
spyOn(rdbService, 'toRemoteDataObservable').and.callThrough();
|
||||||
service = initTestService();
|
service = initTestService();
|
||||||
|
spyOn(service, 'findVocabularyById').and.returnValue(vocabularyRD$);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getVocabularyEntries', () => {
|
describe('getVocabularyEntries', () => {
|
||||||
|
|
||||||
it('should configure a new VocabularyEntriesRequest', () => {
|
it('should configure a new VocabularyEntriesRequest', () => {
|
||||||
const expected = new VocabularyEntriesRequest(requestService.generateRequestId(), entriesRequestURL);
|
const expected = new VocabularyEntriesRequest(requestService.generateRequestId(), entriesRequestURL);
|
||||||
|
|
||||||
@@ -363,6 +366,7 @@ describe('VocabularyService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('getVocabularyEntriesByValue', () => {
|
describe('getVocabularyEntriesByValue', () => {
|
||||||
|
|
||||||
it('should configure a new VocabularyEntriesRequest', () => {
|
it('should configure a new VocabularyEntriesRequest', () => {
|
||||||
const expected = new VocabularyEntriesRequest(requestService.generateRequestId(), entriesByValueRequestURL);
|
const expected = new VocabularyEntriesRequest(requestService.generateRequestId(), entriesByValueRequestURL);
|
||||||
|
|
||||||
@@ -382,6 +386,7 @@ describe('VocabularyService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('getVocabularyEntryByValue', () => {
|
describe('getVocabularyEntryByValue', () => {
|
||||||
|
|
||||||
it('should configure a new VocabularyEntriesRequest', () => {
|
it('should configure a new VocabularyEntriesRequest', () => {
|
||||||
const expected = new VocabularyEntriesRequest(requestService.generateRequestId(), entryByValueRequestURL);
|
const expected = new VocabularyEntriesRequest(requestService.generateRequestId(), entryByValueRequestURL);
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@ import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../../shared/empty.
|
|||||||
import {
|
import {
|
||||||
configureRequest,
|
configureRequest,
|
||||||
filterSuccessfulResponses,
|
filterSuccessfulResponses,
|
||||||
|
getFirstSucceededRemoteDataPayload,
|
||||||
getFirstSucceededRemoteListPayload,
|
getFirstSucceededRemoteListPayload,
|
||||||
getRequestFromRequestHref
|
getRequestFromRequestHref
|
||||||
} from '../../shared/operators';
|
} from '../../shared/operators';
|
||||||
@@ -158,11 +159,13 @@ export class VocabularyService {
|
|||||||
pageInfo.currentPage
|
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(),
|
isNotEmptyOperator(),
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
getVocabularyEntriesFor(this.requestService, this.rdbService)
|
getVocabularyEntriesFor(this.requestService, this.rdbService)
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -185,11 +188,13 @@ export class VocabularyService {
|
|||||||
pageInfo.currentPage
|
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(),
|
isNotEmptyOperator(),
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
getVocabularyEntriesFor(this.requestService, this.rdbService)
|
getVocabularyEntriesFor(this.requestService, this.rdbService)
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -233,7 +238,9 @@ export class VocabularyService {
|
|||||||
pageInfo.currentPage
|
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(),
|
isNotEmptyOperator(),
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
getVocabularyEntriesFor(this.requestService, this.rdbService),
|
getVocabularyEntriesFor(this.requestService, this.rdbService),
|
||||||
|
Reference in New Issue
Block a user