mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
[TLC-249] Fix circular dependency in browse services
This commit is contained in:
@@ -16,7 +16,6 @@ import { dataService } from '../data/base/data-service.decorator';
|
||||
import { getPaginatedListPayload, getRemoteDataPayload } from '../shared/operators';
|
||||
import { RequestParam } from '../cache/models/request-param.model';
|
||||
import { SearchData, SearchDataImpl } from '../data/base/search-data';
|
||||
import { BrowseService } from './browse.service';
|
||||
import { distinctUntilChanged, map, startWith } from 'rxjs/operators';
|
||||
import { isEmpty, isNotEmpty } from '../../shared/empty.util';
|
||||
|
||||
@@ -31,6 +30,19 @@ export class BrowseDefinitionDataService extends IdentifiableDataService<BrowseD
|
||||
private findAllData: FindAllDataImpl<BrowseDefinition>;
|
||||
private searchData: SearchDataImpl<BrowseDefinition>;
|
||||
|
||||
public static toSearchKeyArray(metadataKey: string): string[] {
|
||||
const keyParts = metadataKey.split('.');
|
||||
const searchFor = [];
|
||||
searchFor.push('*');
|
||||
for (let i = 0; i < keyParts.length - 1; i++) {
|
||||
const prevParts = keyParts.slice(0, i + 1);
|
||||
const nextPart = [...prevParts, '*'].join('.');
|
||||
searchFor.push(nextPart);
|
||||
}
|
||||
searchFor.push(metadataKey);
|
||||
return searchFor;
|
||||
}
|
||||
|
||||
constructor(
|
||||
protected requestService: RequestService,
|
||||
protected rdbService: RemoteDataBuildService,
|
||||
@@ -122,7 +134,7 @@ export class BrowseDefinitionDataService extends IdentifiableDataService<BrowseD
|
||||
findByFields(metadataKeys: string[]): Observable<BrowseDefinition> {
|
||||
let searchKeyArray: string[] = [];
|
||||
metadataKeys.forEach((metadataKey) => {
|
||||
searchKeyArray = searchKeyArray.concat(BrowseService.toSearchKeyArray(metadataKey));
|
||||
searchKeyArray = searchKeyArray.concat(BrowseDefinitionDataService.toSearchKeyArray(metadataKey));
|
||||
});
|
||||
return this.findAll().pipe(
|
||||
getRemoteDataPayload(),
|
||||
|
@@ -19,9 +19,9 @@ import {
|
||||
} from '../shared/operators';
|
||||
import { URLCombiner } from '../url-combiner/url-combiner';
|
||||
import { BrowseEntrySearchOptions } from './browse-entry-search-options.model';
|
||||
import { BrowseDefinitionDataService } from './browse-definition-data.service';
|
||||
import { HrefOnlyDataService } from '../data/href-only-data.service';
|
||||
import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { BrowseDefinitionDataService } from './browse-definition-data.service';
|
||||
|
||||
|
||||
export const BROWSE_LINKS_TO_FOLLOW: FollowLinkConfig<BrowseEntry | Item>[] = [
|
||||
|
Reference in New Issue
Block a user