From 85101b5906c309e34ffd78ac59335bb897344428 Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Fri, 19 Apr 2019 14:07:13 +0200 Subject: [PATCH] 61947: atarix83 feedback changes 19-04-2019 --- .../+item-page/simple/item-page.component.ts | 6 +- .../journal-issue/journal-issue.component.ts | 8 +- .../journal-volume.component.ts | 8 +- .../item-types/journal/journal.component.ts | 8 +- .../item-types/orgunit/orgunit.component.ts | 8 +- .../item-types/person/person.component.ts | 8 +- .../item-types/project/project.component.ts | 8 +- .../publication/publication.component.ts | 10 +-- .../shared/item-relationships-utils.ts | 80 +++++++++++++++++++ .../item-types/shared/item.component.spec.ts | 7 +- .../item-types/shared/item.component.ts | 73 +---------------- .../metadata-representation-list.component.ts | 6 +- .../related-items/related-items-component.ts | 5 +- .../filtered-search-page.guard.ts | 8 +- .../search-filter.service.spec.ts | 72 ----------------- .../search-filter/search-filter.service.ts | 57 ------------- .../search-results.component.ts | 17 ++++ .../search-configuration.service.ts | 1 + src/app/shared/items/item-type-decorator.ts | 9 ++- .../item-type-switcher.component.spec.ts | 10 +-- .../item-list-element.component.ts | 4 +- .../journal-issue-list-element.component.ts | 5 +- .../journal-volume-list-element.component.ts | 5 +- .../journal/journal-list-element.component.ts | 5 +- .../orgunit/orgunit-list-element.component.ts | 5 +- .../person/person-list-element.component.ts | 5 +- .../person-metadata-list-element.component.ts | 5 +- .../project/project-list-element.component.ts | 5 +- .../publication-list-element.component.ts | 7 +- .../item-metadata-list-element.component.ts | 9 +-- ...in-text-metadata-list-element.component.ts | 7 +- ...em-search-result-list-element.component.ts | 4 +- 32 files changed, 181 insertions(+), 294 deletions(-) create mode 100644 src/app/+item-page/simple/item-types/shared/item-relationships-utils.ts diff --git a/src/app/+item-page/simple/item-page.component.ts b/src/app/+item-page/simple/item-page.component.ts index ac23add738..69487e7d40 100644 --- a/src/app/+item-page/simple/item-page.component.ts +++ b/src/app/+item-page/simple/item-page.component.ts @@ -13,9 +13,7 @@ import { MetadataService } from '../../core/metadata/metadata.service'; import { fadeInOut } from '../../shared/animations/fade'; import { hasValue } from '../../shared/empty.util'; -import * as viewMode from '../../shared/view-mode'; - -export const VIEW_MODE_FULL = 'full'; +import { ItemViewMode } from '../../shared/items/item-type-decorator'; /** * This component renders a simple item page. @@ -49,7 +47,7 @@ export class ItemPageComponent implements OnInit { /** * The view-mode we're currently on */ - viewMode = VIEW_MODE_FULL; + viewMode = ItemViewMode.Full; constructor( private route: ActivatedRoute, diff --git a/src/app/+item-page/simple/item-types/journal-issue/journal-issue.component.ts b/src/app/+item-page/simple/item-types/journal-issue/journal-issue.component.ts index 9240616c59..77ed54d67f 100644 --- a/src/app/+item-page/simple/item-types/journal-issue/journal-issue.component.ts +++ b/src/app/+item-page/simple/item-types/journal-issue/journal-issue.component.ts @@ -2,13 +2,13 @@ import { Component, Inject } from '@angular/core'; import { Observable } from 'rxjs'; import { ItemDataService } from '../../../../core/data/item-data.service'; import { Item } from '../../../../core/shared/item.model'; -import { rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component'; import { isNotEmpty } from '../../../../shared/empty.util'; -import { ItemComponent, filterRelationsByTypeLabel, relationsToItems } from '../shared/item.component'; -import { VIEW_MODE_FULL } from '../../item-page.component'; +import { ItemComponent } from '../shared/item.component'; +import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-relationships-utils'; -@rendersItemType('JournalIssue', VIEW_MODE_FULL) +@rendersItemType('JournalIssue', ItemViewMode.Full) @Component({ selector: 'ds-journal-issue', styleUrls: ['./journal-issue.component.scss'], diff --git a/src/app/+item-page/simple/item-types/journal-volume/journal-volume.component.ts b/src/app/+item-page/simple/item-types/journal-volume/journal-volume.component.ts index 0372fe5d30..616d96178a 100644 --- a/src/app/+item-page/simple/item-types/journal-volume/journal-volume.component.ts +++ b/src/app/+item-page/simple/item-types/journal-volume/journal-volume.component.ts @@ -2,13 +2,13 @@ import { Component, Inject } from '@angular/core'; import { Observable } from 'rxjs'; import { ItemDataService } from '../../../../core/data/item-data.service'; import { Item } from '../../../../core/shared/item.model'; -import { rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component'; import { isNotEmpty } from '../../../../shared/empty.util'; -import { ItemComponent, filterRelationsByTypeLabel, relationsToItems } from '../shared/item.component'; -import { VIEW_MODE_FULL } from '../../item-page.component'; +import { ItemComponent } from '../shared/item.component'; +import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-relationships-utils'; -@rendersItemType('JournalVolume', VIEW_MODE_FULL) +@rendersItemType('JournalVolume', ItemViewMode.Full) @Component({ selector: 'ds-journal-volume', styleUrls: ['./journal-volume.component.scss'], diff --git a/src/app/+item-page/simple/item-types/journal/journal.component.ts b/src/app/+item-page/simple/item-types/journal/journal.component.ts index 12ba91eb6b..0799f5c736 100644 --- a/src/app/+item-page/simple/item-types/journal/journal.component.ts +++ b/src/app/+item-page/simple/item-types/journal/journal.component.ts @@ -2,13 +2,13 @@ import { Component, Inject } from '@angular/core'; import { Observable } from 'rxjs'; import { ItemDataService } from '../../../../core/data/item-data.service'; import { Item } from '../../../../core/shared/item.model'; -import { rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component'; import { isNotEmpty } from '../../../../shared/empty.util'; -import { ItemComponent, filterRelationsByTypeLabel, relationsToItems } from '../shared/item.component'; -import { VIEW_MODE_FULL } from '../../item-page.component'; +import { ItemComponent } from '../shared/item.component'; +import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-relationships-utils'; -@rendersItemType('Journal', VIEW_MODE_FULL) +@rendersItemType('Journal', ItemViewMode.Full) @Component({ selector: 'ds-journal', styleUrls: ['./journal.component.scss'], diff --git a/src/app/+item-page/simple/item-types/orgunit/orgunit.component.ts b/src/app/+item-page/simple/item-types/orgunit/orgunit.component.ts index 1a6ab4ba36..96dc9a5960 100644 --- a/src/app/+item-page/simple/item-types/orgunit/orgunit.component.ts +++ b/src/app/+item-page/simple/item-types/orgunit/orgunit.component.ts @@ -2,13 +2,13 @@ import { Component, Inject, OnInit } from '@angular/core'; import { Observable } from 'rxjs'; import { ItemDataService } from '../../../../core/data/item-data.service'; import { Item } from '../../../../core/shared/item.model'; -import { rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component'; import { isNotEmpty } from '../../../../shared/empty.util'; -import { ItemComponent, filterRelationsByTypeLabel, relationsToItems } from '../shared/item.component'; -import { VIEW_MODE_FULL } from '../../item-page.component'; +import { ItemComponent } from '../shared/item.component'; +import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-relationships-utils'; -@rendersItemType('OrgUnit', VIEW_MODE_FULL) +@rendersItemType('OrgUnit', ItemViewMode.Full) @Component({ selector: 'ds-orgunit', styleUrls: ['./orgunit.component.scss'], diff --git a/src/app/+item-page/simple/item-types/person/person.component.ts b/src/app/+item-page/simple/item-types/person/person.component.ts index 3cf5a230bf..67a2ae7a2e 100644 --- a/src/app/+item-page/simple/item-types/person/person.component.ts +++ b/src/app/+item-page/simple/item-types/person/person.component.ts @@ -2,14 +2,14 @@ import { Component, Inject } from '@angular/core'; import { Observable , of as observableOf } from 'rxjs'; import { ItemDataService } from '../../../../core/data/item-data.service'; import { Item } from '../../../../core/shared/item.model'; -import { rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component'; import { SearchFixedFilterService } from '../../../../+search-page/search-filters/search-filter/search-fixed-filter.service'; import { isNotEmpty } from '../../../../shared/empty.util'; -import { ItemComponent, filterRelationsByTypeLabel, relationsToItems } from '../shared/item.component'; -import { VIEW_MODE_FULL } from '../../item-page.component'; +import { ItemComponent } from '../shared/item.component'; +import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-relationships-utils'; -@rendersItemType('Person', VIEW_MODE_FULL) +@rendersItemType('Person', ItemViewMode.Full) @Component({ selector: 'ds-person', styleUrls: ['./person.component.scss'], diff --git a/src/app/+item-page/simple/item-types/project/project.component.ts b/src/app/+item-page/simple/item-types/project/project.component.ts index 4bdb6012f2..cf4ffd4be1 100644 --- a/src/app/+item-page/simple/item-types/project/project.component.ts +++ b/src/app/+item-page/simple/item-types/project/project.component.ts @@ -2,13 +2,13 @@ import { Component, Inject, OnInit } from '@angular/core'; import { Observable } from 'rxjs'; import { ItemDataService } from '../../../../core/data/item-data.service'; import { Item } from '../../../../core/shared/item.model'; -import { rendersItemType } from '../../../../shared/items/item-type-decorator'; +import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component'; import { isNotEmpty } from '../../../../shared/empty.util'; -import { ItemComponent, filterRelationsByTypeLabel, relationsToItems } from '../shared/item.component'; -import { VIEW_MODE_FULL } from '../../item-page.component'; +import { ItemComponent } from '../shared/item.component'; +import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-relationships-utils'; -@rendersItemType('Project', VIEW_MODE_FULL) +@rendersItemType('Project', ItemViewMode.Full) @Component({ selector: 'ds-project', styleUrls: ['./project.component.scss'], diff --git a/src/app/+item-page/simple/item-types/publication/publication.component.ts b/src/app/+item-page/simple/item-types/publication/publication.component.ts index 1ea50598c7..8798b3c1cf 100644 --- a/src/app/+item-page/simple/item-types/publication/publication.component.ts +++ b/src/app/+item-page/simple/item-types/publication/publication.component.ts @@ -3,16 +3,16 @@ import { Observable } from 'rxjs'; import { ItemDataService } from '../../../../core/data/item-data.service'; import { Item } from '../../../../core/shared/item.model'; import { - DEFAULT_ITEM_TYPE, + DEFAULT_ITEM_TYPE, ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator'; import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component'; -import { ItemComponent, filterRelationsByTypeLabel, relationsToItems } from '../shared/item.component'; +import { ItemComponent } from '../shared/item.component'; import { MetadataRepresentation } from '../../../../core/shared/metadata-representation/metadata-representation.model'; -import { VIEW_MODE_FULL } from '../../item-page.component'; +import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-relationships-utils'; -@rendersItemType('Publication', VIEW_MODE_FULL) -@rendersItemType(DEFAULT_ITEM_TYPE, VIEW_MODE_FULL) +@rendersItemType('Publication', ItemViewMode.Full) +@rendersItemType(DEFAULT_ITEM_TYPE, ItemViewMode.Full) @Component({ selector: 'ds-publication', styleUrls: ['./publication.component.scss'], diff --git a/src/app/+item-page/simple/item-types/shared/item-relationships-utils.ts b/src/app/+item-page/simple/item-types/shared/item-relationships-utils.ts new file mode 100644 index 0000000000..93cb196c59 --- /dev/null +++ b/src/app/+item-page/simple/item-types/shared/item-relationships-utils.ts @@ -0,0 +1,80 @@ +import { hasValue } from '../../../../shared/empty.util'; +import { Observable } from 'rxjs/internal/Observable'; +import { Relationship } from '../../../../core/shared/item-relationships/relationship.model'; +import { RelationshipType } from '../../../../core/shared/item-relationships/relationship-type.model'; +import { distinctUntilChanged, flatMap, map } from 'rxjs/operators'; +import { zip as observableZip } from 'rxjs'; +import { ItemDataService } from '../../../../core/data/item-data.service'; +import { Item } from '../../../../core/shared/item.model'; +import { RemoteData } from '../../../../core/data/remote-data'; + +/** + * Operator for comparing arrays using a mapping function + * The mapping function should turn the source array into an array of basic types, so that the array can + * be compared using these basic types. + * For example: "(o) => o.id" will compare the two arrays by comparing their content by id. + * @param mapFn Function for mapping the arrays + */ +export const compareArraysUsing = (mapFn: (t: T) => any) => + (a: T[], b: T[]): boolean => { + if (!Array.isArray(a) || ! Array.isArray(b)) { + return false + } + + const aIds = a.map(mapFn); + const bIds = b.map(mapFn); + + return aIds.length === bIds.length && + aIds.every((e) => bIds.includes(e)) && + bIds.every((e) => aIds.includes(e)); + }; + +/** + * Operator for comparing arrays using the object's ids + */ +export const compareArraysUsingIds = () => + compareArraysUsing((t: T) => hasValue(t) ? t.id : undefined); + +/** + * Fetch the relationships which match the type label given + * @param {string} label Type label + * @returns {(source: Observable<[Relationship[] , RelationshipType[]]>) => Observable} + */ +export const filterRelationsByTypeLabel = (label: string) => + (source: Observable<[Relationship[], RelationshipType[]]>): Observable => + source.pipe( + map(([relsCurrentPage, relTypesCurrentPage]) => + relsCurrentPage.filter((rel: Relationship, idx: number) => + hasValue(relTypesCurrentPage[idx]) && (relTypesCurrentPage[idx].leftLabel === label || + relTypesCurrentPage[idx].rightLabel === label) + ) + ), + distinctUntilChanged(compareArraysUsingIds()) + ); + +/** + * Operator for turning a list of relationships into a list of the relevant items + * @param {string} thisId The item's id of which the relations belong to + * @param {ItemDataService} ids The ItemDataService to fetch items from the REST API + * @returns {(source: Observable) => Observable} + */ +export const relationsToItems = (thisId: string, ids: ItemDataService) => + (source: Observable): Observable => + source.pipe( + flatMap((rels: Relationship[]) => + observableZip( + ...rels.map((rel: Relationship) => { + let queryId = rel.leftId; + if (rel.leftId === thisId) { + queryId = rel.rightId; + } + return ids.findById(queryId); + }) + ) + ), + map((arr: Array>) => + arr + .filter((d: RemoteData) => d.hasSucceeded) + .map((d: RemoteData) => d.payload)), + distinctUntilChanged(compareArraysUsingIds()), + ); diff --git a/src/app/+item-page/simple/item-types/shared/item.component.spec.ts b/src/app/+item-page/simple/item-types/shared/item.component.spec.ts index 4b34cb442f..a6b4dd801d 100644 --- a/src/app/+item-page/simple/item-types/shared/item.component.spec.ts +++ b/src/app/+item-page/simple/item-types/shared/item.component.spec.ts @@ -16,19 +16,16 @@ import { PaginatedList } from '../../../../core/data/paginated-list'; import { RemoteData } from '../../../../core/data/remote-data'; import { Relationship } from '../../../../core/shared/item-relationships/relationship.model'; import { PageInfo } from '../../../../core/shared/page-info.model'; -import { compareArraysUsing, compareArraysUsingIds, ItemComponent } from './item.component'; +import { ItemComponent } from './item.component'; import { of as observableOf } from 'rxjs'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { ItemPageComponent } from '../../item-page.component'; import { VarDirective } from '../../../../shared/utils/var.directive'; -import { ActivatedRoute } from '@angular/router'; -import { MetadataService } from '../../../../core/metadata/metadata.service'; -import { of } from 'rxjs/internal/observable/of'; import { Observable } from 'rxjs/internal/Observable'; import { MetadataRepresentation } from '../../../../core/shared/metadata-representation/metadata-representation.model'; import { MetadatumRepresentation } from '../../../../core/shared/metadata-representation/metadatum/metadatum-representation.model'; import { ItemMetadataRepresentation } from '../../../../core/shared/metadata-representation/item/item-metadata-representation.model'; import { MetadataMap, MetadataValue } from '../../../../core/shared/metadata.models'; +import { compareArraysUsing, compareArraysUsingIds } from './item-relationships-utils'; /** * Create a generic test for an item-page-fields component using a mockItem and the type of component diff --git a/src/app/+item-page/simple/item-types/shared/item.component.ts b/src/app/+item-page/simple/item-types/shared/item.component.ts index 34bf213b84..451eff457f 100644 --- a/src/app/+item-page/simple/item-types/shared/item.component.ts +++ b/src/app/+item-page/simple/item-types/shared/item.component.ts @@ -8,84 +8,13 @@ import { RelationshipType } from '../../../../core/shared/item-relationships/rel import { Relationship } from '../../../../core/shared/item-relationships/relationship.model'; import { Item } from '../../../../core/shared/item.model'; import { getRemoteDataPayload, getSucceededRemoteData } from '../../../../core/shared/operators'; -import { hasNoValue, hasValue } from '../../../../shared/empty.util'; import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component'; import { MetadataRepresentation } from '../../../../core/shared/metadata-representation/metadata-representation.model'; import { ItemMetadataRepresentation } from '../../../../core/shared/metadata-representation/item/item-metadata-representation.model'; import { MetadatumRepresentation } from '../../../../core/shared/metadata-representation/metadatum/metadatum-representation.model'; import { of } from 'rxjs/internal/observable/of'; import { MetadataValue } from '../../../../core/shared/metadata.models'; - -/** - * Operator for comparing arrays using a mapping function - * The mapping function should turn the source array into an array of basic types, so that the array can - * be compared using these basic types. - * For example: "(o) => o.id" will compare the two arrays by comparing their content by id. - * @param mapFn Function for mapping the arrays - */ -export const compareArraysUsing = (mapFn: (t: T) => any) => - (a: T[], b: T[]): boolean => { - if (!Array.isArray(a) || ! Array.isArray(b)) { - return false - } - - const aIds = a.map(mapFn); - const bIds = b.map(mapFn); - - return aIds.length === bIds.length && - aIds.every((e) => bIds.includes(e)) && - bIds.every((e) => aIds.includes(e)); - }; - -/** - * Operator for comparing arrays using the object's ids - */ -export const compareArraysUsingIds = () => - compareArraysUsing((t: T) => hasValue(t) ? t.id : undefined); - -/** - * Fetch the relationships which match the type label given - * @param {string} label Type label - * @returns {(source: Observable<[Relationship[] , RelationshipType[]]>) => Observable} - */ -export const filterRelationsByTypeLabel = (label: string) => - (source: Observable<[Relationship[], RelationshipType[]]>): Observable => - source.pipe( - map(([relsCurrentPage, relTypesCurrentPage]) => - relsCurrentPage.filter((rel: Relationship, idx: number) => - hasValue(relTypesCurrentPage[idx]) && (relTypesCurrentPage[idx].leftLabel === label || - relTypesCurrentPage[idx].rightLabel === label) - ) - ), - distinctUntilChanged(compareArraysUsingIds()) - ); - -/** - * Operator for turning a list of relationships into a list of the relevant items - * @param {string} thisId The item's id of which the relations belong to - * @param {ItemDataService} ids The ItemDataService to fetch items from the REST API - * @returns {(source: Observable) => Observable} - */ -export const relationsToItems = (thisId: string, ids: ItemDataService) => - (source: Observable): Observable => - source.pipe( - flatMap((rels: Relationship[]) => - observableZip( - ...rels.map((rel: Relationship) => { - let queryId = rel.leftId; - if (rel.leftId === thisId) { - queryId = rel.rightId; - } - return ids.findById(queryId); - }) - ) - ), - map((arr: Array>) => - arr - .filter((d: RemoteData) => d.hasSucceeded) - .map((d: RemoteData) => d.payload)), - distinctUntilChanged(compareArraysUsingIds()), - ); +import { compareArraysUsingIds } from './item-relationships-utils'; /** * Operator for turning a list of relationships into a list of metadatarepresentations given the original metadata diff --git a/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.ts b/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.ts index b821557f4a..f0dc222bf1 100644 --- a/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.ts +++ b/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.ts @@ -1,8 +1,6 @@ import { Component, Input } from '@angular/core'; -import * as viewMode from '../../../shared/view-mode'; import { MetadataRepresentation } from '../../../core/shared/metadata-representation/metadata-representation.model'; - -export const VIEW_MODE_METADATA = 'metadata'; +import { ItemViewMode } from '../../../shared/items/item-type-decorator'; @Component({ selector: 'ds-metadata-representation-list', @@ -27,5 +25,5 @@ export class MetadataRepresentationListComponent { * The view-mode we're currently on * @type {ElementViewMode} */ - viewMode = VIEW_MODE_METADATA; + viewMode = ItemViewMode.Metadata; } diff --git a/src/app/+item-page/simple/related-items/related-items-component.ts b/src/app/+item-page/simple/related-items/related-items-component.ts index ce8ca58b29..7b54d7316a 100644 --- a/src/app/+item-page/simple/related-items/related-items-component.ts +++ b/src/app/+item-page/simple/related-items/related-items-component.ts @@ -1,7 +1,6 @@ import { Component, Input } from '@angular/core'; import { Item } from '../../../core/shared/item.model'; - -export const VIEW_MODE_ELEMENT = 'element'; +import { ItemViewMode } from '../../../shared/items/item-type-decorator'; @Component({ selector: 'ds-related-items', @@ -27,5 +26,5 @@ export class RelatedItemsComponent { * The view-mode we're currently on * @type {ElementViewMode} */ - viewMode = VIEW_MODE_ELEMENT; + viewMode = ItemViewMode.Element; } diff --git a/src/app/+search-page/filtered-search-page.guard.ts b/src/app/+search-page/filtered-search-page.guard.ts index 548e4d8dce..39fbb48c67 100644 --- a/src/app/+search-page/filtered-search-page.guard.ts +++ b/src/app/+search-page/filtered-search-page.guard.ts @@ -3,7 +3,13 @@ import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angul import { Observable } from 'rxjs'; @Injectable() - +/** + * Assemble the correct i18n key for the filtered search page's title depending on the current route's filter parameter + * and title data. + * The format of the key will be "{title}{filter}.title" with: + * - title: The prefix of the key stored in route.data + * - filter: The current filter stored in route.params + */ export class FilteredSearchPageGuard implements CanActivate { canActivate( route: ActivatedRouteSnapshot, diff --git a/src/app/+search-page/search-filters/search-filter/search-filter.service.spec.ts b/src/app/+search-page/search-filters/search-filter/search-filter.service.spec.ts index 5d45e8155e..e317a27698 100644 --- a/src/app/+search-page/search-filters/search-filter/search-filter.service.spec.ts +++ b/src/app/+search-page/search-filters/search-filter/search-filter.service.spec.ts @@ -289,76 +289,4 @@ describe('SearchFilterService', () => { }); }); - describe('when the getPaginatedSearchOptions method is called', () => { - beforeEach(() => { - spyOn(service, 'getCurrentPagination'); - spyOn(service, 'getCurrentSort'); - spyOn(service, 'getCurrentView'); - spyOn(service, 'getCurrentScope'); - spyOn(service, 'getCurrentQuery'); - spyOn(service, 'getCurrentFilters'); - spyOn(service, 'getCurrentFixedFilter'); - service.getPaginatedSearchOptions(); - }); - - it('should call getCurrentPagination to build the paginated search options', () => { - expect(service.getCurrentPagination).toHaveBeenCalled(); - }); - - it('should call getCurrentSort to build the paginated search options', () => { - expect(service.getCurrentSort).toHaveBeenCalled(); - }); - - it('should call getCurrentView to build the paginated search options', () => { - expect(service.getCurrentView).toHaveBeenCalled(); - }); - - it('should call getCurrentScope to build the paginated search options', () => { - expect(service.getCurrentScope).toHaveBeenCalled(); - }); - - it('should call getCurrentQuery to build the paginated search options', () => { - expect(service.getCurrentQuery).toHaveBeenCalled(); - }); - - it('should call getCurrentFilters to build the paginated search options', () => { - expect(service.getCurrentFilters).toHaveBeenCalled(); - }); - - it('should call getCurrentFixedFilter to build the paginated search options', () => { - expect(service.getCurrentFixedFilter).toHaveBeenCalled(); - }); - }); - - describe('when the getSearchOptions method is called', () => { - beforeEach(() => { - spyOn(service, 'getCurrentView'); - spyOn(service, 'getCurrentScope'); - spyOn(service, 'getCurrentQuery'); - spyOn(service, 'getCurrentFilters'); - spyOn(service, 'getCurrentFixedFilter'); - service.getPaginatedSearchOptions(); - }); - - it('should call getCurrentView to build the search options', () => { - expect(service.getCurrentView).toHaveBeenCalled(); - }); - - it('should call getCurrentScope to build the search options', () => { - expect(service.getCurrentScope).toHaveBeenCalled(); - }); - - it('should call getCurrentQuery to build the search options', () => { - expect(service.getCurrentQuery).toHaveBeenCalled(); - }); - - it('should call getCurrentFilters to build the search options', () => { - expect(service.getCurrentFilters).toHaveBeenCalled(); - }); - - it('should call getCurrentFixedFilter to build the search options', () => { - expect(service.getCurrentFixedFilter).toHaveBeenCalled(); - }); - }); - }); diff --git a/src/app/+search-page/search-filters/search-filter/search-filter.service.ts b/src/app/+search-page/search-filters/search-filter/search-filter.service.ts index 19617bb5aa..dc088dfcc5 100644 --- a/src/app/+search-page/search-filters/search-filter/search-filter.service.ts +++ b/src/app/+search-page/search-filters/search-filter/search-filter.service.ts @@ -131,63 +131,6 @@ export class SearchFilterService { return this.routeService.getQueryParameterValue('view'); } - /** - * Fetch the current paginated search options using the getters from above - * and combining them with given defaults - * @param defaults Default paginated search options - * @returns {Observable} - */ - getPaginatedSearchOptions(defaults: any = {}): Observable { - return observableCombineLatest( - this.getCurrentPagination(defaults.pagination), - this.getCurrentSort(defaults.sort), - this.getCurrentView(), - this.getCurrentScope(), - this.getCurrentQuery(), - this.getCurrentFilters(), - this.getCurrentFixedFilter()).pipe( - distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)), - map(([pagination, sort, view, scope, query, filters, fixedFilter]) => { - return Object.assign(new PaginatedSearchOptions(defaults), - { - pagination: pagination, - sort: sort, - view: view, - scope: scope || defaults.scope, - query: query, - filters: filters, - fixedFilter: fixedFilter - }) - }) - ) - } - - /** - * Fetch the current search options (not paginated) using the getters from above - * and combining them with given defaults - * @param defaults Default search options - * @returns {Observable} - */ - getSearchOptions(defaults: any = {}): Observable { - return observableCombineLatest( - this.getCurrentView(), - this.getCurrentScope(), - this.getCurrentQuery(), - this.getCurrentFilters(), - this.getCurrentFixedFilter(), - (view, scope, query, filters, fixedFilter) => { - return Object.assign(new SearchOptions(defaults), - { - view: view, - scope: scope || defaults.scope, - query: query, - filters: filters, - fixedFilter: fixedFilter - }) - } - ) - } - /** * Requests the active filter values set for a given filter * @param {SearchFilterConfig} filterConfig The configuration for which the filters are active diff --git a/src/app/+search-page/search-results/search-results.component.ts b/src/app/+search-page/search-results/search-results.component.ts index 8236eddd50..9656ba9574 100644 --- a/src/app/+search-page/search-results/search-results.component.ts +++ b/src/app/+search-page/search-results/search-results.component.ts @@ -31,9 +31,26 @@ export class SearchResultsComponent { * The current configuration of the search */ @Input() searchConfig: SearchOptions; + + /** + * The current sorting configuration of the search + */ @Input() sortConfig: SortOptions; + + /** + * The current view-mode of the list + */ @Input() viewMode: SetViewMode; + + /** + * An optional fixed filter to filter the result on one type + */ @Input() fixedFilter: string; + + /** + * Whether or not to hide the header of the results + * Defaults to a visible header + */ @Input() disableHeader = false; /** diff --git a/src/app/+search-page/search-service/search-configuration.service.ts b/src/app/+search-page/search-service/search-configuration.service.ts index 4fbd5e81bc..0cbf1ba6f8 100644 --- a/src/app/+search-page/search-service/search-configuration.service.ts +++ b/src/app/+search-page/search-service/search-configuration.service.ts @@ -73,6 +73,7 @@ export class SearchConfigurationService implements OnDestroy { /** * Initialize the search options * @param {RouteService} routeService + * @param {SearchFixedFilterService} fixedFilterService * @param {ActivatedRoute} route */ constructor(private routeService: RouteService, diff --git a/src/app/shared/items/item-type-decorator.ts b/src/app/shared/items/item-type-decorator.ts index c8a1a2df97..2420e71908 100644 --- a/src/app/shared/items/item-type-decorator.ts +++ b/src/app/shared/items/item-type-decorator.ts @@ -1,9 +1,14 @@ import { hasNoValue, hasValue } from '../empty.util'; import { MetadataRepresentationType } from '../../core/shared/metadata-representation/metadata-representation.model'; -import { VIEW_MODE_ELEMENT } from '../../+item-page/simple/related-items/related-items-component'; + +export enum ItemViewMode { + Element = 'element', + Full = 'full', + Metadata = 'metadata' +} export const DEFAULT_ITEM_TYPE = 'Default'; -export const DEFAULT_VIEW_MODE = VIEW_MODE_ELEMENT; +export const DEFAULT_VIEW_MODE = ItemViewMode.Element; export const NO_REPRESENTATION_TYPE = MetadataRepresentationType.None; export const DEFAULT_REPRESENTATION_TYPE = MetadataRepresentationType.PlainText; diff --git a/src/app/shared/items/switcher/item-type-switcher.component.spec.ts b/src/app/shared/items/switcher/item-type-switcher.component.spec.ts index bc6950a446..b083a3a0f9 100644 --- a/src/app/shared/items/switcher/item-type-switcher.component.spec.ts +++ b/src/app/shared/items/switcher/item-type-switcher.component.spec.ts @@ -7,11 +7,9 @@ import { Item } from '../../../core/shared/item.model'; import { PaginatedList } from '../../../core/data/paginated-list'; import { RemoteData } from '../../../core/data/remote-data'; import * as decorator from '../item-type-decorator'; -import { getComponentByItemType } from '../item-type-decorator'; +import { getComponentByItemType, ItemViewMode } from '../item-type-decorator'; import { ItemMetadataRepresentation } from '../../../core/shared/metadata-representation/item/item-metadata-representation.model'; import createSpy = jasmine.createSpy; -import { VIEW_MODE_FULL } from '../../../+item-page/simple/item-page.component'; -import { VIEW_MODE_METADATA } from '../../../+item-page/simple/metadata-representation-list/metadata-representation-list.component'; const relationType = 'type'; const mockItem: Item = Object.assign(new Item(), { @@ -32,7 +30,7 @@ const mockItem: Item = Object.assign(new Item(), { } }); const mockItemMetadataRepresentation = Object.assign(new ItemMetadataRepresentation(relationType), mockItem); -let viewMode = VIEW_MODE_FULL; +let viewMode = ItemViewMode.Full; describe('ItemTypeSwitcherComponent', () => { let comp: ItemTypeSwitcherComponent; @@ -55,7 +53,7 @@ describe('ItemTypeSwitcherComponent', () => { describe('when the injected object is of type Item', () => { beforeEach(() => { - viewMode = VIEW_MODE_FULL; + viewMode = ItemViewMode.Full; comp.object = mockItem; comp.viewMode = viewMode; }); @@ -73,7 +71,7 @@ describe('ItemTypeSwitcherComponent', () => { describe('when the injected object is of type MetadataRepresentation', () => { beforeEach(() => { - viewMode = VIEW_MODE_METADATA; + viewMode = ItemViewMode.Metadata; comp.object = mockItemMetadataRepresentation; comp.viewMode = viewMode; }); diff --git a/src/app/shared/object-list/item-list-element/item-list-element.component.ts b/src/app/shared/object-list/item-list-element/item-list-element.component.ts index 4d34e75d61..67a6256d43 100644 --- a/src/app/shared/object-list/item-list-element/item-list-element.component.ts +++ b/src/app/shared/object-list/item-list-element/item-list-element.component.ts @@ -4,7 +4,7 @@ import { Item } from '../../../core/shared/item.model'; import { renderElementsFor } from '../../object-collection/shared/dso-element-decorator'; import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; import { SetViewMode } from '../../view-mode'; -import { VIEW_MODE_ELEMENT } from '../../../+item-page/simple/related-items/related-items-component'; +import { ItemViewMode } from '../../items/item-type-decorator'; @Component({ selector: 'ds-item-list-element', @@ -18,5 +18,5 @@ import { VIEW_MODE_ELEMENT } from '../../../+item-page/simple/related-items/rela */ @renderElementsFor(Item, SetViewMode.List) export class ItemListElementComponent extends AbstractListableElementComponent { - viewMode = VIEW_MODE_ELEMENT; + viewMode = ItemViewMode.Element; } diff --git a/src/app/shared/object-list/item-list-element/item-types/journal-issue/journal-issue-list-element.component.ts b/src/app/shared/object-list/item-list-element/item-types/journal-issue/journal-issue-list-element.component.ts index 3b1b9eb1c9..92a8dd9930 100644 --- a/src/app/shared/object-list/item-list-element/item-types/journal-issue/journal-issue-list-element.component.ts +++ b/src/app/shared/object-list/item-list-element/item-types/journal-issue/journal-issue-list-element.component.ts @@ -1,9 +1,8 @@ import { Component } from '@angular/core'; -import { rendersItemType } from '../../../../items/item-type-decorator'; +import { ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator'; import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component'; -import { VIEW_MODE_ELEMENT } from '../../../../../+item-page/simple/related-items/related-items-component'; -@rendersItemType('JournalIssue', VIEW_MODE_ELEMENT) +@rendersItemType('JournalIssue', ItemViewMode.Element) @Component({ selector: 'ds-journal-issue-list-element', styleUrls: ['./journal-issue-list-element.component.scss'], diff --git a/src/app/shared/object-list/item-list-element/item-types/journal-volume/journal-volume-list-element.component.ts b/src/app/shared/object-list/item-list-element/item-types/journal-volume/journal-volume-list-element.component.ts index 49a11b2cd9..01acf3ca34 100644 --- a/src/app/shared/object-list/item-list-element/item-types/journal-volume/journal-volume-list-element.component.ts +++ b/src/app/shared/object-list/item-list-element/item-types/journal-volume/journal-volume-list-element.component.ts @@ -1,9 +1,8 @@ import { Component } from '@angular/core'; -import { rendersItemType } from '../../../../items/item-type-decorator'; +import { ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator'; import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component'; -import { VIEW_MODE_ELEMENT } from '../../../../../+item-page/simple/related-items/related-items-component'; -@rendersItemType('JournalVolume', VIEW_MODE_ELEMENT) +@rendersItemType('JournalVolume', ItemViewMode.Element) @Component({ selector: 'ds-journal-volume-list-element', styleUrls: ['./journal-volume-list-element.component.scss'], diff --git a/src/app/shared/object-list/item-list-element/item-types/journal/journal-list-element.component.ts b/src/app/shared/object-list/item-list-element/item-types/journal/journal-list-element.component.ts index 45926c681c..a40891b452 100644 --- a/src/app/shared/object-list/item-list-element/item-types/journal/journal-list-element.component.ts +++ b/src/app/shared/object-list/item-list-element/item-types/journal/journal-list-element.component.ts @@ -1,9 +1,8 @@ import { Component } from '@angular/core'; -import { rendersItemType } from '../../../../items/item-type-decorator'; +import { ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator'; import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component'; -import { VIEW_MODE_ELEMENT } from '../../../../../+item-page/simple/related-items/related-items-component'; -@rendersItemType('Journal', VIEW_MODE_ELEMENT) +@rendersItemType('Journal', ItemViewMode.Element) @Component({ selector: 'ds-journal-list-element', styleUrls: ['./journal-list-element.component.scss'], diff --git a/src/app/shared/object-list/item-list-element/item-types/orgunit/orgunit-list-element.component.ts b/src/app/shared/object-list/item-list-element/item-types/orgunit/orgunit-list-element.component.ts index 699cb6dfab..f047aac586 100644 --- a/src/app/shared/object-list/item-list-element/item-types/orgunit/orgunit-list-element.component.ts +++ b/src/app/shared/object-list/item-list-element/item-types/orgunit/orgunit-list-element.component.ts @@ -1,9 +1,8 @@ import { Component } from '@angular/core'; -import { rendersItemType } from '../../../../items/item-type-decorator'; +import { ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator'; import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component'; -import { VIEW_MODE_ELEMENT } from '../../../../../+item-page/simple/related-items/related-items-component'; -@rendersItemType('OrgUnit', VIEW_MODE_ELEMENT) +@rendersItemType('OrgUnit', ItemViewMode.Element) @Component({ selector: 'ds-orgunit-list-element', styleUrls: ['./orgunit-list-element.component.scss'], diff --git a/src/app/shared/object-list/item-list-element/item-types/person/person-list-element.component.ts b/src/app/shared/object-list/item-list-element/item-types/person/person-list-element.component.ts index e12cc60813..b3834a8aab 100644 --- a/src/app/shared/object-list/item-list-element/item-types/person/person-list-element.component.ts +++ b/src/app/shared/object-list/item-list-element/item-types/person/person-list-element.component.ts @@ -1,9 +1,8 @@ import { Component } from '@angular/core'; -import { rendersItemType } from '../../../../items/item-type-decorator'; +import { ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator'; import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component'; -import { VIEW_MODE_ELEMENT } from '../../../../../+item-page/simple/related-items/related-items-component'; -@rendersItemType('Person', VIEW_MODE_ELEMENT) +@rendersItemType('Person', ItemViewMode.Element) @Component({ selector: 'ds-person-list-element', styleUrls: ['./person-list-element.component.scss'], diff --git a/src/app/shared/object-list/item-list-element/item-types/person/person-metadata-list-element.component.ts b/src/app/shared/object-list/item-list-element/item-types/person/person-metadata-list-element.component.ts index 1f3d736d1c..959673242d 100644 --- a/src/app/shared/object-list/item-list-element/item-types/person/person-metadata-list-element.component.ts +++ b/src/app/shared/object-list/item-list-element/item-types/person/person-metadata-list-element.component.ts @@ -1,10 +1,9 @@ -import { rendersItemType } from '../../../../items/item-type-decorator'; -import { VIEW_MODE_ELEMENT } from '../../../../../+item-page/simple/related-items/related-items-component'; +import { ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator'; import { Component } from '@angular/core'; import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component'; import { MetadataRepresentationType } from '../../../../../core/shared/metadata-representation/metadata-representation.model'; -@rendersItemType('Person', VIEW_MODE_ELEMENT, MetadataRepresentationType.Item) +@rendersItemType('Person', ItemViewMode.Element, MetadataRepresentationType.Item) @Component({ selector: 'ds-person-metadata-list-element', templateUrl: './person-metadata-list-element.component.html' diff --git a/src/app/shared/object-list/item-list-element/item-types/project/project-list-element.component.ts b/src/app/shared/object-list/item-list-element/item-types/project/project-list-element.component.ts index e688056bc6..86b58c94fd 100644 --- a/src/app/shared/object-list/item-list-element/item-types/project/project-list-element.component.ts +++ b/src/app/shared/object-list/item-list-element/item-types/project/project-list-element.component.ts @@ -1,9 +1,8 @@ import { Component } from '@angular/core'; -import { rendersItemType } from '../../../../items/item-type-decorator'; +import { ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator'; import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component'; -import { VIEW_MODE_ELEMENT } from '../../../../../+item-page/simple/related-items/related-items-component'; -@rendersItemType('Project', VIEW_MODE_ELEMENT) +@rendersItemType('Project', ItemViewMode.Element) @Component({ selector: 'ds-project-list-element', styleUrls: ['./project-list-element.component.scss'], diff --git a/src/app/shared/object-list/item-list-element/item-types/publication/publication-list-element.component.ts b/src/app/shared/object-list/item-list-element/item-types/publication/publication-list-element.component.ts index 58a0568931..4717ff1df2 100644 --- a/src/app/shared/object-list/item-list-element/item-types/publication/publication-list-element.component.ts +++ b/src/app/shared/object-list/item-list-element/item-types/publication/publication-list-element.component.ts @@ -1,10 +1,9 @@ import { Component } from '@angular/core'; -import { DEFAULT_ITEM_TYPE, rendersItemType } from '../../../../items/item-type-decorator'; +import { DEFAULT_ITEM_TYPE, ItemViewMode, rendersItemType } from '../../../../items/item-type-decorator'; import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component'; -import { VIEW_MODE_ELEMENT } from '../../../../../+item-page/simple/related-items/related-items-component'; -@rendersItemType('Publication', VIEW_MODE_ELEMENT) -@rendersItemType(DEFAULT_ITEM_TYPE, VIEW_MODE_ELEMENT) +@rendersItemType('Publication', ItemViewMode.Element) +@rendersItemType(DEFAULT_ITEM_TYPE, ItemViewMode.Element) @Component({ selector: 'ds-publication-list-element', styleUrls: ['./publication-list-element.component.scss'], diff --git a/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.ts b/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.ts index a5900cc763..084567a885 100644 --- a/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.ts +++ b/src/app/shared/object-list/metadata-representation-list-element/item/item-metadata-list-element.component.ts @@ -1,12 +1,9 @@ -import * as viewMode from '../../../view-mode'; import { MetadataRepresentationType } from '../../../../core/shared/metadata-representation/metadata-representation.model'; import { Component } from '@angular/core'; import { MetadataRepresentationListElementComponent } from '../metadata-representation-list-element.component'; -import { DEFAULT_ITEM_TYPE, rendersItemType } from '../../../items/item-type-decorator'; -import { VIEW_MODE_METADATA } from '../../../../+item-page/simple/metadata-representation-list/metadata-representation-list.component'; -import { VIEW_MODE_ELEMENT } from '../../../../+item-page/simple/related-items/related-items-component'; +import { DEFAULT_ITEM_TYPE, ItemViewMode, rendersItemType } from '../../../items/item-type-decorator'; -@rendersItemType(DEFAULT_ITEM_TYPE, VIEW_MODE_METADATA, MetadataRepresentationType.Item) +@rendersItemType(DEFAULT_ITEM_TYPE, ItemViewMode.Metadata, MetadataRepresentationType.Item) @Component({ selector: 'ds-item-metadata-list-element', templateUrl: './item-metadata-list-element.component.html' @@ -21,5 +18,5 @@ export class ItemMetadataListElementComponent extends MetadataRepresentationList * The view-mode we're currently on * @type {ElementViewMode} */ - viewMode = VIEW_MODE_ELEMENT; + viewMode = ItemViewMode.Element; } diff --git a/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.ts b/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.ts index e86210a961..7c4785e37c 100644 --- a/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.ts +++ b/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.ts @@ -1,12 +1,11 @@ import { MetadataRepresentationType } from '../../../../core/shared/metadata-representation/metadata-representation.model'; import { Component } from '@angular/core'; import { MetadataRepresentationListElementComponent } from '../metadata-representation-list-element.component'; -import { DEFAULT_ITEM_TYPE, rendersItemType } from '../../../items/item-type-decorator'; -import { VIEW_MODE_METADATA } from '../../../../+item-page/simple/metadata-representation-list/metadata-representation-list.component'; +import { DEFAULT_ITEM_TYPE, ItemViewMode, rendersItemType } from '../../../items/item-type-decorator'; -@rendersItemType(DEFAULT_ITEM_TYPE, VIEW_MODE_METADATA, MetadataRepresentationType.PlainText) +@rendersItemType(DEFAULT_ITEM_TYPE, ItemViewMode.Metadata, MetadataRepresentationType.PlainText) // For now, authority controlled fields are rendered the same way as plain text fields -@rendersItemType(DEFAULT_ITEM_TYPE, VIEW_MODE_METADATA, MetadataRepresentationType.AuthorityControlled) +@rendersItemType(DEFAULT_ITEM_TYPE, ItemViewMode.Metadata, MetadataRepresentationType.AuthorityControlled) @Component({ selector: 'ds-plain-text-metadata-list-element', templateUrl: './plain-text-metadata-list-element.component.html' diff --git a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.ts b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.ts index a164e5a65b..4e43ef2b2c 100644 --- a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.ts +++ b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.ts @@ -6,7 +6,7 @@ import { renderElementsFor } from '../../../object-collection/shared/dso-element import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model'; import { SetViewMode } from '../../../view-mode'; import { SearchResultListElementComponent } from '../search-result-list-element.component'; -import { VIEW_MODE_ELEMENT } from '../../../../+item-page/simple/related-items/related-items-component'; +import { ItemViewMode } from '../../../items/item-type-decorator'; @Component({ selector: 'ds-item-search-result-list-element', @@ -18,5 +18,5 @@ import { VIEW_MODE_ELEMENT } from '../../../../+item-page/simple/related-items/r @renderElementsFor(ItemSearchResult, SetViewMode.List) export class ItemSearchResultListElementComponent extends SearchResultListElementComponent { - viewMode = VIEW_MODE_ELEMENT; + viewMode = ItemViewMode.Element; }