mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-09 02:54:13 +00:00
85993: comcol/switcher/guard browse by changes + test updates
This commit is contained in:
@@ -12,12 +12,13 @@ import { ActivatedRoute, Params, Router } from '@angular/router';
|
|||||||
import { BrowseService } from '../../core/browse/browse.service';
|
import { BrowseService } from '../../core/browse/browse.service';
|
||||||
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
||||||
import { StartsWithType } from '../../shared/starts-with/starts-with-decorator';
|
import { StartsWithType } from '../../shared/starts-with/starts-with-decorator';
|
||||||
import { BrowseByType, rendersBrowseBy } from '../browse-by-switcher/browse-by-decorator';
|
import { BrowseByDataType, rendersBrowseBy } from '../browse-by-switcher/browse-by-decorator';
|
||||||
import { environment } from '../../../environments/environment';
|
import { environment } from '../../../environments/environment';
|
||||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||||
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
||||||
|
import { BrowseDefinition } from '../../core/shared/browse-definition.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-browse-by-date-page',
|
selector: 'ds-browse-by-date-page',
|
||||||
@@ -29,13 +30,13 @@ import { SortDirection, SortOptions } from '../../core/cache/models/sort-options
|
|||||||
* A metadata definition (a.k.a. browse id) is a short term used to describe one or multiple metadata fields.
|
* A metadata definition (a.k.a. browse id) is a short term used to describe one or multiple metadata fields.
|
||||||
* An example would be 'dateissued' for 'dc.date.issued'
|
* An example would be 'dateissued' for 'dc.date.issued'
|
||||||
*/
|
*/
|
||||||
@rendersBrowseBy(BrowseByType.Date)
|
@rendersBrowseBy(BrowseByDataType.Date)
|
||||||
export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent {
|
export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default metadata-field to use for determining the lower limit of the StartsWith dropdown options
|
* The default metadata-field to use for determining the lower limit of the StartsWith dropdown options
|
||||||
*/
|
*/
|
||||||
defaultMetadataField = 'dc.date.issued';
|
defaultBrowseDefinition = Object.assign(new BrowseDefinition(), {metadataKeys: ['dc.date.issued']});
|
||||||
|
|
||||||
public constructor(protected route: ActivatedRoute,
|
public constructor(protected route: ActivatedRoute,
|
||||||
protected browseService: BrowseService,
|
protected browseService: BrowseService,
|
||||||
@@ -59,13 +60,13 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent {
|
|||||||
return [Object.assign({}, routeParams, queryParams, data), currentPage, currentSort];
|
return [Object.assign({}, routeParams, queryParams, data), currentPage, currentSort];
|
||||||
})
|
})
|
||||||
).subscribe(([params, currentPage, currentSort]: [Params, PaginationComponentOptions, SortOptions]) => {
|
).subscribe(([params, currentPage, currentSort]: [Params, PaginationComponentOptions, SortOptions]) => {
|
||||||
const metadataField = params.metadataField || this.defaultMetadataField;
|
const browseDefinition = params.browseDefinition || this.defaultBrowseDefinition;
|
||||||
this.browseId = params.id || this.defaultBrowseId;
|
this.browseId = params.id || this.defaultBrowseId;
|
||||||
this.startsWith = +params.startsWith || params.startsWith;
|
this.startsWith = +params.startsWith || params.startsWith;
|
||||||
const searchOptions = browseParamsToOptions(params, currentPage, currentSort, this.browseId);
|
const searchOptions = browseParamsToOptions(params, currentPage, currentSort, this.browseId);
|
||||||
this.updatePageWithItems(searchOptions, this.value);
|
this.updatePageWithItems(searchOptions, this.value);
|
||||||
this.updateParent(params.scope);
|
this.updateParent(params.scope);
|
||||||
this.updateStartsWithOptions(this.browseId, metadataField, params.scope);
|
this.updateStartsWithOptions(this.browseId, browseDefinition, params.scope);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,12 +80,12 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent {
|
|||||||
* @param metadataField The metadata field to fetch the earliest date from (expects a date field)
|
* @param metadataField The metadata field to fetch the earliest date from (expects a date field)
|
||||||
* @param scope The scope under which to fetch the earliest item for
|
* @param scope The scope under which to fetch the earliest item for
|
||||||
*/
|
*/
|
||||||
updateStartsWithOptions(definition: string, metadataField: string, scope?: string) {
|
updateStartsWithOptions(definition: string, browseDefinition: BrowseDefinition, scope?: string) {
|
||||||
this.subs.push(
|
this.subs.push(
|
||||||
this.browseService.getFirstItemFor(definition, scope).subscribe((firstItemRD: RemoteData<Item>) => {
|
this.browseService.getFirstItemFor(definition, scope).subscribe((firstItemRD: RemoteData<Item>) => {
|
||||||
let lowerLimit = environment.browseBy.defaultLowerLimit;
|
let lowerLimit = environment.browseBy.defaultLowerLimit;
|
||||||
if (hasValue(firstItemRD.payload)) {
|
if (hasValue(firstItemRD.payload)) {
|
||||||
const date = firstItemRD.payload.firstMetadataValue(metadataField);
|
const date = firstItemRD.payload.firstMetadataValue(browseDefinition.metadataKeys);
|
||||||
if (hasValue(date)) {
|
if (hasValue(date)) {
|
||||||
const dateObj = new Date(date);
|
const dateObj = new Date(date);
|
||||||
// TODO: it appears that getFullYear (based on local time) is sometimes unreliable. Switching to UTC.
|
// TODO: it appears that getFullYear (based on local time) is sometimes unreliable. Switching to UTC.
|
||||||
|
@@ -1,20 +1,25 @@
|
|||||||
import { first } from 'rxjs/operators';
|
import { first } from 'rxjs/operators';
|
||||||
import { BrowseByGuard } from './browse-by-guard';
|
import { BrowseByGuard } from './browse-by-guard';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
|
import { BrowseDefinitionDataService } from '../core/browse/browse-definition-data.service';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../shared/remote-data.utils';
|
||||||
|
import { BrowseDefinition } from '../core/shared/browse-definition.model';
|
||||||
|
import { BrowseByDataType } from './browse-by-switcher/browse-by-decorator';
|
||||||
|
|
||||||
describe('BrowseByGuard', () => {
|
describe('BrowseByGuard', () => {
|
||||||
describe('canActivate', () => {
|
describe('canActivate', () => {
|
||||||
let guard: BrowseByGuard;
|
let guard: BrowseByGuard;
|
||||||
let dsoService: any;
|
let dsoService: any;
|
||||||
let translateService: any;
|
let translateService: any;
|
||||||
|
let browseDefinitionService: any;
|
||||||
|
|
||||||
const name = 'An interesting DSO';
|
const name = 'An interesting DSO';
|
||||||
const title = 'Author';
|
const title = 'Author';
|
||||||
const field = 'Author';
|
const field = 'Author';
|
||||||
const id = 'author';
|
const id = 'author';
|
||||||
const metadataField = 'dc.contributor';
|
|
||||||
const scope = '1234-65487-12354-1235';
|
const scope = '1234-65487-12354-1235';
|
||||||
const value = 'Filter';
|
const value = 'Filter';
|
||||||
|
const browseDefinition = Object.assign(new BrowseDefinition(), { type: BrowseByDataType.Metadata, metadataKeys: ['dc.contributor'] });
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
dsoService = {
|
dsoService = {
|
||||||
@@ -24,14 +29,19 @@ describe('BrowseByGuard', () => {
|
|||||||
translateService = {
|
translateService = {
|
||||||
instant: () => field
|
instant: () => field
|
||||||
};
|
};
|
||||||
guard = new BrowseByGuard(dsoService, translateService);
|
|
||||||
|
browseDefinitionService = {
|
||||||
|
findById: () => createSuccessfulRemoteDataObject$(browseDefinition)
|
||||||
|
};
|
||||||
|
|
||||||
|
guard = new BrowseByGuard(dsoService, translateService, browseDefinitionService);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return true, and sets up the data correctly, with a scope and value', () => {
|
it('should return true, and sets up the data correctly, with a scope and value', () => {
|
||||||
const scopedRoute = {
|
const scopedRoute = {
|
||||||
data: {
|
data: {
|
||||||
title: field,
|
title: field,
|
||||||
metadataField,
|
browseDefinition,
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
id,
|
id,
|
||||||
@@ -48,7 +58,7 @@ describe('BrowseByGuard', () => {
|
|||||||
const result = {
|
const result = {
|
||||||
title,
|
title,
|
||||||
id,
|
id,
|
||||||
metadataField,
|
browseDefinition,
|
||||||
collection: name,
|
collection: name,
|
||||||
field,
|
field,
|
||||||
value: '"' + value + '"'
|
value: '"' + value + '"'
|
||||||
@@ -63,7 +73,7 @@ describe('BrowseByGuard', () => {
|
|||||||
const scopedNoValueRoute = {
|
const scopedNoValueRoute = {
|
||||||
data: {
|
data: {
|
||||||
title: field,
|
title: field,
|
||||||
metadataField,
|
browseDefinition,
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
id,
|
id,
|
||||||
@@ -80,7 +90,7 @@ describe('BrowseByGuard', () => {
|
|||||||
const result = {
|
const result = {
|
||||||
title,
|
title,
|
||||||
id,
|
id,
|
||||||
metadataField,
|
browseDefinition,
|
||||||
collection: name,
|
collection: name,
|
||||||
field,
|
field,
|
||||||
value: ''
|
value: ''
|
||||||
@@ -95,7 +105,7 @@ describe('BrowseByGuard', () => {
|
|||||||
const route = {
|
const route = {
|
||||||
data: {
|
data: {
|
||||||
title: field,
|
title: field,
|
||||||
metadataField,
|
browseDefinition,
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
id,
|
id,
|
||||||
@@ -111,7 +121,7 @@ describe('BrowseByGuard', () => {
|
|||||||
const result = {
|
const result = {
|
||||||
title,
|
title,
|
||||||
id,
|
id,
|
||||||
metadataField,
|
browseDefinition,
|
||||||
collection: '',
|
collection: '',
|
||||||
field,
|
field,
|
||||||
value: '"' + value + '"'
|
value: '"' + value + '"'
|
||||||
|
@@ -2,11 +2,14 @@ import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angul
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { DSpaceObjectDataService } from '../core/data/dspace-object-data.service';
|
import { DSpaceObjectDataService } from '../core/data/dspace-object-data.service';
|
||||||
import { hasNoValue, hasValue } from '../shared/empty.util';
|
import { hasNoValue, hasValue } from '../shared/empty.util';
|
||||||
import { map } from 'rxjs/operators';
|
import { map, switchMap } from 'rxjs/operators';
|
||||||
import { getFirstSucceededRemoteData } from '../core/shared/operators';
|
import { getFirstSucceededRemoteData, getFirstSucceededRemoteDataPayload } from '../core/shared/operators';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { Observable, of as observableOf } from 'rxjs';
|
||||||
import { environment } from '../../environments/environment';
|
import { environment } from '../../environments/environment';
|
||||||
|
import { BrowseDefinitionDataService } from '../core/browse/browse-definition-data.service';
|
||||||
|
import { RemoteData } from '../core/data/remote-data';
|
||||||
|
import { BrowseDefinition } from '../core/shared/browse-definition.model';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
/**
|
/**
|
||||||
@@ -15,42 +18,46 @@ import { environment } from '../../environments/environment';
|
|||||||
export class BrowseByGuard implements CanActivate {
|
export class BrowseByGuard implements CanActivate {
|
||||||
|
|
||||||
constructor(protected dsoService: DSpaceObjectDataService,
|
constructor(protected dsoService: DSpaceObjectDataService,
|
||||||
protected translate: TranslateService) {
|
protected translate: TranslateService,
|
||||||
|
protected browseDefinitionService: BrowseDefinitionDataService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
|
||||||
const title = route.data.title;
|
const title = route.data.title;
|
||||||
const id = route.params.id || route.queryParams.id || route.data.id;
|
const id = route.params.id || route.queryParams.id || route.data.id;
|
||||||
let metadataField = route.data.metadataField;
|
let browseDefinition$: Observable<BrowseDefinition>;
|
||||||
if (hasNoValue(metadataField) && hasValue(id)) {
|
if (hasNoValue(route.data.browseDefinition) && hasValue(id)) {
|
||||||
const config = environment.browseBy.types.find((conf) => conf.id === id);
|
browseDefinition$ = this.browseDefinitionService.findById(id).pipe(getFirstSucceededRemoteDataPayload());
|
||||||
if (hasValue(config) && hasValue(config.metadataField)) {
|
} else {
|
||||||
metadataField = config.metadataField;
|
browseDefinition$ = observableOf(route.data.browseDefinition);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const scope = route.queryParams.scope;
|
const scope = route.queryParams.scope;
|
||||||
const value = route.queryParams.value;
|
const value = route.queryParams.value;
|
||||||
const metadataTranslated = this.translate.instant('browse.metadata.' + id);
|
const metadataTranslated = this.translate.instant('browse.metadata.' + id);
|
||||||
if (hasValue(scope)) {
|
return browseDefinition$.pipe(
|
||||||
const dsoAndMetadata$ = this.dsoService.findById(scope).pipe(getFirstSucceededRemoteData());
|
switchMap((browseDefinition) => {
|
||||||
return dsoAndMetadata$.pipe(
|
if (hasValue(scope)) {
|
||||||
map((dsoRD) => {
|
const dsoAndMetadata$ = this.dsoService.findById(scope).pipe(getFirstSucceededRemoteData());
|
||||||
const name = dsoRD.payload.name;
|
return dsoAndMetadata$.pipe(
|
||||||
route.data = this.createData(title, id, metadataField, name, metadataTranslated, value, route);
|
map((dsoRD) => {
|
||||||
return true;
|
const name = dsoRD.payload.name;
|
||||||
})
|
route.data = this.createData(title, id, browseDefinition, name, metadataTranslated, value, route);
|
||||||
);
|
return true;
|
||||||
} else {
|
})
|
||||||
route.data = this.createData(title, id, metadataField, '', metadataTranslated, value, route);
|
);
|
||||||
return observableOf(true);
|
} else {
|
||||||
}
|
route.data = this.createData(title, id, browseDefinition, '', metadataTranslated, value, route);
|
||||||
|
return observableOf(true);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private createData(title, id, metadataField, collection, field, value, route) {
|
private createData(title, id, browseDefinition, collection, field, value, route) {
|
||||||
return Object.assign({}, route.data, {
|
return Object.assign({}, route.data, {
|
||||||
title: title,
|
title: title,
|
||||||
id: id,
|
id: id,
|
||||||
metadataField: metadataField,
|
browseDefinition: browseDefinition,
|
||||||
collection: collection,
|
collection: collection,
|
||||||
field: field,
|
field: field,
|
||||||
value: hasValue(value) ? `"${value}"` : ''
|
value: hasValue(value) ? `"${value}"` : ''
|
||||||
|
@@ -14,7 +14,7 @@ import { getFirstSucceededRemoteData } from '../../core/shared/operators';
|
|||||||
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
||||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||||
import { StartsWithType } from '../../shared/starts-with/starts-with-decorator';
|
import { StartsWithType } from '../../shared/starts-with/starts-with-decorator';
|
||||||
import { BrowseByType, rendersBrowseBy } from '../browse-by-switcher/browse-by-decorator';
|
import { BrowseByDataType, rendersBrowseBy } from '../browse-by-switcher/browse-by-decorator';
|
||||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ import { map } from 'rxjs/operators';
|
|||||||
* A metadata definition (a.k.a. browse id) is a short term used to describe one or multiple metadata fields.
|
* A metadata definition (a.k.a. browse id) is a short term used to describe one or multiple metadata fields.
|
||||||
* An example would be 'author' for 'dc.contributor.*'
|
* An example would be 'author' for 'dc.contributor.*'
|
||||||
*/
|
*/
|
||||||
@rendersBrowseBy(BrowseByType.Metadata)
|
@rendersBrowseBy(BrowseByDataType.Metadata)
|
||||||
export class BrowseByMetadataPageComponent implements OnInit {
|
export class BrowseByMetadataPageComponent implements OnInit {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { BrowseByType, rendersBrowseBy } from './browse-by-decorator';
|
import { BrowseByDataType, rendersBrowseBy } from './browse-by-decorator';
|
||||||
|
|
||||||
describe('BrowseByDecorator', () => {
|
describe('BrowseByDecorator', () => {
|
||||||
const titleDecorator = rendersBrowseBy(BrowseByType.Title);
|
const titleDecorator = rendersBrowseBy(BrowseByDataType.Title);
|
||||||
const dateDecorator = rendersBrowseBy(BrowseByType.Date);
|
const dateDecorator = rendersBrowseBy(BrowseByDataType.Date);
|
||||||
const metadataDecorator = rendersBrowseBy(BrowseByType.Metadata);
|
const metadataDecorator = rendersBrowseBy(BrowseByDataType.Metadata);
|
||||||
it('should have a decorator for all types', () => {
|
it('should have a decorator for all types', () => {
|
||||||
expect(titleDecorator.length).not.toEqual(0);
|
expect(titleDecorator.length).not.toEqual(0);
|
||||||
expect(dateDecorator.length).not.toEqual(0);
|
expect(dateDecorator.length).not.toEqual(0);
|
||||||
|
@@ -2,13 +2,13 @@ import { hasNoValue } from '../../shared/empty.util';
|
|||||||
import { InjectionToken } from '@angular/core';
|
import { InjectionToken } from '@angular/core';
|
||||||
import { GenericConstructor } from '../../core/shared/generic-constructor';
|
import { GenericConstructor } from '../../core/shared/generic-constructor';
|
||||||
|
|
||||||
export enum BrowseByType {
|
export enum BrowseByDataType {
|
||||||
Title = 'title',
|
Title = 'title',
|
||||||
Metadata = 'metadata',
|
Metadata = 'text',
|
||||||
Date = 'date'
|
Date = 'date'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DEFAULT_BROWSE_BY_TYPE = BrowseByType.Metadata;
|
export const DEFAULT_BROWSE_BY_TYPE = BrowseByDataType.Metadata;
|
||||||
|
|
||||||
export const BROWSE_BY_COMPONENT_FACTORY = new InjectionToken<(browseByType) => GenericConstructor<any>>('getComponentByBrowseByType', {
|
export const BROWSE_BY_COMPONENT_FACTORY = new InjectionToken<(browseByType) => GenericConstructor<any>>('getComponentByBrowseByType', {
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
@@ -21,7 +21,7 @@ const map = new Map();
|
|||||||
* Decorator used for rendering Browse-By pages by type
|
* Decorator used for rendering Browse-By pages by type
|
||||||
* @param browseByType The type of page
|
* @param browseByType The type of page
|
||||||
*/
|
*/
|
||||||
export function rendersBrowseBy(browseByType: BrowseByType) {
|
export function rendersBrowseBy(browseByType: BrowseByDataType) {
|
||||||
return function decorator(component: any) {
|
return function decorator(component: any) {
|
||||||
if (hasNoValue(map.get(browseByType))) {
|
if (hasNoValue(map.get(browseByType))) {
|
||||||
map.set(browseByType, component);
|
map.set(browseByType, component);
|
||||||
|
@@ -2,20 +2,46 @@ import { BrowseBySwitcherComponent } from './browse-by-switcher.component';
|
|||||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { BehaviorSubject } from 'rxjs';
|
import { BROWSE_BY_COMPONENT_FACTORY, BrowseByDataType } from './browse-by-decorator';
|
||||||
import { environment } from '../../../environments/environment';
|
import { BrowseDefinition } from '../../core/shared/browse-definition.model';
|
||||||
import { BROWSE_BY_COMPONENT_FACTORY } from './browse-by-decorator';
|
import { BehaviorSubject, of as observableOf } from 'rxjs';
|
||||||
|
|
||||||
describe('BrowseBySwitcherComponent', () => {
|
describe('BrowseBySwitcherComponent', () => {
|
||||||
let comp: BrowseBySwitcherComponent;
|
let comp: BrowseBySwitcherComponent;
|
||||||
let fixture: ComponentFixture<BrowseBySwitcherComponent>;
|
let fixture: ComponentFixture<BrowseBySwitcherComponent>;
|
||||||
|
|
||||||
const types = environment.browseBy.types;
|
const types = [
|
||||||
|
Object.assign(
|
||||||
|
new BrowseDefinition(), {
|
||||||
|
id: 'title',
|
||||||
|
dataType: BrowseByDataType.Title,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
Object.assign(
|
||||||
|
new BrowseDefinition(), {
|
||||||
|
id: 'dateissued',
|
||||||
|
dataType: BrowseByDataType.Date,
|
||||||
|
metadataKeys: ['dc.date.issued']
|
||||||
|
}
|
||||||
|
),
|
||||||
|
Object.assign(
|
||||||
|
new BrowseDefinition(), {
|
||||||
|
id: 'author',
|
||||||
|
dataType: BrowseByDataType.Metadata,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
Object.assign(
|
||||||
|
new BrowseDefinition(), {
|
||||||
|
id: 'subject',
|
||||||
|
dataType: BrowseByDataType.Metadata,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
const params = new BehaviorSubject(createParamsWithId('initialValue'));
|
const data = new BehaviorSubject(createDataWithBrowseDefinition(new BrowseDefinition()));
|
||||||
|
|
||||||
const activatedRouteStub = {
|
const activatedRouteStub = {
|
||||||
params: params
|
data
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
@@ -34,20 +60,20 @@ describe('BrowseBySwitcherComponent', () => {
|
|||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
types.forEach((type) => {
|
types.forEach((type: BrowseDefinition) => {
|
||||||
describe(`when switching to a browse-by page for "${type.id}"`, () => {
|
describe(`when switching to a browse-by page for "${type.id}"`, () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
params.next(createParamsWithId(type.id));
|
data.next(createDataWithBrowseDefinition(type));
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should call getComponentByBrowseByType with type "${type.type}"`, () => {
|
it(`should call getComponentByBrowseByType with type "${type.dataType}"`, () => {
|
||||||
expect((comp as any).getComponentByBrowseByType).toHaveBeenCalledWith(type.type);
|
expect((comp as any).getComponentByBrowseByType).toHaveBeenCalledWith(type.dataType);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
export function createParamsWithId(id) {
|
export function createDataWithBrowseDefinition(browseDefinition) {
|
||||||
return { id: id };
|
return { browseDefinition: browseDefinition };
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { Component, Inject, OnInit } from '@angular/core';
|
import { Component, Inject, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { BrowseByTypeConfig } from '../../../config/browse-by-type-config.interface';
|
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { BROWSE_BY_COMPONENT_FACTORY } from './browse-by-decorator';
|
import { BROWSE_BY_COMPONENT_FACTORY } from './browse-by-decorator';
|
||||||
import { environment } from '../../../environments/environment';
|
import { environment } from '../../../environments/environment';
|
||||||
import { GenericConstructor } from '../../core/shared/generic-constructor';
|
import { GenericConstructor } from '../../core/shared/generic-constructor';
|
||||||
|
import { BrowseDefinition } from '../../core/shared/browse-definition.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-browse-by-switcher',
|
selector: 'ds-browse-by-switcher',
|
||||||
@@ -26,15 +26,11 @@ export class BrowseBySwitcherComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch the correct browse-by component by using the relevant config from environment.js
|
* Fetch the correct browse-by component by using the relevant config from the route data
|
||||||
*/
|
*/
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.browseByComponent = this.route.params.pipe(
|
this.browseByComponent = this.route.data.pipe(
|
||||||
map((params) => {
|
map((data: { browseDefinition: BrowseDefinition }) => this.getComponentByBrowseByType(data.browseDefinition.dataType))
|
||||||
const id = params.id;
|
|
||||||
return environment.browseBy.types.find((config: BrowseByTypeConfig) => config.id === id);
|
|
||||||
}),
|
|
||||||
map((config: BrowseByTypeConfig) => this.getComponentByBrowseByType(config.type))
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@ import { BrowseEntrySearchOptions } from '../../core/browse/browse-entry-search-
|
|||||||
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
||||||
import { BrowseService } from '../../core/browse/browse.service';
|
import { BrowseService } from '../../core/browse/browse.service';
|
||||||
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
||||||
import { BrowseByType, rendersBrowseBy } from '../browse-by-switcher/browse-by-decorator';
|
import { BrowseByDataType, rendersBrowseBy } from '../browse-by-switcher/browse-by-decorator';
|
||||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||||
@@ -23,7 +23,7 @@ import { PaginationComponentOptions } from '../../shared/pagination/pagination-c
|
|||||||
/**
|
/**
|
||||||
* Component for browsing items by title (dc.title)
|
* Component for browsing items by title (dc.title)
|
||||||
*/
|
*/
|
||||||
@rendersBrowseBy(BrowseByType.Title)
|
@rendersBrowseBy(BrowseByDataType.Title)
|
||||||
export class BrowseByTitlePageComponent extends BrowseByMetadataPageComponent {
|
export class BrowseByTitlePageComponent extends BrowseByMetadataPageComponent {
|
||||||
|
|
||||||
public constructor(protected route: ActivatedRoute,
|
public constructor(protected route: ActivatedRoute,
|
||||||
|
@@ -106,6 +106,21 @@ export class BrowseDefinitionDataService {
|
|||||||
findAllByHref(href: string, findListOptions: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<BrowseDefinition>[]): Observable<RemoteData<PaginatedList<BrowseDefinition>>> {
|
findAllByHref(href: string, findListOptions: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<BrowseDefinition>[]): Observable<RemoteData<PaginatedList<BrowseDefinition>>> {
|
||||||
return this.dataService.findAllByHref(href, findListOptions, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
return this.dataService.findAllByHref(href, findListOptions, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an observable of {@link RemoteData} of an object, based on its ID, with a list of
|
||||||
|
* {@link FollowLinkConfig}, to automatically resolve {@link HALLink}s of the object
|
||||||
|
* @param id ID of object we want to retrieve
|
||||||
|
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
|
||||||
|
* no valid cached version. Defaults to true
|
||||||
|
* @param reRequestOnStale Whether or not the request should automatically be re-
|
||||||
|
* requested after the response becomes stale
|
||||||
|
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which
|
||||||
|
* {@link HALLink}s should be automatically resolved
|
||||||
|
*/
|
||||||
|
findById(id: string, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<BrowseDefinition>[]): Observable<RemoteData<BrowseDefinition>> {
|
||||||
|
return this.dataService.findById(id, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tslint:enable:max-classes-per-file */
|
/* tslint:enable:max-classes-per-file */
|
||||||
|
@@ -6,6 +6,7 @@ import { BROWSE_DEFINITION } from './browse-definition.resource-type';
|
|||||||
import { HALLink } from './hal-link.model';
|
import { HALLink } from './hal-link.model';
|
||||||
import { ResourceType } from './resource-type';
|
import { ResourceType } from './resource-type';
|
||||||
import { SortOption } from './sort-option.model';
|
import { SortOption } from './sort-option.model';
|
||||||
|
import { BrowseByDataType } from '../../browse-by/browse-by-switcher/browse-by-decorator';
|
||||||
|
|
||||||
@typedObject
|
@typedObject
|
||||||
export class BrowseDefinition extends CacheableObject {
|
export class BrowseDefinition extends CacheableObject {
|
||||||
@@ -33,6 +34,9 @@ export class BrowseDefinition extends CacheableObject {
|
|||||||
@autoserializeAs('metadata')
|
@autoserializeAs('metadata')
|
||||||
metadataKeys: string[];
|
metadataKeys: string[];
|
||||||
|
|
||||||
|
@autoserializeAs('dataType')
|
||||||
|
dataType: BrowseByDataType;
|
||||||
|
|
||||||
get self(): string {
|
get self(): string {
|
||||||
return this._links.self.href;
|
return this._links.self.href;
|
||||||
}
|
}
|
||||||
|
@@ -13,15 +13,48 @@ import { MenuService } from '../shared/menu/menu.service';
|
|||||||
import { MenuServiceStub } from '../shared/testing/menu-service.stub';
|
import { MenuServiceStub } from '../shared/testing/menu-service.stub';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
|
import { BrowseService } from '../core/browse/browse.service';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../shared/remote-data.utils';
|
||||||
|
import { buildPaginatedList } from '../core/data/paginated-list.model';
|
||||||
|
import { BrowseDefinition } from '../core/shared/browse-definition.model';
|
||||||
|
import { BrowseByDataType } from '../browse-by/browse-by-switcher/browse-by-decorator';
|
||||||
|
|
||||||
let comp: NavbarComponent;
|
let comp: NavbarComponent;
|
||||||
let fixture: ComponentFixture<NavbarComponent>;
|
let fixture: ComponentFixture<NavbarComponent>;
|
||||||
|
|
||||||
describe('NavbarComponent', () => {
|
describe('NavbarComponent', () => {
|
||||||
const menuService = new MenuServiceStub();
|
const menuService = new MenuServiceStub();
|
||||||
|
let browseDefinitions;
|
||||||
// waitForAsync beforeEach
|
// waitForAsync beforeEach
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
|
browseDefinitions = [
|
||||||
|
Object.assign(
|
||||||
|
new BrowseDefinition(), {
|
||||||
|
id: 'title',
|
||||||
|
dataType: BrowseByDataType.Title,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
Object.assign(
|
||||||
|
new BrowseDefinition(), {
|
||||||
|
id: 'dateissued',
|
||||||
|
dataType: BrowseByDataType.Date,
|
||||||
|
metadataKeys: ['dc.date.issued']
|
||||||
|
}
|
||||||
|
),
|
||||||
|
Object.assign(
|
||||||
|
new BrowseDefinition(), {
|
||||||
|
id: 'author',
|
||||||
|
dataType: BrowseByDataType.Metadata,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
Object.assign(
|
||||||
|
new BrowseDefinition(), {
|
||||||
|
id: 'subject',
|
||||||
|
dataType: BrowseByDataType.Metadata,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
TranslateModule.forRoot(),
|
TranslateModule.forRoot(),
|
||||||
@@ -33,7 +66,8 @@ describe('NavbarComponent', () => {
|
|||||||
Injector,
|
Injector,
|
||||||
{ provide: MenuService, useValue: menuService },
|
{ provide: MenuService, useValue: menuService },
|
||||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(800) },
|
{ provide: HostWindowService, useValue: new HostWindowServiceStub(800) },
|
||||||
{ provide: ActivatedRoute, useValue: {} }
|
{ provide: ActivatedRoute, useValue: {} },
|
||||||
|
{ provide: BrowseService, useValue: { getBrowseDefinitions: createSuccessfulRemoteDataObject$(buildPaginatedList(undefined, browseDefinitions)) } }
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
})
|
})
|
||||||
|
@@ -2,8 +2,6 @@ import { Component, Input, OnInit } from '@angular/core';
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { ActivatedRoute, Params, Router } from '@angular/router';
|
import { ActivatedRoute, Params, Router } from '@angular/router';
|
||||||
import { BrowseByTypeConfig } from '../../../config/browse-by-type-config.interface';
|
|
||||||
import { environment } from '../../../environments/environment';
|
|
||||||
import { getCommunityPageRoute } from '../../community-page/community-page-routing-paths';
|
import { getCommunityPageRoute } from '../../community-page/community-page-routing-paths';
|
||||||
import { getCollectionPageRoute } from '../../collection-page/collection-page-routing-paths';
|
import { getCollectionPageRoute } from '../../collection-page/collection-page-routing-paths';
|
||||||
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
|
||||||
@@ -34,10 +32,6 @@ export class ComcolPageBrowseByComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
@Input() id: string;
|
@Input() id: string;
|
||||||
@Input() contentType: string;
|
@Input() contentType: string;
|
||||||
/**
|
|
||||||
* List of currently active browse configurations
|
|
||||||
*/
|
|
||||||
types: BrowseByTypeConfig[];
|
|
||||||
|
|
||||||
allOptions: ComColPageNavOption[];
|
allOptions: ComColPageNavOption[];
|
||||||
|
|
||||||
@@ -46,7 +40,7 @@ export class ComcolPageBrowseByComponent implements OnInit {
|
|||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
public browseService: BrowseService
|
private browseService: BrowseService
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,23 +56,23 @@ export class ComcolPageBrowseByComponent implements OnInit {
|
|||||||
routerLink: `/browse/${config.id}`,
|
routerLink: `/browse/${config.id}`,
|
||||||
params: { scope: this.id }
|
params: { scope: this.id }
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
if (this.contentType === 'collection') {
|
||||||
|
this.allOptions = [{
|
||||||
|
id: this.id,
|
||||||
|
label: 'collection.page.browse.recent.head',
|
||||||
|
routerLink: getCollectionPageRoute(this.id)
|
||||||
|
}, ...this.allOptions];
|
||||||
|
} else if (this.contentType === 'community') {
|
||||||
|
this.allOptions = [{
|
||||||
|
id: this.id,
|
||||||
|
label: 'community.all-lists.head',
|
||||||
|
routerLink: getCommunityPageRoute(this.id)
|
||||||
|
}, ...this.allOptions];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.contentType === 'collection') {
|
|
||||||
this.allOptions = [{
|
|
||||||
id: this.id,
|
|
||||||
label: 'collection.page.browse.recent.head',
|
|
||||||
routerLink: getCollectionPageRoute(this.id)
|
|
||||||
}, ...this.allOptions];
|
|
||||||
} else if (this.contentType === 'community') {
|
|
||||||
this.allOptions = [{
|
|
||||||
id: this.id,
|
|
||||||
label: 'community.all-lists.head',
|
|
||||||
routerLink: getCommunityPageRoute(this.id)
|
|
||||||
}, ...this.allOptions];
|
|
||||||
}
|
|
||||||
|
|
||||||
this.currentOptionId$ = this.route.params.pipe(
|
this.currentOptionId$ = this.route.params.pipe(
|
||||||
map((params: Params) => params.id)
|
map((params: Params) => params.id)
|
||||||
);
|
);
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
import { Config } from './config.interface';
|
import { Config } from './config.interface';
|
||||||
import { BrowseByTypeConfig } from './browse-by-type-config.interface';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Config that determines how the dropdown list of years are created for browse-by-date components
|
* Config that determines how the dropdown list of years are created for browse-by-date components
|
||||||
@@ -19,9 +18,4 @@ export interface BrowseByConfig extends Config {
|
|||||||
* The absolute lowest year to display in the dropdown when no lowest date can be found for all items
|
* The absolute lowest year to display in the dropdown when no lowest date can be found for all items
|
||||||
*/
|
*/
|
||||||
defaultLowerLimit: number;
|
defaultLowerLimit: number;
|
||||||
|
|
||||||
/**
|
|
||||||
* A list of all the active Browse-By pages
|
|
||||||
*/
|
|
||||||
types: BrowseByTypeConfig[];
|
|
||||||
}
|
}
|
||||||
|
@@ -1,23 +0,0 @@
|
|||||||
import { Config } from './config.interface';
|
|
||||||
import { BrowseByType } from '../app/browse-by/browse-by-switcher/browse-by-decorator';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Config used for rendering Browse-By pages and links
|
|
||||||
*/
|
|
||||||
export interface BrowseByTypeConfig extends Config {
|
|
||||||
/**
|
|
||||||
* The browse id used for fetching browse data from the rest api
|
|
||||||
* e.g. author
|
|
||||||
*/
|
|
||||||
id: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The type of Browse-By page to render
|
|
||||||
*/
|
|
||||||
type: BrowseByType | string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The metadata field to use for rendering starts-with options (only necessary when type is set to BrowseByType.Date)
|
|
||||||
*/
|
|
||||||
metadataField?: string;
|
|
||||||
}
|
|
@@ -6,13 +6,13 @@ import { INotificationBoardOptions } from './notifications-config.interfaces';
|
|||||||
import { SubmissionConfig } from './submission-config.interface';
|
import { SubmissionConfig } from './submission-config.interface';
|
||||||
import { FormConfig } from './form-config.interfaces';
|
import { FormConfig } from './form-config.interfaces';
|
||||||
import { LangConfig } from './lang-config.interface';
|
import { LangConfig } from './lang-config.interface';
|
||||||
import { BrowseByConfig } from './browse-by-config.interface';
|
|
||||||
import { ItemPageConfig } from './item-page-config.interface';
|
import { ItemPageConfig } from './item-page-config.interface';
|
||||||
import { CollectionPageConfig } from './collection-page-config.interface';
|
import { CollectionPageConfig } from './collection-page-config.interface';
|
||||||
import { ThemeConfig } from './theme.model';
|
import { ThemeConfig } from './theme.model';
|
||||||
import { AuthConfig } from './auth-config.interfaces';
|
import { AuthConfig } from './auth-config.interfaces';
|
||||||
import { UIServerConfig } from './ui-server-config.interface';
|
import { UIServerConfig } from './ui-server-config.interface';
|
||||||
import { MediaViewerConfig } from './media-viewer-config.interface';
|
import { MediaViewerConfig } from './media-viewer-config.interface';
|
||||||
|
import { BrowseByConfig } from './browse-by-config.interface';
|
||||||
|
|
||||||
export interface GlobalConfig extends Config {
|
export interface GlobalConfig extends Config {
|
||||||
ui: UIServerConfig;
|
ui: UIServerConfig;
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import { GlobalConfig } from '../config/global-config.interface';
|
import { GlobalConfig } from '../config/global-config.interface';
|
||||||
import { NotificationAnimationsType } from '../app/shared/notifications/models/notification-animations-type';
|
import { NotificationAnimationsType } from '../app/shared/notifications/models/notification-animations-type';
|
||||||
import { BrowseByType } from '../app/browse-by/browse-by-switcher/browse-by-decorator';
|
|
||||||
import { RestRequestMethod } from '../app/core/data/rest-request-method';
|
import { RestRequestMethod } from '../app/core/data/rest-request-method';
|
||||||
|
|
||||||
export const environment: GlobalConfig = {
|
export const environment: GlobalConfig = {
|
||||||
@@ -207,32 +206,6 @@ export const environment: GlobalConfig = {
|
|||||||
fiveYearLimit: 30,
|
fiveYearLimit: 30,
|
||||||
// The absolute lowest year to display in the dropdown (only used when no lowest date can be found for all items)
|
// The absolute lowest year to display in the dropdown (only used when no lowest date can be found for all items)
|
||||||
defaultLowerLimit: 1900,
|
defaultLowerLimit: 1900,
|
||||||
// List of all the active Browse-By types
|
|
||||||
// Adding a type will activate their Browse-By page and add them to the global navigation menu,
|
|
||||||
// as well as community and collection pages
|
|
||||||
// Allowed fields and their purpose:
|
|
||||||
// id: The browse id to use for fetching info from the rest api
|
|
||||||
// type: The type of Browse-By page to display
|
|
||||||
// metadataField: The metadata-field used to create starts-with options (only necessary when the type is set to 'date')
|
|
||||||
types: [
|
|
||||||
{
|
|
||||||
id: 'title',
|
|
||||||
type: BrowseByType.Title,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'dateissued',
|
|
||||||
type: BrowseByType.Date,
|
|
||||||
metadataField: 'dc.date.issued'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'author',
|
|
||||||
type: BrowseByType.Metadata
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'subject',
|
|
||||||
type: BrowseByType.Metadata
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
item: {
|
item: {
|
||||||
edit: {
|
edit: {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
// This configuration is only used for unit tests, end-to-end tests use environment.prod.ts
|
// This configuration is only used for unit tests, end-to-end tests use environment.prod.ts
|
||||||
import { BrowseByType } from '../app/browse-by/browse-by-switcher/browse-by-decorator';
|
import { BrowseByDataType } from '../app/browse-by/browse-by-switcher/browse-by-decorator';
|
||||||
import { RestRequestMethod } from '../app/core/data/rest-request-method';
|
import { RestRequestMethod } from '../app/core/data/rest-request-method';
|
||||||
import { NotificationAnimationsType } from '../app/shared/notifications/models/notification-animations-type';
|
import { NotificationAnimationsType } from '../app/shared/notifications/models/notification-animations-type';
|
||||||
import { GlobalConfig } from '../config/global-config.interface';
|
import { GlobalConfig } from '../config/global-config.interface';
|
||||||
@@ -169,32 +169,6 @@ export const environment: Partial<GlobalConfig> = {
|
|||||||
fiveYearLimit: 30,
|
fiveYearLimit: 30,
|
||||||
// The absolute lowest year to display in the dropdown (only used when no lowest date can be found for all items)
|
// The absolute lowest year to display in the dropdown (only used when no lowest date can be found for all items)
|
||||||
defaultLowerLimit: 1900,
|
defaultLowerLimit: 1900,
|
||||||
// List of all the active Browse-By types
|
|
||||||
// Adding a type will activate their Browse-By page and add them to the global navigation menu,
|
|
||||||
// as well as community and collection pages
|
|
||||||
// Allowed fields and their purpose:
|
|
||||||
// id: The browse id to use for fetching info from the rest api
|
|
||||||
// type: The type of Browse-By page to display
|
|
||||||
// metadataField: The metadata-field used to create starts-with options (only necessary when the type is set to 'date')
|
|
||||||
types: [
|
|
||||||
{
|
|
||||||
id: 'title',
|
|
||||||
type: BrowseByType.Title,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'dateissued',
|
|
||||||
type: BrowseByType.Date,
|
|
||||||
metadataField: 'dc.date.issued'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'author',
|
|
||||||
type: BrowseByType.Metadata
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'subject',
|
|
||||||
type: BrowseByType.Metadata
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
item: {
|
item: {
|
||||||
edit: {
|
edit: {
|
||||||
|
Reference in New Issue
Block a user