mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +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 { getPaginatedListPayload, getRemoteDataPayload } from '../shared/operators';
|
||||||
import { RequestParam } from '../cache/models/request-param.model';
|
import { RequestParam } from '../cache/models/request-param.model';
|
||||||
import { SearchData, SearchDataImpl } from '../data/base/search-data';
|
import { SearchData, SearchDataImpl } from '../data/base/search-data';
|
||||||
import { BrowseService } from './browse.service';
|
|
||||||
import { distinctUntilChanged, map, startWith } from 'rxjs/operators';
|
import { distinctUntilChanged, map, startWith } from 'rxjs/operators';
|
||||||
import { isEmpty, isNotEmpty } from '../../shared/empty.util';
|
import { isEmpty, isNotEmpty } from '../../shared/empty.util';
|
||||||
|
|
||||||
@@ -31,6 +30,19 @@ export class BrowseDefinitionDataService extends IdentifiableDataService<BrowseD
|
|||||||
private findAllData: FindAllDataImpl<BrowseDefinition>;
|
private findAllData: FindAllDataImpl<BrowseDefinition>;
|
||||||
private searchData: SearchDataImpl<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(
|
constructor(
|
||||||
protected requestService: RequestService,
|
protected requestService: RequestService,
|
||||||
protected rdbService: RemoteDataBuildService,
|
protected rdbService: RemoteDataBuildService,
|
||||||
@@ -122,7 +134,7 @@ export class BrowseDefinitionDataService extends IdentifiableDataService<BrowseD
|
|||||||
findByFields(metadataKeys: string[]): Observable<BrowseDefinition> {
|
findByFields(metadataKeys: string[]): Observable<BrowseDefinition> {
|
||||||
let searchKeyArray: string[] = [];
|
let searchKeyArray: string[] = [];
|
||||||
metadataKeys.forEach((metadataKey) => {
|
metadataKeys.forEach((metadataKey) => {
|
||||||
searchKeyArray = searchKeyArray.concat(BrowseService.toSearchKeyArray(metadataKey));
|
searchKeyArray = searchKeyArray.concat(BrowseDefinitionDataService.toSearchKeyArray(metadataKey));
|
||||||
});
|
});
|
||||||
return this.findAll().pipe(
|
return this.findAll().pipe(
|
||||||
getRemoteDataPayload(),
|
getRemoteDataPayload(),
|
||||||
|
@@ -19,9 +19,9 @@ import {
|
|||||||
} from '../shared/operators';
|
} from '../shared/operators';
|
||||||
import { URLCombiner } from '../url-combiner/url-combiner';
|
import { URLCombiner } from '../url-combiner/url-combiner';
|
||||||
import { BrowseEntrySearchOptions } from './browse-entry-search-options.model';
|
import { BrowseEntrySearchOptions } from './browse-entry-search-options.model';
|
||||||
import { BrowseDefinitionDataService } from './browse-definition-data.service';
|
|
||||||
import { HrefOnlyDataService } from '../data/href-only-data.service';
|
import { HrefOnlyDataService } from '../data/href-only-data.service';
|
||||||
import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
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>[] = [
|
export const BROWSE_LINKS_TO_FOLLOW: FollowLinkConfig<BrowseEntry | Item>[] = [
|
||||||
|
Reference in New Issue
Block a user