mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-09 19:13:08 +00:00
Merge remote-tracking branch 'origin/main' into CST-6685
This commit is contained in:
@@ -174,6 +174,8 @@ browseBy:
|
|||||||
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
|
||||||
|
# If true, thumbnail images for items will be added to BOTH search and browse result lists.
|
||||||
|
showThumbnails: true
|
||||||
# The number of entries in a paginated browse results list.
|
# The number of entries in a paginated browse results list.
|
||||||
# Rounded to the nearest size in the list of selectable sizes on the
|
# Rounded to the nearest size in the list of selectable sizes on the
|
||||||
# settings menu.
|
# settings menu.
|
||||||
@@ -268,7 +270,7 @@ themes:
|
|||||||
|
|
||||||
# The default bundles that should always be displayed as suggestions when you upload a new bundle
|
# The default bundles that should always be displayed as suggestions when you upload a new bundle
|
||||||
bundle:
|
bundle:
|
||||||
- standardBundles: [ ORIGINAL, THUMBNAIL, LICENSE ]
|
standardBundles: [ ORIGINAL, THUMBNAIL, LICENSE ]
|
||||||
|
|
||||||
# Whether to enable media viewer for image and/or video Bitstreams (i.e. Bitstreams whose MIME type starts with 'image' or 'video').
|
# Whether to enable media viewer for image and/or video Bitstreams (i.e. Bitstreams whose MIME type starts with 'image' or 'video').
|
||||||
# For images, this enables a gallery viewer where you can zoom or page through images.
|
# For images, this enables a gallery viewer where you can zoom or page through images.
|
||||||
|
@@ -14,6 +14,14 @@ import { By } from '@angular/platform-browser';
|
|||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { getCollectionEditRoute } from '../../../../../collection-page/collection-page-routing-paths';
|
import { getCollectionEditRoute } from '../../../../../collection-page/collection-page-routing-paths';
|
||||||
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
||||||
|
import { AuthService } from '../../../../../core/auth/auth.service';
|
||||||
|
import { AuthServiceStub } from '../../../../../shared/testing/auth-service.stub';
|
||||||
|
import { FileService } from '../../../../../core/shared/file.service';
|
||||||
|
import { FileServiceStub } from '../../../../../shared/testing/file-service.stub';
|
||||||
|
import { AuthorizationDataService } from '../../../../../core/data/feature-authorization/authorization-data.service';
|
||||||
|
import { AuthorizationDataServiceStub } from '../../../../../shared/testing/authorization-service.stub';
|
||||||
|
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
|
||||||
|
import { getMockThemeService } from '../../../../../shared/mocks/theme-service.mock';
|
||||||
|
|
||||||
describe('CollectionAdminSearchResultGridElementComponent', () => {
|
describe('CollectionAdminSearchResultGridElementComponent', () => {
|
||||||
let component: CollectionAdminSearchResultGridElementComponent;
|
let component: CollectionAdminSearchResultGridElementComponent;
|
||||||
@@ -45,7 +53,11 @@ describe('CollectionAdminSearchResultGridElementComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: TruncatableService, useValue: mockTruncatableService },
|
{ provide: TruncatableService, useValue: mockTruncatableService },
|
||||||
{ provide: BitstreamDataService, useValue: {} },
|
{ provide: BitstreamDataService, useValue: {} },
|
||||||
{ provide: LinkService, useValue: linkService }
|
{ provide: LinkService, useValue: linkService },
|
||||||
|
{ provide: AuthService, useClass: AuthServiceStub },
|
||||||
|
{ provide: FileService, useClass: FileServiceStub },
|
||||||
|
{ provide: AuthorizationDataService, useClass: AuthorizationDataServiceStub },
|
||||||
|
{ provide: ThemeService, useValue: getMockThemeService() },
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
@@ -16,6 +16,14 @@ import { CommunitySearchResult } from '../../../../../shared/object-collection/s
|
|||||||
import { Community } from '../../../../../core/shared/community.model';
|
import { Community } from '../../../../../core/shared/community.model';
|
||||||
import { getCommunityEditRoute } from '../../../../../community-page/community-page-routing-paths';
|
import { getCommunityEditRoute } from '../../../../../community-page/community-page-routing-paths';
|
||||||
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
||||||
|
import { AuthService } from '../../../../../core/auth/auth.service';
|
||||||
|
import { AuthServiceStub } from '../../../../../shared/testing/auth-service.stub';
|
||||||
|
import { FileService } from '../../../../../core/shared/file.service';
|
||||||
|
import { FileServiceStub } from '../../../../../shared/testing/file-service.stub';
|
||||||
|
import { AuthorizationDataService } from '../../../../../core/data/feature-authorization/authorization-data.service';
|
||||||
|
import { AuthorizationDataServiceStub } from '../../../../../shared/testing/authorization-service.stub';
|
||||||
|
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
|
||||||
|
import { getMockThemeService } from '../../../../../shared/mocks/theme-service.mock';
|
||||||
|
|
||||||
describe('CommunityAdminSearchResultGridElementComponent', () => {
|
describe('CommunityAdminSearchResultGridElementComponent', () => {
|
||||||
let component: CommunityAdminSearchResultGridElementComponent;
|
let component: CommunityAdminSearchResultGridElementComponent;
|
||||||
@@ -47,7 +55,11 @@ describe('CommunityAdminSearchResultGridElementComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: TruncatableService, useValue: mockTruncatableService },
|
{ provide: TruncatableService, useValue: mockTruncatableService },
|
||||||
{ provide: BitstreamDataService, useValue: {} },
|
{ provide: BitstreamDataService, useValue: {} },
|
||||||
{ provide: LinkService, useValue: linkService }
|
{ provide: LinkService, useValue: linkService },
|
||||||
|
{ provide: AuthService, useClass: AuthServiceStub },
|
||||||
|
{ provide: FileService, useClass: FileServiceStub },
|
||||||
|
{ provide: AuthorizationDataService, useClass: AuthorizationDataServiceStub },
|
||||||
|
{ provide: ThemeService, useValue: getMockThemeService() },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
})
|
})
|
||||||
|
@@ -20,6 +20,12 @@ import { getMockThemeService } from '../../../../../shared/mocks/theme-service.m
|
|||||||
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
|
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
|
||||||
import { AccessStatusDataService } from '../../../../../core/data/access-status-data.service';
|
import { AccessStatusDataService } from '../../../../../core/data/access-status-data.service';
|
||||||
import { AccessStatusObject } from '../../../../../shared/object-list/access-status-badge/access-status.model';
|
import { AccessStatusObject } from '../../../../../shared/object-list/access-status-badge/access-status.model';
|
||||||
|
import { AuthService } from '../../../../../core/auth/auth.service';
|
||||||
|
import { AuthServiceStub } from '../../../../../shared/testing/auth-service.stub';
|
||||||
|
import { FileService } from '../../../../../core/shared/file.service';
|
||||||
|
import { FileServiceStub } from '../../../../../shared/testing/file-service.stub';
|
||||||
|
import { AuthorizationDataService } from '../../../../../core/data/feature-authorization/authorization-data.service';
|
||||||
|
import { AuthorizationDataServiceStub } from '../../../../../shared/testing/authorization-service.stub';
|
||||||
|
|
||||||
describe('ItemAdminSearchResultGridElementComponent', () => {
|
describe('ItemAdminSearchResultGridElementComponent', () => {
|
||||||
let component: ItemAdminSearchResultGridElementComponent;
|
let component: ItemAdminSearchResultGridElementComponent;
|
||||||
@@ -64,6 +70,9 @@ describe('ItemAdminSearchResultGridElementComponent', () => {
|
|||||||
{ provide: BitstreamDataService, useValue: mockBitstreamDataService },
|
{ provide: BitstreamDataService, useValue: mockBitstreamDataService },
|
||||||
{ provide: ThemeService, useValue: mockThemeService },
|
{ provide: ThemeService, useValue: mockThemeService },
|
||||||
{ provide: AccessStatusDataService, useValue: mockAccessStatusDataService },
|
{ provide: AccessStatusDataService, useValue: mockAccessStatusDataService },
|
||||||
|
{ provide: AuthService, useClass: AuthServiceStub },
|
||||||
|
{ provide: FileService, useClass: FileServiceStub },
|
||||||
|
{ provide: AuthorizationDataService, useClass: AuthorizationDataServiceStub },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
})
|
})
|
||||||
|
@@ -13,6 +13,8 @@ import { RouterTestingModule } from '@angular/router/testing';
|
|||||||
import { getCollectionEditRoute } from '../../../../../collection-page/collection-page-routing-paths';
|
import { getCollectionEditRoute } from '../../../../../collection-page/collection-page-routing-paths';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||||
|
import { environment } from '../../../../../../environments/environment';
|
||||||
|
|
||||||
describe('CollectionAdminSearchResultListElementComponent', () => {
|
describe('CollectionAdminSearchResultListElementComponent', () => {
|
||||||
let component: CollectionAdminSearchResultListElementComponent;
|
let component: CollectionAdminSearchResultListElementComponent;
|
||||||
@@ -36,7 +38,8 @@ describe('CollectionAdminSearchResultListElementComponent', () => {
|
|||||||
],
|
],
|
||||||
declarations: [CollectionAdminSearchResultListElementComponent],
|
declarations: [CollectionAdminSearchResultListElementComponent],
|
||||||
providers: [{ provide: TruncatableService, useValue: {} },
|
providers: [{ provide: TruncatableService, useValue: {} },
|
||||||
{ provide: DSONameService, useClass: DSONameServiceMock }],
|
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||||
|
{ provide: APP_CONFIG, useValue: environment }],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
@@ -13,6 +13,8 @@ import { Community } from '../../../../../core/shared/community.model';
|
|||||||
import { getCommunityEditRoute } from '../../../../../community-page/community-page-routing-paths';
|
import { getCommunityEditRoute } from '../../../../../community-page/community-page-routing-paths';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||||
|
import { environment } from '../../../../../../environments/environment';
|
||||||
|
|
||||||
describe('CommunityAdminSearchResultListElementComponent', () => {
|
describe('CommunityAdminSearchResultListElementComponent', () => {
|
||||||
let component: CommunityAdminSearchResultListElementComponent;
|
let component: CommunityAdminSearchResultListElementComponent;
|
||||||
@@ -36,7 +38,8 @@ describe('CommunityAdminSearchResultListElementComponent', () => {
|
|||||||
],
|
],
|
||||||
declarations: [CommunityAdminSearchResultListElementComponent],
|
declarations: [CommunityAdminSearchResultListElementComponent],
|
||||||
providers: [{ provide: TruncatableService, useValue: {} },
|
providers: [{ provide: TruncatableService, useValue: {} },
|
||||||
{ provide: DSONameService, useClass: DSONameServiceMock }],
|
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||||
|
{ provide: APP_CONFIG, useValue: environment }],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
@@ -10,6 +10,8 @@ import { ItemAdminSearchResultListElementComponent } from './item-admin-search-r
|
|||||||
import { Item } from '../../../../../core/shared/item.model';
|
import { Item } from '../../../../../core/shared/item.model';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||||
|
import { environment } from '../../../../../../environments/environment';
|
||||||
|
|
||||||
describe('ItemAdminSearchResultListElementComponent', () => {
|
describe('ItemAdminSearchResultListElementComponent', () => {
|
||||||
let component: ItemAdminSearchResultListElementComponent;
|
let component: ItemAdminSearchResultListElementComponent;
|
||||||
@@ -33,7 +35,8 @@ describe('ItemAdminSearchResultListElementComponent', () => {
|
|||||||
],
|
],
|
||||||
declarations: [ItemAdminSearchResultListElementComponent],
|
declarations: [ItemAdminSearchResultListElementComponent],
|
||||||
providers: [{ provide: TruncatableService, useValue: {} },
|
providers: [{ provide: TruncatableService, useValue: {} },
|
||||||
{ provide: DSONameService, useClass: DSONameServiceMock }],
|
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||||
|
{ provide: APP_CONFIG, useValue: environment }],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
@@ -18,6 +18,8 @@ import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-
|
|||||||
import { getMockLinkService } from '../../../../../shared/mocks/link-service.mock';
|
import { getMockLinkService } from '../../../../../shared/mocks/link-service.mock';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||||
|
import { environment } from '../../../../../../environments/environment';
|
||||||
|
|
||||||
describe('WorkflowItemAdminWorkflowListElementComponent', () => {
|
describe('WorkflowItemAdminWorkflowListElementComponent', () => {
|
||||||
let component: WorkflowItemSearchResultAdminWorkflowListElementComponent;
|
let component: WorkflowItemSearchResultAdminWorkflowListElementComponent;
|
||||||
@@ -51,7 +53,8 @@ describe('WorkflowItemAdminWorkflowListElementComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: TruncatableService, useValue: mockTruncatableService },
|
{ provide: TruncatableService, useValue: mockTruncatableService },
|
||||||
{ provide: LinkService, useValue: linkService },
|
{ provide: LinkService, useValue: linkService },
|
||||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||||
|
{ provide: APP_CONFIG, useValue: environment }
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
})
|
})
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, Inject, OnInit } from '@angular/core';
|
||||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||||
import { listableObjectComponent } from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
import { listableObjectComponent } from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
import { Context } from '../../../../../core/shared/context.model';
|
import { Context } from '../../../../../core/shared/context.model';
|
||||||
@@ -13,6 +13,7 @@ import { SearchResultListElementComponent } from '../../../../../shared/object-l
|
|||||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||||
import { WorkflowItemSearchResult } from '../../../../../shared/object-collection/shared/workflow-item-search-result.model';
|
import { WorkflowItemSearchResult } from '../../../../../shared/object-collection/shared/workflow-item-search-result.model';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
|
import { APP_CONFIG, AppConfig } from '../../../../../../config/app-config.interface';
|
||||||
|
|
||||||
@listableObjectComponent(WorkflowItemSearchResult, ViewMode.ListElement, Context.AdminWorkflowSearch)
|
@listableObjectComponent(WorkflowItemSearchResult, ViewMode.ListElement, Context.AdminWorkflowSearch)
|
||||||
@Component({
|
@Component({
|
||||||
@@ -32,9 +33,10 @@ export class WorkflowItemSearchResultAdminWorkflowListElementComponent extends S
|
|||||||
|
|
||||||
constructor(private linkService: LinkService,
|
constructor(private linkService: LinkService,
|
||||||
protected truncatableService: TruncatableService,
|
protected truncatableService: TruncatableService,
|
||||||
protected dsoNameService: DSONameService
|
protected dsoNameService: DSONameService,
|
||||||
|
@Inject(APP_CONFIG) protected appConfig: AppConfig
|
||||||
) {
|
) {
|
||||||
super(truncatableService, dsoNameService);
|
super(truncatableService, dsoNameService, appConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -18,13 +18,10 @@ import { BrowseEntrySearchOptions } from '../../core/browse/browse-entry-search-
|
|||||||
import { toRemoteData } from '../browse-by-metadata-page/browse-by-metadata-page.component.spec';
|
import { toRemoteData } from '../browse-by-metadata-page/browse-by-metadata-page.component.spec';
|
||||||
import { VarDirective } from '../../shared/utils/var.directive';
|
import { VarDirective } from '../../shared/utils/var.directive';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
|
||||||
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
|
||||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||||
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
||||||
import { FindListOptions } from '../../core/data/find-list-options.model';
|
import { APP_CONFIG } from '../../../config/app-config.interface';
|
||||||
import { APP_CONFIG } from 'src/config/app-config.interface';
|
import { environment } from '../../../environments/environment';
|
||||||
import { environment } from 'src/environments/environment';
|
|
||||||
|
|
||||||
describe('BrowseByDatePageComponent', () => {
|
describe('BrowseByDatePageComponent', () => {
|
||||||
let comp: BrowseByDatePageComponent;
|
let comp: BrowseByDatePageComponent;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
|
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
BrowseByMetadataPageComponent,
|
BrowseByMetadataPageComponent,
|
||||||
browseParamsToOptions
|
browseParamsToOptions, getBrowseSearchOptions
|
||||||
} from '../browse-by-metadata-page/browse-by-metadata-page.component';
|
} from '../browse-by-metadata-page/browse-by-metadata-page.component';
|
||||||
import { BrowseEntrySearchOptions } from '../../core/browse/browse-entry-search-options.model';
|
|
||||||
import { combineLatest as observableCombineLatest } from 'rxjs';
|
import { combineLatest as observableCombineLatest } from 'rxjs';
|
||||||
import { RemoteData } from '../../core/data/remote-data';
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
import { Item } from '../../core/shared/item.model';
|
import { Item } from '../../core/shared/item.model';
|
||||||
@@ -13,7 +12,6 @@ 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 { BrowseByDataType, rendersBrowseBy } from '../browse-by-switcher/browse-by-decorator';
|
import { BrowseByDataType, rendersBrowseBy } from '../browse-by-switcher/browse-by-decorator';
|
||||||
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';
|
||||||
@@ -45,14 +43,15 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent {
|
|||||||
protected router: Router,
|
protected router: Router,
|
||||||
protected paginationService: PaginationService,
|
protected paginationService: PaginationService,
|
||||||
protected cdRef: ChangeDetectorRef,
|
protected cdRef: ChangeDetectorRef,
|
||||||
@Inject(APP_CONFIG) protected appConfig: AppConfig) {
|
@Inject(APP_CONFIG) public appConfig: AppConfig) {
|
||||||
super(route, browseService, dsoService, paginationService, router, appConfig);
|
super(route, browseService, dsoService, paginationService, router, appConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
const sortConfig = new SortOptions('default', SortDirection.ASC);
|
const sortConfig = new SortOptions('default', SortDirection.ASC);
|
||||||
this.startsWithType = StartsWithType.date;
|
this.startsWithType = StartsWithType.date;
|
||||||
this.updatePage(new BrowseEntrySearchOptions(this.defaultBrowseId, this.paginationConfig, sortConfig));
|
// include the thumbnail configuration in browse search options
|
||||||
|
this.updatePage(getBrowseSearchOptions(this.defaultBrowseId, this.paginationConfig, sortConfig, this.fetchThumbnails));
|
||||||
this.currentPagination$ = this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig);
|
this.currentPagination$ = this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig);
|
||||||
this.currentSort$ = this.paginationService.getCurrentSort(this.paginationConfig.id, sortConfig);
|
this.currentSort$ = this.paginationService.getCurrentSort(this.paginationConfig.id, sortConfig);
|
||||||
this.subs.push(
|
this.subs.push(
|
||||||
@@ -65,7 +64,7 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent {
|
|||||||
const metadataKeys = params.browseDefinition ? params.browseDefinition.metadataKeys : this.defaultMetadataKeys;
|
const metadataKeys = params.browseDefinition ? params.browseDefinition.metadataKeys : this.defaultMetadataKeys;
|
||||||
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.fetchThumbnails);
|
||||||
this.updatePageWithItems(searchOptions, this.value, undefined);
|
this.updatePageWithItems(searchOptions, this.value, undefined);
|
||||||
this.updateParent(params.scope);
|
this.updateParent(params.scope);
|
||||||
this.updateStartsWithOptions(this.browseId, metadataKeys, params.scope);
|
this.updateStartsWithOptions(this.browseId, metadataKeys, params.scope);
|
||||||
@@ -85,7 +84,7 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent {
|
|||||||
updateStartsWithOptions(definition: string, metadataKeys: string[], scope?: string) {
|
updateStartsWithOptions(definition: string, metadataKeys: string[], 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 = this.appConfig.browseBy.defaultLowerLimit;
|
||||||
if (hasValue(firstItemRD.payload)) {
|
if (hasValue(firstItemRD.payload)) {
|
||||||
const date = firstItemRD.payload.firstMetadataValue(metadataKeys);
|
const date = firstItemRD.payload.firstMetadataValue(metadataKeys);
|
||||||
if (isNotEmpty(date) && isValidDate(date)) {
|
if (isNotEmpty(date) && isValidDate(date)) {
|
||||||
@@ -96,8 +95,8 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent {
|
|||||||
}
|
}
|
||||||
const options = [];
|
const options = [];
|
||||||
const currentYear = new Date().getUTCFullYear();
|
const currentYear = new Date().getUTCFullYear();
|
||||||
const oneYearBreak = Math.floor((currentYear - environment.browseBy.oneYearLimit) / 5) * 5;
|
const oneYearBreak = Math.floor((currentYear - this.appConfig.browseBy.oneYearLimit) / 5) * 5;
|
||||||
const fiveYearBreak = Math.floor((currentYear - environment.browseBy.fiveYearLimit) / 10) * 10;
|
const fiveYearBreak = Math.floor((currentYear - this.appConfig.browseBy.fiveYearLimit) / 10) * 10;
|
||||||
if (lowerLimit <= fiveYearBreak) {
|
if (lowerLimit <= fiveYearBreak) {
|
||||||
lowerLimit -= 10;
|
lowerLimit -= 10;
|
||||||
} else if (lowerLimit <= oneYearBreak) {
|
} else if (lowerLimit <= oneYearBreak) {
|
||||||
|
@@ -1,4 +1,8 @@
|
|||||||
import { BrowseByMetadataPageComponent, browseParamsToOptions } from './browse-by-metadata-page.component';
|
import {
|
||||||
|
BrowseByMetadataPageComponent,
|
||||||
|
browseParamsToOptions,
|
||||||
|
getBrowseSearchOptions
|
||||||
|
} from './browse-by-metadata-page.component';
|
||||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||||
import { BrowseService } from '../../core/browse/browse.service';
|
import { BrowseService } from '../../core/browse/browse.service';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
@@ -14,7 +18,7 @@ import { RemoteData } from '../../core/data/remote-data';
|
|||||||
import { buildPaginatedList, PaginatedList } from '../../core/data/paginated-list.model';
|
import { buildPaginatedList, PaginatedList } from '../../core/data/paginated-list.model';
|
||||||
import { PageInfo } from '../../core/shared/page-info.model';
|
import { PageInfo } from '../../core/shared/page-info.model';
|
||||||
import { BrowseEntrySearchOptions } from '../../core/browse/browse-entry-search-options.model';
|
import { BrowseEntrySearchOptions } from '../../core/browse/browse-entry-search-options.model';
|
||||||
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
import { SortDirection } from '../../core/cache/models/sort-options.model';
|
||||||
import { Item } from '../../core/shared/item.model';
|
import { Item } from '../../core/shared/item.model';
|
||||||
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
||||||
import { Community } from '../../core/shared/community.model';
|
import { Community } from '../../core/shared/community.model';
|
||||||
@@ -26,7 +30,6 @@ import { PaginationService } from '../../core/pagination/pagination.service';
|
|||||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||||
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
||||||
import { APP_CONFIG } from '../../../config/app-config.interface';
|
import { APP_CONFIG } from '../../../config/app-config.interface';
|
||||||
import { environment } from '../../../environments/environment';
|
|
||||||
|
|
||||||
describe('BrowseByMetadataPageComponent', () => {
|
describe('BrowseByMetadataPageComponent', () => {
|
||||||
let comp: BrowseByMetadataPageComponent;
|
let comp: BrowseByMetadataPageComponent;
|
||||||
@@ -45,6 +48,13 @@ describe('BrowseByMetadataPageComponent', () => {
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const environmentMock = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: true,
|
||||||
|
pageSize: 10
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const mockEntries = [
|
const mockEntries = [
|
||||||
{
|
{
|
||||||
type: BrowseEntry.type,
|
type: BrowseEntry.type,
|
||||||
@@ -100,7 +110,7 @@ describe('BrowseByMetadataPageComponent', () => {
|
|||||||
{ provide: DSpaceObjectDataService, useValue: mockDsoService },
|
{ provide: DSpaceObjectDataService, useValue: mockDsoService },
|
||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
{ provide: Router, useValue: new RouterMock() },
|
{ provide: Router, useValue: new RouterMock() },
|
||||||
{ provide: APP_CONFIG, useValue: environment }
|
{ provide: APP_CONFIG, useValue: environmentMock }
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
@@ -121,6 +131,10 @@ describe('BrowseByMetadataPageComponent', () => {
|
|||||||
expect(comp.items$).toBeUndefined();
|
expect(comp.items$).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should set embed thumbnail property to true', () => {
|
||||||
|
expect(comp.fetchThumbnails).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
describe('when a value is provided', () => {
|
describe('when a value is provided', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
const paramsWithValue = {
|
const paramsWithValue = {
|
||||||
@@ -148,14 +162,14 @@ describe('BrowseByMetadataPageComponent', () => {
|
|||||||
};
|
};
|
||||||
const paginationOptions = Object.assign(new PaginationComponentOptions(), {
|
const paginationOptions = Object.assign(new PaginationComponentOptions(), {
|
||||||
currentPage: 5,
|
currentPage: 5,
|
||||||
pageSize: 10,
|
pageSize: comp.appConfig.browseBy.pageSize,
|
||||||
});
|
});
|
||||||
const sortOptions = {
|
const sortOptions = {
|
||||||
direction: SortDirection.ASC,
|
direction: SortDirection.ASC,
|
||||||
field: 'fake-field',
|
field: 'fake-field',
|
||||||
};
|
};
|
||||||
|
|
||||||
result = browseParamsToOptions(paramsScope, paginationOptions, sortOptions, 'author');
|
result = browseParamsToOptions(paramsScope, paginationOptions, sortOptions, 'author', comp.fetchThumbnails);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return BrowseEntrySearchOptions with the correct properties', () => {
|
it('should return BrowseEntrySearchOptions with the correct properties', () => {
|
||||||
@@ -166,6 +180,36 @@ describe('BrowseByMetadataPageComponent', () => {
|
|||||||
expect(result.sort.direction).toEqual(SortDirection.ASC);
|
expect(result.sort.direction).toEqual(SortDirection.ASC);
|
||||||
expect(result.sort.field).toEqual('fake-field');
|
expect(result.sort.field).toEqual('fake-field');
|
||||||
expect(result.scope).toEqual('fake-scope');
|
expect(result.scope).toEqual('fake-scope');
|
||||||
|
expect(result.fetchThumbnail).toBeTrue();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('calling getBrowseSearchOptions', () => {
|
||||||
|
let result: BrowseEntrySearchOptions;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
const paramsScope = {
|
||||||
|
scope: 'fake-scope'
|
||||||
|
};
|
||||||
|
const paginationOptions = Object.assign(new PaginationComponentOptions(), {
|
||||||
|
currentPage: 5,
|
||||||
|
pageSize: comp.appConfig.browseBy.pageSize,
|
||||||
|
});
|
||||||
|
const sortOptions = {
|
||||||
|
direction: SortDirection.ASC,
|
||||||
|
field: 'fake-field',
|
||||||
|
};
|
||||||
|
|
||||||
|
result = getBrowseSearchOptions('title', paginationOptions, sortOptions, comp.fetchThumbnails);
|
||||||
|
});
|
||||||
|
it('should return BrowseEntrySearchOptions with the correct properties', () => {
|
||||||
|
|
||||||
|
expect(result.metadataDefinition).toEqual('title');
|
||||||
|
expect(result.pagination.currentPage).toEqual(5);
|
||||||
|
expect(result.pagination.pageSize).toEqual(10);
|
||||||
|
expect(result.sort.direction).toEqual(SortDirection.ASC);
|
||||||
|
expect(result.sort.field).toEqual('fake-field');
|
||||||
|
expect(result.fetchThumbnail).toBeTrue();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import { combineLatest as observableCombineLatest, Observable, Subscription } from 'rxjs';
|
import { combineLatest as observableCombineLatest, Observable, Subscription } from 'rxjs';
|
||||||
import { Component, Inject, OnInit } from '@angular/core';
|
import { Component, Inject, OnInit } from '@angular/core';
|
||||||
import { AppConfig, APP_CONFIG } from '../../../config/app-config.interface';
|
|
||||||
import { RemoteData } from '../../core/data/remote-data';
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
import { PaginatedList } from '../../core/data/paginated-list.model';
|
import { PaginatedList } from '../../core/data/paginated-list.model';
|
||||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
||||||
@@ -18,6 +17,7 @@ import { StartsWithType } from '../../shared/starts-with/starts-with-decorator';
|
|||||||
import { BrowseByDataType, 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 { APP_CONFIG, AppConfig } from '../../../config/app-config.interface';
|
||||||
|
|
||||||
export const BBM_PAGINATION_ID = 'bbm';
|
export const BBM_PAGINATION_ID = 'bbm';
|
||||||
|
|
||||||
@@ -109,12 +109,19 @@ export class BrowseByMetadataPageComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
startsWith: string;
|
startsWith: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether to request embedded thumbnail.
|
||||||
|
*/
|
||||||
|
fetchThumbnails: boolean;
|
||||||
|
|
||||||
public constructor(protected route: ActivatedRoute,
|
public constructor(protected route: ActivatedRoute,
|
||||||
protected browseService: BrowseService,
|
protected browseService: BrowseService,
|
||||||
protected dsoService: DSpaceObjectDataService,
|
protected dsoService: DSpaceObjectDataService,
|
||||||
protected paginationService: PaginationService,
|
protected paginationService: PaginationService,
|
||||||
protected router: Router,
|
protected router: Router,
|
||||||
@Inject(APP_CONFIG) protected appConfig: AppConfig) {
|
@Inject(APP_CONFIG) public appConfig: AppConfig) {
|
||||||
|
|
||||||
|
this.fetchThumbnails = this.appConfig.browseBy.showThumbnails;
|
||||||
this.paginationConfig = Object.assign(new PaginationComponentOptions(), {
|
this.paginationConfig = Object.assign(new PaginationComponentOptions(), {
|
||||||
id: BBM_PAGINATION_ID,
|
id: BBM_PAGINATION_ID,
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@@ -122,9 +129,11 @@ export class BrowseByMetadataPageComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
||||||
const sortConfig = new SortOptions('default', SortDirection.ASC);
|
const sortConfig = new SortOptions('default', SortDirection.ASC);
|
||||||
this.updatePage(new BrowseEntrySearchOptions(this.defaultBrowseId, this.paginationConfig, sortConfig));
|
this.updatePage(getBrowseSearchOptions(this.defaultBrowseId, this.paginationConfig, sortConfig));
|
||||||
this.currentPagination$ = this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig);
|
this.currentPagination$ = this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig);
|
||||||
this.currentSort$ = this.paginationService.getCurrentSort(this.paginationConfig.id, sortConfig);
|
this.currentSort$ = this.paginationService.getCurrentSort(this.paginationConfig.id, sortConfig);
|
||||||
this.subs.push(
|
this.subs.push(
|
||||||
@@ -137,15 +146,16 @@ export class BrowseByMetadataPageComponent implements OnInit {
|
|||||||
this.authority = params.authority;
|
this.authority = params.authority;
|
||||||
this.value = +params.value || params.value || '';
|
this.value = +params.value || params.value || '';
|
||||||
this.startsWith = +params.startsWith || params.startsWith;
|
this.startsWith = +params.startsWith || params.startsWith;
|
||||||
const searchOptions = browseParamsToOptions(params, currentPage, currentSort, this.browseId);
|
|
||||||
if (isNotEmpty(this.value)) {
|
if (isNotEmpty(this.value)) {
|
||||||
this.updatePageWithItems(searchOptions, this.value, this.authority);
|
this.updatePageWithItems(
|
||||||
|
browseParamsToOptions(params, currentPage, currentSort, this.browseId, this.fetchThumbnails), this.value, this.authority);
|
||||||
} else {
|
} else {
|
||||||
this.updatePage(searchOptions);
|
this.updatePage(browseParamsToOptions(params, currentPage, currentSort, this.browseId, false));
|
||||||
}
|
}
|
||||||
this.updateParent(params.scope);
|
this.updateParent(params.scope);
|
||||||
}));
|
}));
|
||||||
this.updateStartsWithTextOptions();
|
this.updateStartsWithTextOptions();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -232,22 +242,44 @@ export class BrowseByMetadataPageComponent implements OnInit {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates browse entry search options.
|
||||||
|
* @param defaultBrowseId the metadata definition to fetch entries or items for
|
||||||
|
* @param paginationConfig the required pagination configuration
|
||||||
|
* @param sortConfig the required sort configuration
|
||||||
|
* @param fetchThumbnails optional boolean for fetching thumbnails
|
||||||
|
* @returns BrowseEntrySearchOptions instance
|
||||||
|
*/
|
||||||
|
export function getBrowseSearchOptions(defaultBrowseId: string,
|
||||||
|
paginationConfig: PaginationComponentOptions,
|
||||||
|
sortConfig: SortOptions,
|
||||||
|
fetchThumbnails?: boolean) {
|
||||||
|
if (!hasValue(fetchThumbnails)) {
|
||||||
|
fetchThumbnails = false;
|
||||||
|
}
|
||||||
|
return new BrowseEntrySearchOptions(defaultBrowseId, paginationConfig, sortConfig, null,
|
||||||
|
null, fetchThumbnails);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to transform query and url parameters into searchOptions used to fetch browse entries or items
|
* Function to transform query and url parameters into searchOptions used to fetch browse entries or items
|
||||||
* @param params URL and query parameters
|
* @param params URL and query parameters
|
||||||
* @param paginationConfig Pagination configuration
|
* @param paginationConfig Pagination configuration
|
||||||
* @param sortConfig Sorting configuration
|
* @param sortConfig Sorting configuration
|
||||||
* @param metadata Optional metadata definition to fetch browse entries/items for
|
* @param metadata Optional metadata definition to fetch browse entries/items for
|
||||||
|
* @param fetchThumbnail Optional parameter for requesting thumbnail images
|
||||||
*/
|
*/
|
||||||
export function browseParamsToOptions(params: any,
|
export function browseParamsToOptions(params: any,
|
||||||
paginationConfig: PaginationComponentOptions,
|
paginationConfig: PaginationComponentOptions,
|
||||||
sortConfig: SortOptions,
|
sortConfig: SortOptions,
|
||||||
metadata?: string): BrowseEntrySearchOptions {
|
metadata?: string,
|
||||||
|
fetchThumbnail?: boolean): BrowseEntrySearchOptions {
|
||||||
return new BrowseEntrySearchOptions(
|
return new BrowseEntrySearchOptions(
|
||||||
metadata,
|
metadata,
|
||||||
paginationConfig,
|
paginationConfig,
|
||||||
sortConfig,
|
sortConfig,
|
||||||
+params.startsWith || params.startsWith,
|
+params.startsWith || params.startsWith,
|
||||||
params.scope
|
params.scope,
|
||||||
|
fetchThumbnail
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -18,13 +18,11 @@ import { BrowseService } from '../../core/browse/browse.service';
|
|||||||
import { RouterMock } from '../../shared/mocks/router.mock';
|
import { RouterMock } from '../../shared/mocks/router.mock';
|
||||||
import { VarDirective } from '../../shared/utils/var.directive';
|
import { VarDirective } from '../../shared/utils/var.directive';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||||
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
|
|
||||||
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
|
||||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||||
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
|
||||||
import { FindListOptions } from '../../core/data/find-list-options.model';
|
import { APP_CONFIG } from '../../../config/app-config.interface';
|
||||||
import { APP_CONFIG } from 'src/config/app-config.interface';
|
import { environment } from '../../../environments/environment';
|
||||||
import { environment } from 'src/environments/environment';
|
|
||||||
|
|
||||||
describe('BrowseByTitlePageComponent', () => {
|
describe('BrowseByTitlePageComponent', () => {
|
||||||
let comp: BrowseByTitlePageComponent;
|
let comp: BrowseByTitlePageComponent;
|
||||||
|
@@ -4,9 +4,8 @@ import { ActivatedRoute, Params, Router } from '@angular/router';
|
|||||||
import { hasValue } from '../../shared/empty.util';
|
import { hasValue } from '../../shared/empty.util';
|
||||||
import {
|
import {
|
||||||
BrowseByMetadataPageComponent,
|
BrowseByMetadataPageComponent,
|
||||||
browseParamsToOptions
|
browseParamsToOptions, getBrowseSearchOptions
|
||||||
} from '../browse-by-metadata-page/browse-by-metadata-page.component';
|
} from '../browse-by-metadata-page/browse-by-metadata-page.component';
|
||||||
import { BrowseEntrySearchOptions } from '../../core/browse/browse-entry-search-options.model';
|
|
||||||
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';
|
||||||
@@ -32,13 +31,14 @@ export class BrowseByTitlePageComponent extends BrowseByMetadataPageComponent {
|
|||||||
protected dsoService: DSpaceObjectDataService,
|
protected dsoService: DSpaceObjectDataService,
|
||||||
protected paginationService: PaginationService,
|
protected paginationService: PaginationService,
|
||||||
protected router: Router,
|
protected router: Router,
|
||||||
@Inject(APP_CONFIG) protected appConfig: AppConfig) {
|
@Inject(APP_CONFIG) public appConfig: AppConfig) {
|
||||||
super(route, browseService, dsoService, paginationService, router, appConfig);
|
super(route, browseService, dsoService, paginationService, router, appConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
const sortConfig = new SortOptions('dc.title', SortDirection.ASC);
|
const sortConfig = new SortOptions('dc.title', SortDirection.ASC);
|
||||||
this.updatePage(new BrowseEntrySearchOptions(this.defaultBrowseId, this.paginationConfig, sortConfig));
|
// include the thumbnail configuration in browse search options
|
||||||
|
this.updatePage(getBrowseSearchOptions(this.defaultBrowseId, this.paginationConfig, sortConfig, this.fetchThumbnails));
|
||||||
this.currentPagination$ = this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig);
|
this.currentPagination$ = this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig);
|
||||||
this.currentSort$ = this.paginationService.getCurrentSort(this.paginationConfig.id, sortConfig);
|
this.currentSort$ = this.paginationService.getCurrentSort(this.paginationConfig.id, sortConfig);
|
||||||
this.subs.push(
|
this.subs.push(
|
||||||
@@ -49,7 +49,7 @@ export class BrowseByTitlePageComponent extends BrowseByMetadataPageComponent {
|
|||||||
).subscribe(([params, currentPage, currentSort]: [Params, PaginationComponentOptions, SortOptions]) => {
|
).subscribe(([params, currentPage, currentSort]: [Params, PaginationComponentOptions, SortOptions]) => {
|
||||||
this.startsWith = +params.startsWith || params.startsWith;
|
this.startsWith = +params.startsWith || params.startsWith;
|
||||||
this.browseId = params.id || this.defaultBrowseId;
|
this.browseId = params.id || this.defaultBrowseId;
|
||||||
this.updatePageWithItems(browseParamsToOptions(params, currentPage, currentSort, this.browseId), undefined, undefined);
|
this.updatePageWithItems(browseParamsToOptions(params, currentPage, currentSort, this.browseId, this.fetchThumbnails), undefined, undefined);
|
||||||
this.updateParent(params.scope);
|
this.updateParent(params.scope);
|
||||||
}));
|
}));
|
||||||
this.updateStartsWithTextOptions();
|
this.updateStartsWithTextOptions();
|
||||||
|
@@ -28,6 +28,7 @@ import { AuthorizationDataService } from '../core/data/feature-authorization/aut
|
|||||||
import { FeatureID } from '../core/data/feature-authorization/feature-id';
|
import { FeatureID } from '../core/data/feature-authorization/feature-id';
|
||||||
import { getCollectionPageRoute } from './collection-page-routing-paths';
|
import { getCollectionPageRoute } from './collection-page-routing-paths';
|
||||||
import { redirectOn4xx } from '../core/shared/authorized.operators';
|
import { redirectOn4xx } from '../core/shared/authorized.operators';
|
||||||
|
import { BROWSE_LINKS_TO_FOLLOW } from '../core/browse/browse.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-collection-page',
|
selector: 'ds-collection-page',
|
||||||
@@ -74,6 +75,7 @@ export class CollectionPageComponent implements OnInit {
|
|||||||
this.paginationConfig.pageSize = 5;
|
this.paginationConfig.pageSize = 5;
|
||||||
this.paginationConfig.currentPage = 1;
|
this.paginationConfig.currentPage = 1;
|
||||||
this.sortConfig = new SortOptions('dc.date.accessioned', SortDirection.DESC);
|
this.sortConfig = new SortOptions('dc.date.accessioned', SortDirection.DESC);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
@@ -102,13 +104,14 @@ export class CollectionPageComponent implements OnInit {
|
|||||||
getFirstSucceededRemoteData(),
|
getFirstSucceededRemoteData(),
|
||||||
map((rd) => rd.payload.id),
|
map((rd) => rd.payload.id),
|
||||||
switchMap((id: string) => {
|
switchMap((id: string) => {
|
||||||
return this.searchService.search(
|
return this.searchService.search<Item>(
|
||||||
new PaginatedSearchOptions({
|
new PaginatedSearchOptions({
|
||||||
scope: id,
|
scope: id,
|
||||||
pagination: currentPagination,
|
pagination: currentPagination,
|
||||||
sort: currentSort,
|
sort: currentSort,
|
||||||
dsoTypes: [DSpaceObjectType.ITEM]
|
dsoTypes: [DSpaceObjectType.ITEM]
|
||||||
})).pipe(toDSpaceObjectListRD()) as Observable<RemoteData<PaginatedList<Item>>>;
|
}), null, true, true, ...BROWSE_LINKS_TO_FOLLOW)
|
||||||
|
.pipe(toDSpaceObjectListRD()) as Observable<RemoteData<PaginatedList<Item>>>;
|
||||||
}),
|
}),
|
||||||
startWith(undefined) // Make sure switching pages shows loading component
|
startWith(undefined) // Make sure switching pages shows loading component
|
||||||
)
|
)
|
||||||
|
@@ -17,7 +17,7 @@ export const COLLECTION_PAGE_LINKS_TO_FOLLOW: FollowLinkConfig<Collection>[] = [
|
|||||||
followLink('parentCommunity', {},
|
followLink('parentCommunity', {},
|
||||||
followLink('parentCommunity')
|
followLink('parentCommunity')
|
||||||
),
|
),
|
||||||
followLink('logo')
|
followLink('logo'),
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -111,7 +111,6 @@ describe(`AuthRequestService`, () => {
|
|||||||
body: undefined,
|
body: undefined,
|
||||||
options,
|
options,
|
||||||
}));
|
}));
|
||||||
expect((service as any).fetchRequest).toHaveBeenCalledWith(requestID);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -151,7 +150,6 @@ describe(`AuthRequestService`, () => {
|
|||||||
body: { content: 'something' },
|
body: { content: 'something' },
|
||||||
options,
|
options,
|
||||||
}));
|
}));
|
||||||
expect((service as any).fetchRequest).toHaveBeenCalledWith(requestID);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -58,7 +58,9 @@ export abstract class AuthRequestService {
|
|||||||
public postToEndpoint(method: string, body?: any, options?: HttpOptions): Observable<RemoteData<AuthStatus>> {
|
public postToEndpoint(method: string, body?: any, options?: HttpOptions): Observable<RemoteData<AuthStatus>> {
|
||||||
const requestId = this.requestService.generateRequestId();
|
const requestId = this.requestService.generateRequestId();
|
||||||
|
|
||||||
this.halService.getEndpoint(this.linkName).pipe(
|
const endpoint$ = this.halService.getEndpoint(this.linkName);
|
||||||
|
|
||||||
|
endpoint$.pipe(
|
||||||
filter((href: string) => isNotEmpty(href)),
|
filter((href: string) => isNotEmpty(href)),
|
||||||
map((endpointURL) => this.getEndpointByMethod(endpointURL, method)),
|
map((endpointURL) => this.getEndpointByMethod(endpointURL, method)),
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
@@ -68,7 +70,9 @@ export abstract class AuthRequestService {
|
|||||||
this.requestService.send(request);
|
this.requestService.send(request);
|
||||||
});
|
});
|
||||||
|
|
||||||
return this.fetchRequest(requestId);
|
return endpoint$.pipe(
|
||||||
|
switchMap(() => this.fetchRequest(requestId)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,7 +83,9 @@ export abstract class AuthRequestService {
|
|||||||
public getRequest(method: string, options?: HttpOptions, ...linksToFollow: FollowLinkConfig<any>[]): Observable<RemoteData<AuthStatus>> {
|
public getRequest(method: string, options?: HttpOptions, ...linksToFollow: FollowLinkConfig<any>[]): Observable<RemoteData<AuthStatus>> {
|
||||||
const requestId = this.requestService.generateRequestId();
|
const requestId = this.requestService.generateRequestId();
|
||||||
|
|
||||||
this.halService.getEndpoint(this.linkName).pipe(
|
const endpoint$ = this.halService.getEndpoint(this.linkName);
|
||||||
|
|
||||||
|
endpoint$.pipe(
|
||||||
filter((href: string) => isNotEmpty(href)),
|
filter((href: string) => isNotEmpty(href)),
|
||||||
map((endpointURL) => this.getEndpointByMethod(endpointURL, method, ...linksToFollow)),
|
map((endpointURL) => this.getEndpointByMethod(endpointURL, method, ...linksToFollow)),
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
@@ -89,7 +95,9 @@ export abstract class AuthRequestService {
|
|||||||
this.requestService.send(request);
|
this.requestService.send(request);
|
||||||
});
|
});
|
||||||
|
|
||||||
return this.fetchRequest(requestId, ...linksToFollow);
|
return endpoint$.pipe(
|
||||||
|
switchMap(() => this.fetchRequest(requestId, ...linksToFollow)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Factory function to create the request object to send. This needs to be a POST client side and
|
* Factory function to create the request object to send. This needs to be a POST client side and
|
||||||
|
@@ -31,6 +31,8 @@ export class DSONameService {
|
|||||||
const givenName = dso.firstMetadataValue('person.givenName');
|
const givenName = dso.firstMetadataValue('person.givenName');
|
||||||
if (isEmpty(familyName) && isEmpty(givenName)) {
|
if (isEmpty(familyName) && isEmpty(givenName)) {
|
||||||
return dso.firstMetadataValue('dc.title') || dso.name;
|
return dso.firstMetadataValue('dc.title') || dso.name;
|
||||||
|
} else if (isEmpty(familyName) || isEmpty(givenName)) {
|
||||||
|
return familyName || givenName;
|
||||||
} else {
|
} else {
|
||||||
return `${familyName}, ${givenName}`;
|
return `${familyName}, ${givenName}`;
|
||||||
}
|
}
|
||||||
@@ -55,11 +57,14 @@ export class DSONameService {
|
|||||||
.filter((type) => typeof type === 'string')
|
.filter((type) => typeof type === 'string')
|
||||||
.find((type: string) => Object.keys(this.factories).includes(type)) as string;
|
.find((type: string) => Object.keys(this.factories).includes(type)) as string;
|
||||||
|
|
||||||
|
let name;
|
||||||
if (hasValue(match)) {
|
if (hasValue(match)) {
|
||||||
return this.factories[match](dso);
|
name = this.factories[match](dso);
|
||||||
} else {
|
|
||||||
return this.factories.Default(dso);
|
|
||||||
}
|
}
|
||||||
|
if (isEmpty(name)) {
|
||||||
|
name = this.factories.Default(dso);
|
||||||
|
}
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -6,13 +6,16 @@ import { SortOptions } from '../cache/models/sort-options.model';
|
|||||||
* - metadataDefinition: The metadata definition to fetch entries or items for
|
* - metadataDefinition: The metadata definition to fetch entries or items for
|
||||||
* - pagination: Optional pagination options to use
|
* - pagination: Optional pagination options to use
|
||||||
* - sort: Optional sorting options to use
|
* - sort: Optional sorting options to use
|
||||||
|
* - startsWith An optional value to use to filter the browse results
|
||||||
* - scope: An optional scope to limit the results within a specific collection or community
|
* - scope: An optional scope to limit the results within a specific collection or community
|
||||||
|
* - fetchThumbnail An optional boolean to request thumbnail for items
|
||||||
*/
|
*/
|
||||||
export class BrowseEntrySearchOptions {
|
export class BrowseEntrySearchOptions {
|
||||||
constructor(public metadataDefinition: string,
|
constructor(public metadataDefinition: string,
|
||||||
public pagination?: PaginationComponentOptions,
|
public pagination?: PaginationComponentOptions,
|
||||||
public sort?: SortOptions,
|
public sort?: SortOptions,
|
||||||
public startsWith?: string,
|
public startsWith?: string,
|
||||||
public scope?: string) {
|
public scope?: string,
|
||||||
|
public fetchThumbnail?: boolean) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -21,6 +21,12 @@ import { URLCombiner } from '../url-combiner/url-combiner';
|
|||||||
import { BrowseEntrySearchOptions } from './browse-entry-search-options.model';
|
import { BrowseEntrySearchOptions } from './browse-entry-search-options.model';
|
||||||
import { BrowseDefinitionDataService } from './browse-definition-data.service';
|
import { BrowseDefinitionDataService } from './browse-definition-data.service';
|
||||||
import { HrefOnlyDataService } from '../data/href-only-data.service';
|
import { HrefOnlyDataService } from '../data/href-only-data.service';
|
||||||
|
import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||||
|
|
||||||
|
|
||||||
|
export const BROWSE_LINKS_TO_FOLLOW: FollowLinkConfig<BrowseEntry | Item>[] = [
|
||||||
|
followLink('thumbnail')
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The service handling all browse requests
|
* The service handling all browse requests
|
||||||
@@ -96,6 +102,9 @@ export class BrowseService {
|
|||||||
return href;
|
return href;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
if (options.fetchThumbnail ) {
|
||||||
|
return this.hrefOnlyDataService.findListByHref<BrowseEntry>(href$, {}, null, null, ...BROWSE_LINKS_TO_FOLLOW);
|
||||||
|
}
|
||||||
return this.hrefOnlyDataService.findListByHref<BrowseEntry>(href$);
|
return this.hrefOnlyDataService.findListByHref<BrowseEntry>(href$);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,6 +150,9 @@ export class BrowseService {
|
|||||||
return href;
|
return href;
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
if (options.fetchThumbnail) {
|
||||||
|
return this.hrefOnlyDataService.findListByHref<Item>(href$, {}, null, null, ...BROWSE_LINKS_TO_FOLLOW);
|
||||||
|
}
|
||||||
return this.hrefOnlyDataService.findListByHref<Item>(href$);
|
return this.hrefOnlyDataService.findListByHref<Item>(href$);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -11,4 +11,5 @@ export class FindListOptions {
|
|||||||
sort?: SortOptions;
|
sort?: SortOptions;
|
||||||
searchParams?: RequestParam[];
|
searchParams?: RequestParam[];
|
||||||
startsWith?: string;
|
startsWith?: string;
|
||||||
|
fetchThumbnail?: boolean;
|
||||||
}
|
}
|
||||||
|
@@ -202,6 +202,7 @@ describe('RelationshipDataService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should call getItemRelationshipsByLabel with the correct params', (done) => {
|
it('should call getItemRelationshipsByLabel with the correct params', (done) => {
|
||||||
|
mockOptions = Object.assign(mockOptions, { fetchThumbnail: true });
|
||||||
service.getRelatedItemsByLabel(
|
service.getRelatedItemsByLabel(
|
||||||
mockItem,
|
mockItem,
|
||||||
mockLabel,
|
mockLabel,
|
||||||
@@ -213,8 +214,8 @@ describe('RelationshipDataService', () => {
|
|||||||
mockOptions,
|
mockOptions,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
followLink('leftItem'),
|
followLink('leftItem',{}, followLink('thumbnail')),
|
||||||
followLink('rightItem'),
|
followLink('rightItem',{}, followLink('thumbnail')),
|
||||||
followLink('relationshipType')
|
followLink('relationshipType')
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
|
@@ -45,6 +45,7 @@ import { SearchData, SearchDataImpl } from './base/search-data';
|
|||||||
import { PutData, PutDataImpl } from './base/put-data';
|
import { PutData, PutDataImpl } from './base/put-data';
|
||||||
import { IdentifiableDataService } from './base/identifiable-data.service';
|
import { IdentifiableDataService } from './base/identifiable-data.service';
|
||||||
import { dataService } from './base/data-service.decorator';
|
import { dataService } from './base/data-service.decorator';
|
||||||
|
import { itemLinksToFollow } from '../../shared/utils/relation-query.utils';
|
||||||
|
|
||||||
const relationshipListsStateSelector = (state: AppState) => state.relationshipLists;
|
const relationshipListsStateSelector = (state: AppState) => state.relationshipLists;
|
||||||
|
|
||||||
@@ -185,7 +186,7 @@ export class RelationshipDataService extends IdentifiableDataService<Relationshi
|
|||||||
]).pipe(
|
]).pipe(
|
||||||
filter(([existsInOC, existsInRC]) => !existsInOC && !existsInRC),
|
filter(([existsInOC, existsInRC]) => !existsInOC && !existsInRC),
|
||||||
take(1),
|
take(1),
|
||||||
).subscribe(() => this.itemService.findByHref(item._links.self.href, false));
|
).subscribe(() => this.itemService.findByHref(item._links.self.href));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -258,7 +259,10 @@ export class RelationshipDataService extends IdentifiableDataService<Relationshi
|
|||||||
* @param options
|
* @param options
|
||||||
*/
|
*/
|
||||||
getRelatedItemsByLabel(item: Item, label: string, options?: FindListOptions): Observable<RemoteData<PaginatedList<Item>>> {
|
getRelatedItemsByLabel(item: Item, label: string, options?: FindListOptions): Observable<RemoteData<PaginatedList<Item>>> {
|
||||||
return this.getItemRelationshipsByLabel(item, label, options, true, true, followLink('leftItem'), followLink('rightItem'), followLink('relationshipType')).pipe(this.paginatedRelationsToItems(item.uuid));
|
let linksToFollow: FollowLinkConfig<Relationship>[] = itemLinksToFollow(options.fetchThumbnail);
|
||||||
|
linksToFollow.push(followLink('relationshipType'));
|
||||||
|
|
||||||
|
return this.getItemRelationshipsByLabel(item, label, options, true, true, ...linksToFollow).pipe(this.paginatedRelationsToItems(item.uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -516,14 +520,14 @@ export class RelationshipDataService extends IdentifiableDataService<Relationshi
|
|||||||
{
|
{
|
||||||
fieldName: 'relatedItem',
|
fieldName: 'relatedItem',
|
||||||
fieldValue: itemId,
|
fieldValue: itemId,
|
||||||
},
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
return this.searchBy(
|
return this.searchBy(
|
||||||
'byItemsAndType',
|
'byItemsAndType',
|
||||||
{
|
{
|
||||||
searchParams: searchParams,
|
searchParams: searchParams
|
||||||
},
|
},
|
||||||
) as Observable<RemoteData<PaginatedList<Relationship>>>;
|
) as Observable<RemoteData<PaginatedList<Relationship>>>;
|
||||||
|
|
||||||
|
@@ -40,6 +40,12 @@ export class BrowseEntry extends ListableObject implements TypedObject {
|
|||||||
@autoserializeAs('valueLang')
|
@autoserializeAs('valueLang')
|
||||||
language: string;
|
language: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thumbnail link used when browsing items with showThumbs config enabled.
|
||||||
|
*/
|
||||||
|
@autoserializeAs('thumbnail')
|
||||||
|
thumbnail: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The count of this browse entry
|
* The count of this browse entry
|
||||||
*/
|
*/
|
||||||
@@ -51,6 +57,7 @@ export class BrowseEntry extends ListableObject implements TypedObject {
|
|||||||
_links: {
|
_links: {
|
||||||
self: HALLink;
|
self: HALLink;
|
||||||
entries: HALLink;
|
entries: HALLink;
|
||||||
|
thumbnail: HALLink;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
||||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||||
<h4 class="card-title" [innerHTML]="firstMetadataValue('dc.title')"></h4>
|
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
|
||||||
</ds-truncatable-part>
|
</ds-truncatable-part>
|
||||||
<p *ngIf="dso.hasMetadata('creativework.datePublished')"
|
<p *ngIf="dso.hasMetadata('creativework.datePublished')"
|
||||||
class="item-date card-text text-muted">
|
class="item-date card-text text-muted">
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
||||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||||
<h4 class="card-title" [innerHTML]="dso.firstMetadataValue('dc.title')"></h4>
|
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
|
||||||
</ds-truncatable-part>
|
</ds-truncatable-part>
|
||||||
<p *ngIf="dso.hasMetadata('creativework.datePublished')"
|
<p *ngIf="dso.hasMetadata('creativework.datePublished')"
|
||||||
class="item-date card-text text-muted">
|
class="item-date card-text text-muted">
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
||||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||||
<h4 class="card-title" [innerHTML]="firstMetadataValue('dc.title')"></h4>
|
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
|
||||||
</ds-truncatable-part>
|
</ds-truncatable-part>
|
||||||
<p *ngIf="dso.hasMetadata('creativework.editor')"
|
<p *ngIf="dso.hasMetadata('creativework.editor')"
|
||||||
class="item-publisher card-text text-muted">
|
class="item-publisher card-text text-muted">
|
||||||
|
@@ -1,12 +1,23 @@
|
|||||||
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
<div class="row">
|
||||||
<ds-truncatable [id]="dso.id">
|
<div *ngIf="showThumbnails" class="col-3 col-md-2">
|
||||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer"
|
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||||
[routerLink]="[itemPageRoute]" class="lead item-list-title dont-break-out"
|
rel="noopener noreferrer"
|
||||||
[innerHTML]="dsoTitle"></a>
|
[routerLink]="[itemPageRoute]" class="lead item-list-title dont-break-out">
|
||||||
<span *ngIf="linkType == linkTypes.None"
|
<ds-thumbnail [thumbnail]="dso?.thumbnail | async" [limitWidth]="true">
|
||||||
class="lead item-list-title dont-break-out"
|
</ds-thumbnail>
|
||||||
[innerHTML]="dsoTitle"></span>
|
</a>
|
||||||
<span class="text-muted">
|
</div>
|
||||||
|
<div [ngClass]="showThumbnails ? 'col-9' : 'col-md-12'">
|
||||||
|
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
||||||
|
<ds-truncatable [id]="dso.id">
|
||||||
|
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
[routerLink]="[itemPageRoute]" class="lead item-list-title dont-break-out"
|
||||||
|
[innerHTML]="dsoTitle"></a>
|
||||||
|
<span *ngIf="linkType == linkTypes.None"
|
||||||
|
class="lead item-list-title dont-break-out"
|
||||||
|
[innerHTML]="dsoTitle"></span>
|
||||||
|
<span class="text-muted">
|
||||||
<ds-truncatable-part [id]="dso.id" [minLines]="1">
|
<ds-truncatable-part [id]="dso.id" [minLines]="1">
|
||||||
<span *ngIf="dso.allMetadata(['publicationvolume.volumeNumber']).length > 0"
|
<span *ngIf="dso.allMetadata(['publicationvolume.volumeNumber']).length > 0"
|
||||||
class="item-list-journal-issues">
|
class="item-list-journal-issues">
|
||||||
@@ -22,4 +33,6 @@
|
|||||||
</span>
|
</span>
|
||||||
</ds-truncatable-part>
|
</ds-truncatable-part>
|
||||||
</span>
|
</span>
|
||||||
</ds-truncatable>
|
</ds-truncatable>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@@ -9,6 +9,7 @@ import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
|||||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||||
|
|
||||||
let journalIssueListElementComponent: JournalIssueSearchResultListElementComponent;
|
let journalIssueListElementComponent: JournalIssueSearchResultListElementComponent;
|
||||||
let fixture: ComponentFixture<JournalIssueSearchResultListElementComponent>;
|
let fixture: ComponentFixture<JournalIssueSearchResultListElementComponent>;
|
||||||
@@ -57,13 +58,26 @@ const mockItemWithoutMetadata: ItemSearchResult = Object.assign(
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const environmentUseThumbs = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const enviromentNoThumbs = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
describe('JournalIssueSearchResultListElementComponent', () => {
|
describe('JournalIssueSearchResultListElementComponent', () => {
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
declarations: [JournalIssueSearchResultListElementComponent, TruncatePipe],
|
declarations: [JournalIssueSearchResultListElementComponent, TruncatePipe],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: TruncatableService, useValue: {} },
|
{ provide: TruncatableService, useValue: {} },
|
||||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||||
|
{ provide: APP_CONFIG, useValue: environmentUseThumbs }
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
@@ -78,6 +92,22 @@ describe('JournalIssueSearchResultListElementComponent', () => {
|
|||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showThumbnails set to true', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
journalIssueListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
it('should set showThumbnails to true', () => {
|
||||||
|
expect(journalIssueListElementComponent.showThumbnails).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
describe('When the item has a journal identifier', () => {
|
describe('When the item has a journal identifier', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
journalIssueListElementComponent.object = mockItemWithMetadata;
|
journalIssueListElementComponent.object = mockItemWithMetadata;
|
||||||
@@ -126,3 +156,39 @@ describe('JournalIssueSearchResultListElementComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('JournalIssueSearchResultListElementComponent', () => {
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [JournalIssueSearchResultListElementComponent, TruncatePipe],
|
||||||
|
providers: [
|
||||||
|
{provide: TruncatableService, useValue: {}},
|
||||||
|
{provide: DSONameService, useClass: DSONameServiceMock},
|
||||||
|
{ provide: APP_CONFIG, useValue: enviromentNoThumbs }
|
||||||
|
],
|
||||||
|
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).overrideComponent(JournalIssueSearchResultListElementComponent, {
|
||||||
|
set: {changeDetection: ChangeDetectionStrategy.Default}
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
fixture = TestBed.createComponent(JournalIssueSearchResultListElementComponent);
|
||||||
|
journalIssueListElementComponent = fixture.componentInstance;
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showThumbnails set to false', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
|
||||||
|
journalIssueListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeFalsy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@@ -13,4 +13,15 @@ import { ItemSearchResultListElementComponent } from '../../../../../shared/obje
|
|||||||
* The component for displaying a list element for an item search result of the type Journal Issue
|
* The component for displaying a list element for an item search result of the type Journal Issue
|
||||||
*/
|
*/
|
||||||
export class JournalIssueSearchResultListElementComponent extends ItemSearchResultListElementComponent {
|
export class JournalIssueSearchResultListElementComponent extends ItemSearchResultListElementComponent {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display thumbnails if required by configuration
|
||||||
|
*/
|
||||||
|
showThumbnails: boolean;
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
super.ngOnInit();
|
||||||
|
this.showThumbnails = this.appConfig.browseBy.showThumbnails;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,12 +1,23 @@
|
|||||||
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
<div class="row">
|
||||||
<ds-truncatable [id]="dso.id">
|
<div *ngIf="showThumbnails" class="col-3 col-md-2">
|
||||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer"
|
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||||
[routerLink]="[itemPageRoute]" class="lead item-list-title dont-break-out"
|
rel="noopener noreferrer"
|
||||||
[innerHTML]="dsoTitle"></a>
|
[routerLink]="[itemPageRoute]" class="lead item-list-title dont-break-out">
|
||||||
<span *ngIf="linkType == linkTypes.None"
|
<ds-thumbnail [thumbnail]="dso?.thumbnail | async" [limitWidth]="true">
|
||||||
class="lead item-list-title dont-break-out"
|
</ds-thumbnail>
|
||||||
[innerHTML]="dsoTitle"></span>
|
</a>
|
||||||
<span class="text-muted">
|
</div>
|
||||||
|
<div [ngClass]="showThumbnails ? 'col-9' : 'col-md-12'">
|
||||||
|
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
||||||
|
<ds-truncatable [id]="dso.id">
|
||||||
|
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
[routerLink]="[itemPageRoute]" class="lead item-list-title dont-break-out"
|
||||||
|
[innerHTML]="dsoTitle"></a>
|
||||||
|
<span *ngIf="linkType == linkTypes.None"
|
||||||
|
class="lead item-list-title dont-break-out"
|
||||||
|
[innerHTML]="dsoTitle"></span>
|
||||||
|
<span class="text-muted">
|
||||||
<ds-truncatable-part [id]="dso.id" [minLines]="1">
|
<ds-truncatable-part [id]="dso.id" [minLines]="1">
|
||||||
<span *ngIf="dso.allMetadata(['journal.title']).length > 0"
|
<span *ngIf="dso.allMetadata(['journal.title']).length > 0"
|
||||||
class="item-list-journal-volumes">
|
class="item-list-journal-volumes">
|
||||||
@@ -22,4 +33,6 @@
|
|||||||
</span>
|
</span>
|
||||||
</ds-truncatable-part>
|
</ds-truncatable-part>
|
||||||
</span>
|
</span>
|
||||||
</ds-truncatable>
|
</ds-truncatable>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@@ -9,6 +9,7 @@ import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
|||||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||||
|
|
||||||
let journalVolumeListElementComponent: JournalVolumeSearchResultListElementComponent;
|
let journalVolumeListElementComponent: JournalVolumeSearchResultListElementComponent;
|
||||||
let fixture: ComponentFixture<JournalVolumeSearchResultListElementComponent>;
|
let fixture: ComponentFixture<JournalVolumeSearchResultListElementComponent>;
|
||||||
@@ -56,6 +57,18 @@ const mockItemWithoutMetadata: ItemSearchResult = Object.assign(
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const environmentUseThumbs = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const enviromentNoThumbs = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
describe('JournalVolumeSearchResultListElementComponent', () => {
|
describe('JournalVolumeSearchResultListElementComponent', () => {
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@@ -63,6 +76,7 @@ describe('JournalVolumeSearchResultListElementComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: TruncatableService, useValue: {} },
|
{ provide: TruncatableService, useValue: {} },
|
||||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||||
|
{ provide: APP_CONFIG, useValue: environmentUseThumbs }
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
@@ -77,6 +91,21 @@ describe('JournalVolumeSearchResultListElementComponent', () => {
|
|||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showThumbnails set to true', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
journalVolumeListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
it('should set showThumbnails to true', () => {
|
||||||
|
expect(journalVolumeListElementComponent.showThumbnails).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('When the item has a journal title', () => {
|
describe('When the item has a journal title', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
journalVolumeListElementComponent.object = mockItemWithMetadata;
|
journalVolumeListElementComponent.object = mockItemWithMetadata;
|
||||||
@@ -125,3 +154,38 @@ describe('JournalVolumeSearchResultListElementComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('JournalVolumeSearchResultListElementComponent', () => {
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [JournalVolumeSearchResultListElementComponent, TruncatePipe],
|
||||||
|
providers: [
|
||||||
|
{provide: TruncatableService, useValue: {}},
|
||||||
|
{provide: DSONameService, useClass: DSONameServiceMock},
|
||||||
|
{ provide: APP_CONFIG, useValue: enviromentNoThumbs }
|
||||||
|
],
|
||||||
|
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).overrideComponent(JournalVolumeSearchResultListElementComponent, {
|
||||||
|
set: {changeDetection: ChangeDetectionStrategy.Default}
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
fixture = TestBed.createComponent(JournalVolumeSearchResultListElementComponent);
|
||||||
|
journalVolumeListElementComponent = fixture.componentInstance;
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showThumbnails set to false', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
journalVolumeListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeFalsy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@@ -13,4 +13,15 @@ import { ItemSearchResultListElementComponent } from '../../../../../shared/obje
|
|||||||
* The component for displaying a list element for an item search result of the type Journal Volume
|
* The component for displaying a list element for an item search result of the type Journal Volume
|
||||||
*/
|
*/
|
||||||
export class JournalVolumeSearchResultListElementComponent extends ItemSearchResultListElementComponent {
|
export class JournalVolumeSearchResultListElementComponent extends ItemSearchResultListElementComponent {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display thumbnails if required by configuration
|
||||||
|
*/
|
||||||
|
showThumbnails: boolean;
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
super.ngOnInit();
|
||||||
|
this.showThumbnails = this.appConfig.browseBy.showThumbnails;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,12 +1,21 @@
|
|||||||
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
<div class="row">
|
||||||
<ds-truncatable [id]="dso.id">
|
<div *ngIf="showThumbnails" class="col-3 col-md-2">
|
||||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer"
|
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer"
|
||||||
[routerLink]="[itemPageRoute]" class="lead item-list-title dont-break-out"
|
[routerLink]="[itemPageRoute]" class="lead item-list-title dont-break-out">
|
||||||
[innerHTML]="dsoTitle"></a>
|
<ds-thumbnail [thumbnail]="dso?.thumbnail | async" [limitWidth]="true">
|
||||||
<span *ngIf="linkType == linkTypes.None"
|
</ds-thumbnail>
|
||||||
class="lead item-list-title dont-break-out"
|
</a>
|
||||||
[innerHTML]="dsoTitle"></span>
|
</div>
|
||||||
<span class="text-muted">
|
<div [ngClass]="showThumbnails ? 'col-9' : 'col-md-12'">
|
||||||
|
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
||||||
|
<ds-truncatable [id]="dso.id">
|
||||||
|
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer"
|
||||||
|
[routerLink]="[itemPageRoute]" class="lead item-list-title dont-break-out"
|
||||||
|
[innerHTML]="dsoTitle"></a>
|
||||||
|
<span *ngIf="linkType == linkTypes.None"
|
||||||
|
class="lead item-list-title dont-break-out"
|
||||||
|
[innerHTML]="dsoTitle"></span>
|
||||||
|
<span class="text-muted">
|
||||||
<ds-truncatable-part [id]="dso.id" [minLines]="1">
|
<ds-truncatable-part [id]="dso.id" [minLines]="1">
|
||||||
<span *ngIf="dso.allMetadata(['creativeworkseries.issn']).length > 0"
|
<span *ngIf="dso.allMetadata(['creativeworkseries.issn']).length > 0"
|
||||||
class="item-list-journals">
|
class="item-list-journals">
|
||||||
@@ -16,4 +25,6 @@
|
|||||||
</span>
|
</span>
|
||||||
</ds-truncatable-part>
|
</ds-truncatable-part>
|
||||||
</span>
|
</span>
|
||||||
</ds-truncatable>
|
</ds-truncatable>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@@ -9,6 +9,7 @@ import { TruncatableService } from '../../../../../shared/truncatable/truncatabl
|
|||||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||||
|
|
||||||
let journalListElementComponent: JournalSearchResultListElementComponent;
|
let journalListElementComponent: JournalSearchResultListElementComponent;
|
||||||
let fixture: ComponentFixture<JournalSearchResultListElementComponent>;
|
let fixture: ComponentFixture<JournalSearchResultListElementComponent>;
|
||||||
@@ -52,6 +53,18 @@ const mockItemWithoutMetadata: ItemSearchResult = Object.assign(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const environmentUseThumbs = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const enviromentNoThumbs = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
describe('JournalSearchResultListElementComponent', () => {
|
describe('JournalSearchResultListElementComponent', () => {
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@@ -59,6 +72,7 @@ describe('JournalSearchResultListElementComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: TruncatableService, useValue: {} },
|
{ provide: TruncatableService, useValue: {} },
|
||||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||||
|
{ provide: APP_CONFIG, useValue: environmentUseThumbs }
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
@@ -73,6 +87,21 @@ describe('JournalSearchResultListElementComponent', () => {
|
|||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showThumbnails set to true', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
journalListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
it('should set showThumbnails to true', () => {
|
||||||
|
expect(journalListElementComponent.showThumbnails).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('When the item has an issn', () => {
|
describe('When the item has an issn', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
journalListElementComponent.object = mockItemWithMetadata;
|
journalListElementComponent.object = mockItemWithMetadata;
|
||||||
@@ -97,3 +126,39 @@ describe('JournalSearchResultListElementComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('JournalSearchResultListElementComponent', () => {
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [JournalSearchResultListElementComponent, TruncatePipe],
|
||||||
|
providers: [
|
||||||
|
{provide: TruncatableService, useValue: {}},
|
||||||
|
{provide: DSONameService, useClass: DSONameServiceMock},
|
||||||
|
{ provide: APP_CONFIG, useValue: enviromentNoThumbs }
|
||||||
|
],
|
||||||
|
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).overrideComponent(JournalSearchResultListElementComponent, {
|
||||||
|
set: {changeDetection: ChangeDetectionStrategy.Default}
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
fixture = TestBed.createComponent(JournalSearchResultListElementComponent);
|
||||||
|
journalListElementComponent = fixture.componentInstance;
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showThumbnails set to false', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
|
||||||
|
journalListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeFalsy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@@ -13,4 +13,15 @@ import { ItemSearchResultListElementComponent } from '../../../../../shared/obje
|
|||||||
* The component for displaying a list element for an item search result of the type Journal
|
* The component for displaying a list element for an item search result of the type Journal
|
||||||
*/
|
*/
|
||||||
export class JournalSearchResultListElementComponent extends ItemSearchResultListElementComponent {
|
export class JournalSearchResultListElementComponent extends ItemSearchResultListElementComponent {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display thumbnails if required by configuration
|
||||||
|
*/
|
||||||
|
showThumbnails: boolean;
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
super.ngOnInit();
|
||||||
|
this.showThumbnails = this.appConfig.browseBy.showThumbnails;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
<div class="d-flex flex-row">
|
<div class="d-flex flex-row">
|
||||||
<h2 class="item-page-title-field mr-auto">
|
<ds-item-page-title-field [item]="object" class="mr-auto">
|
||||||
{{'journalissue.page.titleprefix' | translate}}<ds-metadata-values [mdValues]="object?.allMetadata(['dc.title'])"></ds-metadata-values>
|
</ds-item-page-title-field>
|
||||||
</h2>
|
|
||||||
<div class="pl-2 space-children-mr">
|
<div class="pl-2 space-children-mr">
|
||||||
<ds-dso-page-version-button (newVersionEvent)="onCreateNewVersion()" [dso]="object"
|
<ds-dso-page-version-button (newVersionEvent)="onCreateNewVersion()" [dso]="object"
|
||||||
[tooltipMsgCreate]="'item.page.version.create'"
|
[tooltipMsgCreate]="'item.page.version.create'"
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
<div class="d-flex flex-row">
|
<div class="d-flex flex-row">
|
||||||
<h2 class="item-page-title-field mr-auto">
|
<ds-item-page-title-field [item]="object" class="mr-auto">
|
||||||
{{'journalvolume.page.titleprefix' | translate}}<ds-metadata-values [mdValues]="object?.allMetadata(['dc.title'])"></ds-metadata-values>
|
</ds-item-page-title-field>
|
||||||
</h2>
|
|
||||||
<div class="pl-2 space-children-mr">
|
<div class="pl-2 space-children-mr">
|
||||||
<ds-dso-page-version-button (newVersionEvent)="onCreateNewVersion()" [dso]="object"
|
<ds-dso-page-version-button (newVersionEvent)="onCreateNewVersion()" [dso]="object"
|
||||||
[tooltipMsgCreate]="'item.page.version.create'"
|
[tooltipMsgCreate]="'item.page.version.create'"
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
<div class="d-flex flex-row">
|
<div class="d-flex flex-row">
|
||||||
<h2 class="item-page-title-field mr-auto">
|
<ds-item-page-title-field [item]="object" class="mr-auto">
|
||||||
{{'journal.page.titleprefix' | translate}}<ds-metadata-values [mdValues]="object?.allMetadata(['dc.title'])"></ds-metadata-values>
|
</ds-item-page-title-field>
|
||||||
</h2>
|
|
||||||
<div class="pl-2 space-children-mr">
|
<div class="pl-2 space-children-mr">
|
||||||
<ds-dso-page-version-button (newVersionEvent)="onCreateNewVersion()" [dso]="object"
|
<ds-dso-page-version-button (newVersionEvent)="onCreateNewVersion()" [dso]="object"
|
||||||
[tooltipMsgCreate]="'item.page.version.create'"
|
[tooltipMsgCreate]="'item.page.version.create'"
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
||||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||||
<h4 class="card-title" [innerHTML]="firstMetadataValue('organization.legalName')"></h4>
|
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
|
||||||
</ds-truncatable-part>
|
</ds-truncatable-part>
|
||||||
<p *ngIf="dso.hasMetadata('organization.foundingDate')"
|
<p *ngIf="dso.hasMetadata('organization.foundingDate')"
|
||||||
class="item-date card-text text-muted">
|
class="item-date card-text text-muted">
|
||||||
|
@@ -21,8 +21,7 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
||||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||||
<h4 class="card-title"
|
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
|
||||||
[innerHTML]="firstMetadataValue('person.familyName') + ', ' + firstMetadataValue('person.givenName')"></h4>
|
|
||||||
</ds-truncatable-part>
|
</ds-truncatable-part>
|
||||||
<p *ngIf="dso.hasMetadata('person.email')" class="item-email card-text text-muted">
|
<p *ngIf="dso.hasMetadata('person.email')" class="item-email card-text text-muted">
|
||||||
<ds-truncatable-part [id]="dso.id" [minLines]="1">
|
<ds-truncatable-part [id]="dso.id" [minLines]="1">
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
||||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||||
<h4 class="card-title" [innerHTML]="firstMetadataValue('dc.title')"></h4>
|
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
|
||||||
</ds-truncatable-part>
|
</ds-truncatable-part>
|
||||||
<p *ngIf="dso.hasMetadata('dc.description')" class="item-description card-text text-muted">
|
<p *ngIf="dso.hasMetadata('dc.description')" class="item-description card-text text-muted">
|
||||||
<ds-truncatable-part [id]="dso.id" [minLines]="3">
|
<ds-truncatable-part [id]="dso.id" [minLines]="3">
|
||||||
|
@@ -1,17 +1,33 @@
|
|||||||
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
<div class="row">
|
||||||
<ds-truncatable [id]="dso.id">
|
<div *ngIf="showThumbnails" class="col-3 col-md-2">
|
||||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer"
|
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||||
[routerLink]="[itemPageRoute]" class="lead"
|
rel="noopener noreferrer"
|
||||||
[innerHTML]="firstMetadataValue('organization.legalName')"></a>
|
[routerLink]="[itemPageRoute]" class="dont-break-out">
|
||||||
<span *ngIf="linkType == linkTypes.None"
|
<ds-thumbnail [thumbnail]="dso?.thumbnail | async"
|
||||||
class="lead"
|
[defaultImage]="'assets/images/orgunit-placeholder.svg'"
|
||||||
[innerHTML]="firstMetadataValue('organization.legalName')"></span>
|
[alt]="'thumbnail.orgunit.alt'"
|
||||||
<span class="text-muted">
|
[placeholder]="'thumbnail.orgunit.placeholder'">
|
||||||
|
</ds-thumbnail>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div [ngClass]="showThumbnails ? 'col-9' : 'col-md-12'">
|
||||||
|
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
||||||
|
<ds-truncatable [id]="dso.id">
|
||||||
|
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
[routerLink]="[itemPageRoute]" class="lead"
|
||||||
|
[innerHTML]="dsoTitle"></a>
|
||||||
|
<span *ngIf="linkType == linkTypes.None"
|
||||||
|
class="lead"
|
||||||
|
[innerHTML]="dsoTitle"></span>
|
||||||
|
<span class="text-muted">
|
||||||
<span *ngIf="dso.allMetadata(['dc.description']).length > 0"
|
<span *ngIf="dso.allMetadata(['dc.description']).length > 0"
|
||||||
class="item-list-org-unit-description">
|
class="item-list-org-unit-description">
|
||||||
<ds-truncatable-part [id]="dso.id" [minLines]="3"><span
|
<ds-truncatable-part [id]="dso.id" [minLines]="3"><span
|
||||||
[innerHTML]="firstMetadataValue('dc.description')"></span>
|
[innerHTML]="firstMetadataValue('dc.description')"></span>
|
||||||
</ds-truncatable-part>
|
</ds-truncatable-part>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</ds-truncatable>
|
</ds-truncatable>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@@ -9,6 +9,7 @@ import { TruncatableService } from '../../../../../shared/truncatable/truncatabl
|
|||||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||||
|
|
||||||
let orgUnitListElementComponent: OrgUnitSearchResultListElementComponent;
|
let orgUnitListElementComponent: OrgUnitSearchResultListElementComponent;
|
||||||
let fixture: ComponentFixture<OrgUnitSearchResultListElementComponent>;
|
let fixture: ComponentFixture<OrgUnitSearchResultListElementComponent>;
|
||||||
@@ -50,13 +51,26 @@ const mockItemWithoutMetadata: ItemSearchResult = Object.assign(
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const environmentUseThumbs = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const enviromentNoThumbs = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
describe('OrgUnitSearchResultListElementComponent', () => {
|
describe('OrgUnitSearchResultListElementComponent', () => {
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
declarations: [ OrgUnitSearchResultListElementComponent , TruncatePipe],
|
declarations: [ OrgUnitSearchResultListElementComponent , TruncatePipe],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: TruncatableService, useValue: {} },
|
{ provide: TruncatableService, useValue: {} },
|
||||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||||
|
{ provide: APP_CONFIG, useValue: environmentUseThumbs }
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
@@ -71,6 +85,21 @@ describe('OrgUnitSearchResultListElementComponent', () => {
|
|||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showThumbnails set to true', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
orgUnitListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
it('should set showThumbnails to true', () => {
|
||||||
|
expect(orgUnitListElementComponent.showThumbnails).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('When the item has an org unit description', () => {
|
describe('When the item has an org unit description', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
orgUnitListElementComponent.object = mockItemWithMetadata;
|
orgUnitListElementComponent.object = mockItemWithMetadata;
|
||||||
@@ -95,3 +124,39 @@ describe('OrgUnitSearchResultListElementComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('OrgUnitSearchResultListElementComponent', () => {
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [OrgUnitSearchResultListElementComponent, TruncatePipe],
|
||||||
|
providers: [
|
||||||
|
{provide: TruncatableService, useValue: {}},
|
||||||
|
{provide: DSONameService, useClass: DSONameServiceMock},
|
||||||
|
{ provide: APP_CONFIG, useValue: enviromentNoThumbs }
|
||||||
|
],
|
||||||
|
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).overrideComponent(OrgUnitSearchResultListElementComponent, {
|
||||||
|
set: {changeDetection: ChangeDetectionStrategy.Default}
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
fixture = TestBed.createComponent(OrgUnitSearchResultListElementComponent);
|
||||||
|
orgUnitListElementComponent = fixture.componentInstance;
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showThumbnails set to false', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
|
||||||
|
orgUnitListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@@ -13,4 +13,15 @@ import { ItemSearchResultListElementComponent } from '../../../../../shared/obje
|
|||||||
* The component for displaying a list element for an item search result of the type Organisation Unit
|
* The component for displaying a list element for an item search result of the type Organisation Unit
|
||||||
*/
|
*/
|
||||||
export class OrgUnitSearchResultListElementComponent extends ItemSearchResultListElementComponent {
|
export class OrgUnitSearchResultListElementComponent extends ItemSearchResultListElementComponent {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display thumbnail if required by configuration
|
||||||
|
*/
|
||||||
|
showThumbnails: boolean;
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
super.ngOnInit();
|
||||||
|
this.showThumbnails = this.appConfig.browseBy.showThumbnails;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,12 +1,26 @@
|
|||||||
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
<div class="row">
|
||||||
<ds-truncatable [id]="dso.id">
|
<div *ngIf="showThumbnails" class="col-3 col-md-2">
|
||||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer"
|
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||||
[routerLink]="[itemPageRoute]" class="lead"
|
rel="noopener noreferrer"
|
||||||
[innerHTML]="name"></a>
|
[routerLink]="[itemPageRoute]" class="dont-break-out">
|
||||||
<span *ngIf="linkType == linkTypes.None"
|
<ds-thumbnail [thumbnail]="dso?.thumbnail | async"
|
||||||
class="lead"
|
[defaultImage]="'assets/images/person-placeholder.svg'"
|
||||||
[innerHTML]="name"></span>
|
[alt]="'thumbnail.person.alt'"
|
||||||
<span class="text-muted">
|
[placeholder]="'thumbnail.person.placeholder'">
|
||||||
|
</ds-thumbnail>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div [ngClass]="showThumbnails ? 'col-9 col-md-10' : 'col-12'">
|
||||||
|
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
||||||
|
<ds-truncatable [id]="dso.id">
|
||||||
|
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
[routerLink]="[itemPageRoute]" class="lead"
|
||||||
|
[innerHTML]="dsoTitle"></a>
|
||||||
|
<span *ngIf="linkType == linkTypes.None"
|
||||||
|
class="lead"
|
||||||
|
[innerHTML]="dsoTitle"></span>
|
||||||
|
<span class="text-muted">
|
||||||
<ds-truncatable-part [id]="dso.id" [minLines]="1">
|
<ds-truncatable-part [id]="dso.id" [minLines]="1">
|
||||||
<span *ngIf="dso.allMetadata(['person.jobTitle']).length > 0"
|
<span *ngIf="dso.allMetadata(['person.jobTitle']).length > 0"
|
||||||
class="item-list-job-title">
|
class="item-list-job-title">
|
||||||
@@ -16,4 +30,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</ds-truncatable-part>
|
</ds-truncatable-part>
|
||||||
</span>
|
</span>
|
||||||
</ds-truncatable>
|
</ds-truncatable>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@@ -9,6 +9,7 @@ import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
|||||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||||
|
|
||||||
let personListElementComponent: PersonSearchResultListElementComponent;
|
let personListElementComponent: PersonSearchResultListElementComponent;
|
||||||
let fixture: ComponentFixture<PersonSearchResultListElementComponent>;
|
let fixture: ComponentFixture<PersonSearchResultListElementComponent>;
|
||||||
@@ -50,13 +51,26 @@ const mockItemWithoutMetadata: ItemSearchResult = Object.assign(
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const environmentUseThumbs = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const enviromentNoThumbs = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
describe('PersonSearchResultListElementComponent', () => {
|
describe('PersonSearchResultListElementComponent', () => {
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
declarations: [PersonSearchResultListElementComponent, TruncatePipe],
|
declarations: [PersonSearchResultListElementComponent, TruncatePipe],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: TruncatableService, useValue: {} },
|
{ provide: TruncatableService, useValue: {} },
|
||||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||||
|
{ provide: APP_CONFIG, useValue: environmentUseThumbs }
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
@@ -71,6 +85,21 @@ describe('PersonSearchResultListElementComponent', () => {
|
|||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showThumbnails set to true', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
personListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
it('should set showThumbnails to true', () => {
|
||||||
|
expect(personListElementComponent.showThumbnails).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('When the item has a job title', () => {
|
describe('When the item has a job title', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
personListElementComponent.object = mockItemWithMetadata;
|
personListElementComponent.object = mockItemWithMetadata;
|
||||||
@@ -95,3 +124,39 @@ describe('PersonSearchResultListElementComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('PersonSearchResultListElementComponent', () => {
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [PersonSearchResultListElementComponent, TruncatePipe],
|
||||||
|
providers: [
|
||||||
|
{provide: TruncatableService, useValue: {}},
|
||||||
|
{provide: DSONameService, useClass: DSONameServiceMock},
|
||||||
|
{ provide: APP_CONFIG, useValue: enviromentNoThumbs }
|
||||||
|
],
|
||||||
|
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).overrideComponent(PersonSearchResultListElementComponent, {
|
||||||
|
set: {changeDetection: ChangeDetectionStrategy.Default}
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
fixture = TestBed.createComponent(PersonSearchResultListElementComponent);
|
||||||
|
personListElementComponent = fixture.componentInstance;
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showThumbnails set to false', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
|
||||||
|
personListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeFalsy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
listableObjectComponent
|
listableObjectComponent
|
||||||
} from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
} from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
} from '../../../../../shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component';
|
} from '../../../../../shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component';
|
||||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
|
import { APP_CONFIG, AppConfig } from '../../../../../../config/app-config.interface';
|
||||||
|
|
||||||
@listableObjectComponent('PersonSearchResult', ViewMode.ListElement)
|
@listableObjectComponent('PersonSearchResult', ViewMode.ListElement)
|
||||||
@Component({
|
@Component({
|
||||||
@@ -20,14 +21,21 @@ import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service
|
|||||||
*/
|
*/
|
||||||
export class PersonSearchResultListElementComponent extends ItemSearchResultListElementComponent {
|
export class PersonSearchResultListElementComponent extends ItemSearchResultListElementComponent {
|
||||||
|
|
||||||
public constructor(protected truncatableService: TruncatableService, protected dsoNameService: DSONameService) {
|
public constructor(
|
||||||
super(truncatableService, dsoNameService);
|
protected truncatableService: TruncatableService,
|
||||||
|
protected dsoNameService: DSONameService,
|
||||||
|
@Inject(APP_CONFIG) protected appConfig: AppConfig
|
||||||
|
) {
|
||||||
|
super(truncatableService, dsoNameService, appConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the person name
|
* Display thumbnail if required by configuration
|
||||||
*/
|
*/
|
||||||
get name() {
|
showThumbnails: boolean;
|
||||||
return this.dsoNameService.getName(this.dso);
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
super.ngOnInit();
|
||||||
|
this.showThumbnails = this.appConfig.browseBy.showThumbnails;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,19 +1,35 @@
|
|||||||
<ds-truncatable [id]="dso.id">
|
<div class="row">
|
||||||
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
<div *ngIf="showThumbnails" class="col-3 col-md-2">
|
||||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer"
|
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||||
[routerLink]="[itemPageRoute]" class="lead item-list-title dont-break-out"
|
rel="noopener noreferrer"
|
||||||
[innerHTML]="dsoTitle"></a>
|
[routerLink]="[itemPageRoute]" class="dont-break-out">
|
||||||
<span *ngIf="linkType == linkTypes.None"
|
<ds-thumbnail [thumbnail]="dso?.thumbnail | async"
|
||||||
class="lead item-list-title dont-break-out"
|
[defaultImage]="'assets/images/project-placeholder.svg'"
|
||||||
[innerHTML]="dsoTitle"></span>
|
[alt]="'thumbnail.project.alt'"
|
||||||
<!--<span class="text-muted">-->
|
[placeholder]="'thumbnail.project.placeholder'">
|
||||||
<!--<ds-truncatable-part [id]="dso.id" [minLines]="1">-->
|
</ds-thumbnail>
|
||||||
<!--<span *ngIf="dso.allMetadata(['project.identifier.status']).length > 0"-->
|
</a>
|
||||||
<!--class="item-list-status">-->
|
</div>
|
||||||
<!--<span *ngFor="let value of allMetadataValues(['project.identifier.status']); let last=last;">-->
|
<div [ngClass]="showThumbnails ? 'col-9' : 'col-md-12'">
|
||||||
<!--<span [innerHTML]="value"><span [innerHTML]="value"></span></span>-->
|
<ds-truncatable [id]="dso.id">
|
||||||
<!--</span>-->
|
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
||||||
<!--</span>-->
|
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||||
<!--</ds-truncatable-part>-->
|
rel="noopener noreferrer"
|
||||||
<!--</span>-->
|
[routerLink]="[itemPageRoute]" class="lead item-list-title dont-break-out"
|
||||||
</ds-truncatable>
|
[innerHTML]="dsoTitle"></a>
|
||||||
|
<span *ngIf="linkType == linkTypes.None"
|
||||||
|
class="lead item-list-title dont-break-out"
|
||||||
|
[innerHTML]="dsoTitle"></span>
|
||||||
|
<!--<span class="text-muted">-->
|
||||||
|
<!--<ds-truncatable-part [id]="dso.id" [minLines]="1">-->
|
||||||
|
<!--<span *ngIf="dso.allMetadata(['project.identifier.status']).length > 0"-->
|
||||||
|
<!--class="item-list-status">-->
|
||||||
|
<!--<span *ngFor="let value of allMetadataValues(['project.identifier.status']); let last=last;">-->
|
||||||
|
<!--<span [innerHTML]="value"><span [innerHTML]="value"></span></span>-->
|
||||||
|
<!--</span>-->
|
||||||
|
<!--</span>-->
|
||||||
|
<!--</ds-truncatable-part>-->
|
||||||
|
<!--</span>-->
|
||||||
|
</ds-truncatable>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@@ -8,6 +8,8 @@ import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
|||||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { By } from '@angular/platform-browser';
|
||||||
|
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||||
|
|
||||||
let projectListElementComponent: ProjectSearchResultListElementComponent;
|
let projectListElementComponent: ProjectSearchResultListElementComponent;
|
||||||
let fixture: ComponentFixture<ProjectSearchResultListElementComponent>;
|
let fixture: ComponentFixture<ProjectSearchResultListElementComponent>;
|
||||||
@@ -50,13 +52,26 @@ const mockItemWithoutMetadata: ItemSearchResult = Object.assign(
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const environmentUseThumbs = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const enviromentNoThumbs = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
describe('ProjectSearchResultListElementComponent', () => {
|
describe('ProjectSearchResultListElementComponent', () => {
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
declarations: [ProjectSearchResultListElementComponent, TruncatePipe],
|
declarations: [ProjectSearchResultListElementComponent, TruncatePipe],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: TruncatableService, useValue: {} },
|
{ provide: TruncatableService, useValue: {} },
|
||||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||||
|
{ provide: APP_CONFIG, useValue: environmentUseThumbs }
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
@@ -71,6 +86,21 @@ describe('ProjectSearchResultListElementComponent', () => {
|
|||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showThumbnails set to true', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
projectListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
it('should set showThumbnails to true', () => {
|
||||||
|
expect(projectListElementComponent.showThumbnails).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// describe('When the item has a status', () => {
|
// describe('When the item has a status', () => {
|
||||||
// beforeEach(() => {
|
// beforeEach(() => {
|
||||||
// projectListElementComponent.item = mockItemWithMetadata;
|
// projectListElementComponent.item = mockItemWithMetadata;
|
||||||
@@ -95,3 +125,40 @@ describe('ProjectSearchResultListElementComponent', () => {
|
|||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('ProjectSearchResultListElementComponent', () => {
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ProjectSearchResultListElementComponent, TruncatePipe],
|
||||||
|
providers: [
|
||||||
|
{provide: TruncatableService, useValue: {}},
|
||||||
|
{provide: DSONameService, useClass: DSONameServiceMock},
|
||||||
|
{ provide: APP_CONFIG, useValue: enviromentNoThumbs }
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).overrideComponent(ProjectSearchResultListElementComponent, {
|
||||||
|
set: {changeDetection: ChangeDetectionStrategy.Default}
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
fixture = TestBed.createComponent(ProjectSearchResultListElementComponent);
|
||||||
|
projectListElementComponent = fixture.componentInstance;
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('with environment.browseBy.showThumbnails set to false', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
|
||||||
|
projectListElementComponent.object = mockItemWithMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not add thumbnail element', () => {
|
||||||
|
const thumbnailElement = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnailElement).toBeFalsy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@@ -13,4 +13,15 @@ import { ItemSearchResultListElementComponent } from '../../../../../shared/obje
|
|||||||
* The component for displaying a list element for an item search result of the type Project
|
* The component for displaying a list element for an item search result of the type Project
|
||||||
*/
|
*/
|
||||||
export class ProjectSearchResultListElementComponent extends ItemSearchResultListElementComponent {
|
export class ProjectSearchResultListElementComponent extends ItemSearchResultListElementComponent {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display thumbnail if required by configuration
|
||||||
|
*/
|
||||||
|
showThumbnails: boolean;
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
super.ngOnInit();
|
||||||
|
this.showThumbnails = this.appConfig.browseBy.showThumbnails;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -8,6 +8,11 @@ const object = Object.assign(new ItemSearchResult(), {
|
|||||||
indexableObject: Object.assign(new Item(), {
|
indexableObject: Object.assign(new Item(), {
|
||||||
id: 'test-item',
|
id: 'test-item',
|
||||||
metadata: {
|
metadata: {
|
||||||
|
'dspace.entity.type': [
|
||||||
|
{
|
||||||
|
value: 'OrgUnit'
|
||||||
|
}
|
||||||
|
],
|
||||||
'organization.legalName': [
|
'organization.legalName': [
|
||||||
{
|
{
|
||||||
value: 'title'
|
value: 'title'
|
||||||
|
@@ -17,12 +17,6 @@ import { Item } from '../../../../../core/shared/item.model';
|
|||||||
* a sidebar search modal
|
* a sidebar search modal
|
||||||
*/
|
*/
|
||||||
export class OrgUnitSidebarSearchListElementComponent extends SidebarSearchListElementComponent<ItemSearchResult, Item> {
|
export class OrgUnitSidebarSearchListElementComponent extends SidebarSearchListElementComponent<ItemSearchResult, Item> {
|
||||||
/**
|
|
||||||
* Get the title of the Org Unit by returning its legal name
|
|
||||||
*/
|
|
||||||
getTitle(): string {
|
|
||||||
return this.firstMetadataValue('organization.legalName');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the description of the Org Unit by returning its dc.description
|
* Get the description of the Org Unit by returning its dc.description
|
||||||
|
@@ -3,12 +3,16 @@ import { Collection } from '../../../../../core/shared/collection.model';
|
|||||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||||
import { createSidebarSearchListElementTests } from '../../../../../shared/object-list/sidebar-search-list-element/sidebar-search-list-element.component.spec';
|
import { createSidebarSearchListElementTests } from '../../../../../shared/object-list/sidebar-search-list-element/sidebar-search-list-element.component.spec';
|
||||||
import { PersonSidebarSearchListElementComponent } from './person-sidebar-search-list-element.component';
|
import { PersonSidebarSearchListElementComponent } from './person-sidebar-search-list-element.component';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
|
||||||
|
|
||||||
const object = Object.assign(new ItemSearchResult(), {
|
const object = Object.assign(new ItemSearchResult(), {
|
||||||
indexableObject: Object.assign(new Item(), {
|
indexableObject: Object.assign(new Item(), {
|
||||||
id: 'test-item',
|
id: 'test-item',
|
||||||
metadata: {
|
metadata: {
|
||||||
|
'dspace.entity.type': [
|
||||||
|
{
|
||||||
|
value: 'Person',
|
||||||
|
}
|
||||||
|
],
|
||||||
'person.familyName': [
|
'person.familyName': [
|
||||||
{
|
{
|
||||||
value: 'family name'
|
value: 'family name'
|
||||||
@@ -40,6 +44,5 @@ const parent = Object.assign(new Collection(), {
|
|||||||
|
|
||||||
describe('PersonSidebarSearchListElementComponent',
|
describe('PersonSidebarSearchListElementComponent',
|
||||||
createSidebarSearchListElementTests(PersonSidebarSearchListElementComponent, object, parent, 'parent title', 'family name, given name', 'job title', [
|
createSidebarSearchListElementTests(PersonSidebarSearchListElementComponent, object, parent, 'parent title', 'family name, given name', 'job title', [
|
||||||
{ provide: TranslateService, useValue: jasmine.createSpyObj('translate', { instant: '' }) }
|
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
@@ -30,25 +30,6 @@ export class PersonSidebarSearchListElementComponent extends SidebarSearchListEl
|
|||||||
super(truncatableService, linkService, dsoNameService);
|
super(truncatableService, linkService, dsoNameService);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the title of the Person by returning a combination of its family name and given name (or "No name found")
|
|
||||||
*/
|
|
||||||
getTitle(): string {
|
|
||||||
const familyName = this.firstMetadataValue('person.familyName');
|
|
||||||
const givenName = this.firstMetadataValue('person.givenName');
|
|
||||||
let title = '';
|
|
||||||
if (isNotEmpty(familyName)) {
|
|
||||||
title = familyName;
|
|
||||||
}
|
|
||||||
if (isNotEmpty(title)) {
|
|
||||||
title += ', ';
|
|
||||||
}
|
|
||||||
if (isNotEmpty(givenName)) {
|
|
||||||
title += givenName;
|
|
||||||
}
|
|
||||||
return this.defaultIfEmpty(title, this.translateService.instant('person.listelement.no-title'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the description of the Person by returning its job title(s)
|
* Get the description of the Person by returning its job title(s)
|
||||||
*/
|
*/
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
<div class="d-flex flex-row">
|
<div class="d-flex flex-row">
|
||||||
<h2 class="item-page-title-field mr-auto">
|
<ds-item-page-title-field [item]="object" class="mr-auto">
|
||||||
{{'orgunit.page.titleprefix' | translate}}<ds-metadata-values [mdValues]="object?.allMetadata(['organization.legalName'])"></ds-metadata-values>
|
</ds-item-page-title-field>
|
||||||
</h2>
|
|
||||||
<div class="pl-2 space-children-mr">
|
<div class="pl-2 space-children-mr">
|
||||||
<ds-dso-page-version-button (newVersionEvent)="onCreateNewVersion()" [dso]="object"
|
<ds-dso-page-version-button (newVersionEvent)="onCreateNewVersion()" [dso]="object"
|
||||||
[tooltipMsgCreate]="'item.page.version.create'"
|
[tooltipMsgCreate]="'item.page.version.create'"
|
||||||
@@ -36,7 +35,7 @@
|
|||||||
[label]="'orgunit.page.id'">
|
[label]="'orgunit.page.id'">
|
||||||
</ds-generic-item-page-field>
|
</ds-generic-item-page-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-md-6">
|
<div class="col-xs-12 col-md-7">
|
||||||
<ds-related-items
|
<ds-related-items
|
||||||
[parentItem]="object"
|
[parentItem]="object"
|
||||||
[relationType]="'isPublicationOfOrgUnit'"
|
[relationType]="'isPublicationOfOrgUnit'"
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
<div class="d-flex flex-row">
|
<div class="d-flex flex-row">
|
||||||
<h2 class="item-page-title-field mr-auto">
|
<ds-item-page-title-field class="mr-auto" [item]="object">
|
||||||
{{'person.page.titleprefix' | translate}}<ds-metadata-values [mdValues]="getTitleMetadataValues()" [separator]="', '"></ds-metadata-values>
|
</ds-item-page-title-field>
|
||||||
</h2>
|
|
||||||
<div class="pl-2 space-children-mr">
|
<div class="pl-2 space-children-mr">
|
||||||
<ds-dso-page-orcid-button [pageRoute]="itemPageRoute" [dso]="object" class="mr-2"></ds-dso-page-orcid-button>
|
<ds-dso-page-orcid-button [pageRoute]="itemPageRoute" [dso]="object" class="mr-2"></ds-dso-page-orcid-button>
|
||||||
<ds-dso-page-version-button (newVersionEvent)="onCreateNewVersion()" [dso]="object"
|
<ds-dso-page-version-button (newVersionEvent)="onCreateNewVersion()" [dso]="object"
|
||||||
@@ -29,7 +28,7 @@
|
|||||||
[label]="'person.page.birthdate'">
|
[label]="'person.page.birthdate'">
|
||||||
</ds-generic-item-page-field>
|
</ds-generic-item-page-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-md-6">
|
<div class="col-xs-12 col-md-7">
|
||||||
<ds-related-items
|
<ds-related-items
|
||||||
[parentItem]="object"
|
[parentItem]="object"
|
||||||
[relationType]="'isProjectOfPerson'"
|
[relationType]="'isProjectOfPerson'"
|
||||||
|
@@ -2,7 +2,6 @@ import { Component } from '@angular/core';
|
|||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
import { VersionedItemComponent } from '../../../../item-page/simple/item-types/versioned-item/versioned-item.component';
|
import { VersionedItemComponent } from '../../../../item-page/simple/item-types/versioned-item/versioned-item.component';
|
||||||
import { MetadataValue } from '../../../../core/shared/metadata.models';
|
|
||||||
|
|
||||||
@listableObjectComponent('Person', ViewMode.StandalonePage)
|
@listableObjectComponent('Person', ViewMode.StandalonePage)
|
||||||
@Component({
|
@Component({
|
||||||
@@ -14,25 +13,4 @@ import { MetadataValue } from '../../../../core/shared/metadata.models';
|
|||||||
* The component for displaying metadata and relations of an item of the type Person
|
* The component for displaying metadata and relations of an item of the type Person
|
||||||
*/
|
*/
|
||||||
export class PersonComponent extends VersionedItemComponent {
|
export class PersonComponent extends VersionedItemComponent {
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the metadata values to be used for the page title.
|
|
||||||
*/
|
|
||||||
getTitleMetadataValues(): MetadataValue[] {
|
|
||||||
const metadataValues = [];
|
|
||||||
const familyName = this.object?.firstMetadata('person.familyName');
|
|
||||||
const givenName = this.object?.firstMetadata('person.givenName');
|
|
||||||
const title = this.object?.firstMetadata('dc.title');
|
|
||||||
if (familyName) {
|
|
||||||
metadataValues.push(familyName);
|
|
||||||
}
|
|
||||||
if (givenName) {
|
|
||||||
metadataValues.push(givenName);
|
|
||||||
}
|
|
||||||
if (metadataValues.length === 0 && title) {
|
|
||||||
metadataValues.push(title);
|
|
||||||
}
|
|
||||||
return metadataValues;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
<div class="d-flex flex-row">
|
<div class="d-flex flex-row">
|
||||||
<h2 class="item-page-title-field mr-auto">
|
<ds-item-page-title-field [item]="object" class="mr-auto">
|
||||||
{{'project.page.titleprefix' | translate}}<ds-metadata-values [mdValues]="object?.allMetadata(['dc.title'])"></ds-metadata-values>
|
</ds-item-page-title-field>
|
||||||
</h2>
|
|
||||||
<div class="pl-2 space-children-mr">
|
<div class="pl-2 space-children-mr">
|
||||||
<ds-dso-page-version-button (newVersionEvent)="onCreateNewVersion()" [dso]="object"
|
<ds-dso-page-version-button (newVersionEvent)="onCreateNewVersion()" [dso]="object"
|
||||||
[tooltipMsgCreate]="'item.page.version.create'"
|
[tooltipMsgCreate]="'item.page.version.create'"
|
||||||
@@ -42,7 +41,7 @@
|
|||||||
<!--[label]="'project.page.expectedcompletion'">-->
|
<!--[label]="'project.page.expectedcompletion'">-->
|
||||||
<!--</ds-generic-item-page-field>-->
|
<!--</ds-generic-item-page-field>-->
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-md-6">
|
<div class="col-xs-12 col-md-7">
|
||||||
<ds-related-items
|
<ds-related-items
|
||||||
[parentItem]="object"
|
[parentItem]="object"
|
||||||
[relationType]="'isPersonOfProject'"
|
[relationType]="'isPersonOfProject'"
|
||||||
|
@@ -6,9 +6,7 @@
|
|||||||
<ds-org-unit-input-suggestions *ngIf="useNameVariants" [suggestions]="allSuggestions" [(ngModel)]="selectedName" (clickSuggestion)="select($event)"
|
<ds-org-unit-input-suggestions *ngIf="useNameVariants" [suggestions]="allSuggestions" [(ngModel)]="selectedName" (clickSuggestion)="select($event)"
|
||||||
(submitSuggestion)="selectCustom($event)"></ds-org-unit-input-suggestions>
|
(submitSuggestion)="selectCustom($event)"></ds-org-unit-input-suggestions>
|
||||||
|
|
||||||
<div *ngIf="!useNameVariants"
|
<div *ngIf="!useNameVariants" class="lead" [innerHTML]="dsoTitle"></div>
|
||||||
class="lead"
|
|
||||||
[innerHTML]="firstMetadataValue('organization.legalName')"></div>
|
|
||||||
|
|
||||||
<span class="text-muted">
|
<span class="text-muted">
|
||||||
<span *ngIf="dso.allMetadata('organization.address.addressLocality').length > 0"
|
<span *ngIf="dso.allMetadata('organization.address.addressLocality').length > 0"
|
||||||
|
@@ -29,6 +29,8 @@ import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
|||||||
import { OrgUnitSearchResultListSubmissionElementComponent } from './org-unit-search-result-list-submission-element.component';
|
import { OrgUnitSearchResultListSubmissionElementComponent } from './org-unit-search-result-list-submission-element.component';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||||
|
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||||
|
import { environment } from '../../../../../../environments/environment';
|
||||||
|
|
||||||
let personListElementComponent: OrgUnitSearchResultListSubmissionElementComponent;
|
let personListElementComponent: OrgUnitSearchResultListSubmissionElementComponent;
|
||||||
let fixture: ComponentFixture<OrgUnitSearchResultListSubmissionElementComponent>;
|
let fixture: ComponentFixture<OrgUnitSearchResultListSubmissionElementComponent>;
|
||||||
@@ -117,7 +119,8 @@ describe('OrgUnitSearchResultListSubmissionElementComponent', () => {
|
|||||||
{ provide: DSOChangeAnalyzer, useValue: {} },
|
{ provide: DSOChangeAnalyzer, useValue: {} },
|
||||||
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
||||||
{ provide: BitstreamDataService, useValue: mockBitstreamDataService },
|
{ provide: BitstreamDataService, useValue: mockBitstreamDataService },
|
||||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||||
|
{ provide: APP_CONFIG, useValue: environment }
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
@@ -179,4 +182,6 @@ describe('OrgUnitSearchResultListSubmissionElementComponent', () => {
|
|||||||
expect(jobTitleField).toBeNull();
|
expect(jobTitleField).toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, Inject, OnInit } from '@angular/core';
|
||||||
import { BitstreamDataService } from '../../../../../core/data/bitstream-data.service';
|
import { BitstreamDataService } from '../../../../../core/data/bitstream-data.service';
|
||||||
import { SearchResultListElementComponent } from '../../../../../shared/object-list/search-result-list-element/search-result-list-element.component';
|
import { SearchResultListElementComponent } from '../../../../../shared/object-list/search-result-list-element/search-result-list-element.component';
|
||||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||||
@@ -17,6 +17,7 @@ import { ItemDataService } from '../../../../../core/data/item-data.service';
|
|||||||
import { SelectableListService } from '../../../../../shared/object-list/selectable-list/selectable-list.service';
|
import { SelectableListService } from '../../../../../shared/object-list/selectable-list/selectable-list.service';
|
||||||
import { NameVariantModalComponent } from '../../name-variant-modal/name-variant-modal.component';
|
import { NameVariantModalComponent } from '../../name-variant-modal/name-variant-modal.component';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
|
import { APP_CONFIG, AppConfig } from '../../../../../../config/app-config.interface';
|
||||||
|
|
||||||
@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.EntitySearchModal)
|
@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.EntitySearchModal)
|
||||||
@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.EntitySearchModalWithNameVariants)
|
@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.EntitySearchModalWithNameVariants)
|
||||||
@@ -35,6 +36,11 @@ export class OrgUnitSearchResultListSubmissionElementComponent extends SearchRes
|
|||||||
alternativeField = 'dc.title.alternative';
|
alternativeField = 'dc.title.alternative';
|
||||||
useNameVariants = false;
|
useNameVariants = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display thumbnail if required by configuration
|
||||||
|
*/
|
||||||
|
showThumbnails: boolean;
|
||||||
|
|
||||||
constructor(protected truncatableService: TruncatableService,
|
constructor(protected truncatableService: TruncatableService,
|
||||||
private relationshipService: RelationshipDataService,
|
private relationshipService: RelationshipDataService,
|
||||||
private notificationsService: NotificationsService,
|
private notificationsService: NotificationsService,
|
||||||
@@ -43,9 +49,10 @@ export class OrgUnitSearchResultListSubmissionElementComponent extends SearchRes
|
|||||||
private itemDataService: ItemDataService,
|
private itemDataService: ItemDataService,
|
||||||
private bitstreamDataService: BitstreamDataService,
|
private bitstreamDataService: BitstreamDataService,
|
||||||
private selectableListService: SelectableListService,
|
private selectableListService: SelectableListService,
|
||||||
protected dsoNameService: DSONameService
|
protected dsoNameService: DSONameService,
|
||||||
|
@Inject(APP_CONFIG) protected appConfig: AppConfig
|
||||||
) {
|
) {
|
||||||
super(truncatableService, dsoNameService);
|
super(truncatableService, dsoNameService, appConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -54,7 +61,7 @@ export class OrgUnitSearchResultListSubmissionElementComponent extends SearchRes
|
|||||||
this.useNameVariants = this.context === Context.EntitySearchModalWithNameVariants;
|
this.useNameVariants = this.context === Context.EntitySearchModalWithNameVariants;
|
||||||
|
|
||||||
if (this.useNameVariants) {
|
if (this.useNameVariants) {
|
||||||
const defaultValue = this.firstMetadataValue('organization.legalName');
|
const defaultValue = this.dsoTitle;
|
||||||
const alternatives = this.allMetadataValues(this.alternativeField);
|
const alternatives = this.allMetadataValues(this.alternativeField);
|
||||||
this.allSuggestions = [defaultValue, ...alternatives];
|
this.allSuggestions = [defaultValue, ...alternatives];
|
||||||
|
|
||||||
@@ -65,6 +72,7 @@ export class OrgUnitSearchResultListSubmissionElementComponent extends SearchRes
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
this.showThumbnails = this.appConfig.browseBy.showThumbnails;
|
||||||
}
|
}
|
||||||
|
|
||||||
select(value) {
|
select(value) {
|
||||||
|
@@ -1,6 +1,20 @@
|
|||||||
<div class="d-flex">
|
<div class="row">
|
||||||
<div class="flex-grow-1">
|
<div *ngIf="showThumbnails" class="col-3 col-md-2">
|
||||||
<ds-person-input-suggestions [suggestions]="allSuggestions" [(ngModel)]="selectedName" (clickSuggestion)="select($event)" (submitSuggestion)="selectCustom($event)"></ds-person-input-suggestions>
|
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||||
|
rel="noopener noreferrer" class="dont-break-out">
|
||||||
|
<ds-thumbnail [thumbnail]="dso?.thumbnail | async"
|
||||||
|
[defaultImage]="'assets/images/person-placeholder.svg'"
|
||||||
|
[alt]="'thumbnail.person.alt'"
|
||||||
|
[placeholder]="'thumbnail.person.placeholder'">
|
||||||
|
</ds-thumbnail>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div [ngClass]="showThumbnails ? 'col-9' : 'col-md-12'">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="flex-grow-1">
|
||||||
|
<ds-person-input-suggestions [suggestions]="allSuggestions" [(ngModel)]="selectedName"
|
||||||
|
(clickSuggestion)="select($event)"
|
||||||
|
(submitSuggestion)="selectCustom($event)"></ds-person-input-suggestions>
|
||||||
<span class="text-muted">
|
<span class="text-muted">
|
||||||
<span *ngIf="dso.allMetadata(['person.jobTitle']).length > 0"
|
<span *ngIf="dso.allMetadata(['person.jobTitle']).length > 0"
|
||||||
class="item-list-job-title">
|
class="item-list-job-title">
|
||||||
@@ -9,5 +23,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -27,6 +27,7 @@ import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-
|
|||||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||||
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
||||||
import { PersonSearchResultListSubmissionElementComponent } from './person-search-result-list-submission-element.component';
|
import { PersonSearchResultListSubmissionElementComponent } from './person-search-result-list-submission-element.component';
|
||||||
|
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||||
|
|
||||||
let personListElementComponent: PersonSearchResultListSubmissionElementComponent;
|
let personListElementComponent: PersonSearchResultListSubmissionElementComponent;
|
||||||
let fixture: ComponentFixture<PersonSearchResultListSubmissionElementComponent>;
|
let fixture: ComponentFixture<PersonSearchResultListSubmissionElementComponent>;
|
||||||
@@ -37,6 +38,18 @@ let mockItemWithoutMetadata: ItemSearchResult;
|
|||||||
let nameVariant;
|
let nameVariant;
|
||||||
let mockRelationshipService;
|
let mockRelationshipService;
|
||||||
|
|
||||||
|
const environmentUseThumbs = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const enviromentNoThumbs = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
mockItemWithMetadata = Object.assign(
|
mockItemWithMetadata = Object.assign(
|
||||||
new ItemSearchResult(),
|
new ItemSearchResult(),
|
||||||
@@ -109,6 +122,7 @@ describe('PersonSearchResultListElementSubmissionComponent', () => {
|
|||||||
{ provide: DSOChangeAnalyzer, useValue: {} },
|
{ provide: DSOChangeAnalyzer, useValue: {} },
|
||||||
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
||||||
{ provide: BitstreamDataService, useValue: mockBitstreamDataService },
|
{ provide: BitstreamDataService, useValue: mockBitstreamDataService },
|
||||||
|
{ provide: APP_CONFIG, useValue: environmentUseThumbs }
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
@@ -146,4 +160,72 @@ describe('PersonSearchResultListElementSubmissionComponent', () => {
|
|||||||
expect(jobTitleField).toBeNull();
|
expect(jobTitleField).toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('When the environment is set to show thumbnails', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
personListElementComponent.object = mockItemWithoutMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add the ds-thumbnail element', () => {
|
||||||
|
const thumbnail = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnail).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('PersonSearchResultListElementSubmissionComponent', () => {
|
||||||
|
const mockBitstreamDataService = {
|
||||||
|
getThumbnailFor(item: Item): Observable<RemoteData<Bitstream>> {
|
||||||
|
return createSuccessfulRemoteDataObject$(new Bitstream());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
init();
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [PersonSearchResultListSubmissionElementComponent, TruncatePipe],
|
||||||
|
providers: [
|
||||||
|
{ provide: TruncatableService, useValue: {} },
|
||||||
|
{ provide: RelationshipDataService, useValue: mockRelationshipService },
|
||||||
|
{ provide: NotificationsService, useValue: {} },
|
||||||
|
{ provide: TranslateService, useValue: {} },
|
||||||
|
{ provide: NgbModal, useValue: {} },
|
||||||
|
{ provide: ItemDataService, useValue: {} },
|
||||||
|
{ provide: SelectableListService, useValue: {} },
|
||||||
|
{ provide: Store, useValue: {}},
|
||||||
|
{ provide: ObjectCacheService, useValue: {} },
|
||||||
|
{ provide: UUIDService, useValue: {} },
|
||||||
|
{ provide: RemoteDataBuildService, useValue: {} },
|
||||||
|
{ provide: CommunityDataService, useValue: {} },
|
||||||
|
{ provide: HALEndpointService, useValue: {} },
|
||||||
|
{ provide: HttpClient, useValue: {} },
|
||||||
|
{ provide: DSOChangeAnalyzer, useValue: {} },
|
||||||
|
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
||||||
|
{ provide: BitstreamDataService, useValue: mockBitstreamDataService },
|
||||||
|
{ provide: APP_CONFIG, useValue: enviromentNoThumbs }
|
||||||
|
],
|
||||||
|
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).overrideComponent(PersonSearchResultListSubmissionElementComponent, {
|
||||||
|
set: { changeDetection: ChangeDetectionStrategy.Default }
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
fixture = TestBed.createComponent(PersonSearchResultListSubmissionElementComponent);
|
||||||
|
personListElementComponent = fixture.componentInstance;
|
||||||
|
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('When the environment is not set to show thumbnails', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
personListElementComponent.object = mockItemWithoutMetadata;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not add the ds-thumbnail element', () => {
|
||||||
|
const thumbnail = fixture.debugElement.query(By.css('ds-thumbnail'));
|
||||||
|
expect(thumbnail).toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, Inject, OnInit } from '@angular/core';
|
||||||
import { BitstreamDataService } from '../../../../../core/data/bitstream-data.service';
|
import { BitstreamDataService } from '../../../../../core/data/bitstream-data.service';
|
||||||
import { SearchResultListElementComponent } from '../../../../../shared/object-list/search-result-list-element/search-result-list-element.component';
|
import { SearchResultListElementComponent } from '../../../../../shared/object-list/search-result-list-element/search-result-list-element.component';
|
||||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||||
@@ -17,6 +17,7 @@ import { MetadataValue } from '../../../../../core/shared/metadata.models';
|
|||||||
import { ItemDataService } from '../../../../../core/data/item-data.service';
|
import { ItemDataService } from '../../../../../core/data/item-data.service';
|
||||||
import { SelectableListService } from '../../../../../shared/object-list/selectable-list/selectable-list.service';
|
import { SelectableListService } from '../../../../../shared/object-list/selectable-list/selectable-list.service';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
|
import { APP_CONFIG, AppConfig } from '../../../../../../config/app-config.interface';
|
||||||
|
|
||||||
@listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.EntitySearchModalWithNameVariants)
|
@listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.EntitySearchModalWithNameVariants)
|
||||||
@Component({
|
@Component({
|
||||||
@@ -33,6 +34,11 @@ export class PersonSearchResultListSubmissionElementComponent extends SearchResu
|
|||||||
selectedName: string;
|
selectedName: string;
|
||||||
alternativeField = 'dc.title.alternative';
|
alternativeField = 'dc.title.alternative';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display thumbnail if required by configuration
|
||||||
|
*/
|
||||||
|
showThumbnails: boolean;
|
||||||
|
|
||||||
constructor(protected truncatableService: TruncatableService,
|
constructor(protected truncatableService: TruncatableService,
|
||||||
private relationshipService: RelationshipDataService,
|
private relationshipService: RelationshipDataService,
|
||||||
private notificationsService: NotificationsService,
|
private notificationsService: NotificationsService,
|
||||||
@@ -41,14 +47,15 @@ export class PersonSearchResultListSubmissionElementComponent extends SearchResu
|
|||||||
private itemDataService: ItemDataService,
|
private itemDataService: ItemDataService,
|
||||||
private bitstreamDataService: BitstreamDataService,
|
private bitstreamDataService: BitstreamDataService,
|
||||||
private selectableListService: SelectableListService,
|
private selectableListService: SelectableListService,
|
||||||
protected dsoNameService: DSONameService
|
protected dsoNameService: DSONameService,
|
||||||
|
@Inject(APP_CONFIG) protected appConfig: AppConfig
|
||||||
) {
|
) {
|
||||||
super(truncatableService, dsoNameService);
|
super(truncatableService, dsoNameService, appConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
const defaultValue = this.firstMetadataValue('person.familyName') + ', ' + this.firstMetadataValue('person.givenName');
|
const defaultValue = this.dsoTitle;
|
||||||
const alternatives = this.allMetadataValues(this.alternativeField);
|
const alternatives = this.allMetadataValues(this.alternativeField);
|
||||||
this.allSuggestions = [defaultValue, ...alternatives];
|
this.allSuggestions = [defaultValue, ...alternatives];
|
||||||
|
|
||||||
@@ -58,6 +65,7 @@ export class PersonSearchResultListSubmissionElementComponent extends SearchResu
|
|||||||
this.selectedName = nameVariant || defaultValue;
|
this.selectedName = nameVariant || defaultValue;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
this.showThumbnails = this.appConfig.browseBy.showThumbnails;
|
||||||
}
|
}
|
||||||
|
|
||||||
select(value) {
|
select(value) {
|
||||||
|
@@ -31,6 +31,7 @@ import { SearchConfigurationServiceStub } from '../../../../shared/testing/searc
|
|||||||
import { ConfigurationProperty } from '../../../../core/shared/configuration-property.model';
|
import { ConfigurationProperty } from '../../../../core/shared/configuration-property.model';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { RouterMock } from '../../../../shared/mocks/router.mock';
|
import { RouterMock } from '../../../../shared/mocks/router.mock';
|
||||||
|
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||||
|
|
||||||
let comp: EditRelationshipListComponent;
|
let comp: EditRelationshipListComponent;
|
||||||
let fixture: ComponentFixture<EditRelationshipListComponent>;
|
let fixture: ComponentFixture<EditRelationshipListComponent>;
|
||||||
@@ -201,6 +202,12 @@ describe('EditRelationshipListComponent', () => {
|
|||||||
}))
|
}))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const environmentUseThumbs = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [SharedModule, TranslateModule.forRoot()],
|
imports: [SharedModule, TranslateModule.forRoot()],
|
||||||
declarations: [EditRelationshipListComponent],
|
declarations: [EditRelationshipListComponent],
|
||||||
@@ -217,6 +224,7 @@ describe('EditRelationshipListComponent', () => {
|
|||||||
{ provide: LinkHeadService, useValue: linkHeadService },
|
{ provide: LinkHeadService, useValue: linkHeadService },
|
||||||
{ provide: ConfigurationDataService, useValue: configurationDataService },
|
{ provide: ConfigurationDataService, useValue: configurationDataService },
|
||||||
{ provide: SearchConfigurationService, useValue: new SearchConfigurationServiceStub() },
|
{ provide: SearchConfigurationService, useValue: new SearchConfigurationServiceStub() },
|
||||||
|
{ provide: APP_CONFIG, useValue: environmentUseThumbs }
|
||||||
], schemas: [
|
], schemas: [
|
||||||
NO_ERRORS_SCHEMA
|
NO_ERRORS_SCHEMA
|
||||||
]
|
]
|
||||||
@@ -259,9 +267,11 @@ describe('EditRelationshipListComponent', () => {
|
|||||||
|
|
||||||
const callArgs = relationshipService.getItemRelationshipsByLabel.calls.mostRecent().args;
|
const callArgs = relationshipService.getItemRelationshipsByLabel.calls.mostRecent().args;
|
||||||
const findListOptions = callArgs[2];
|
const findListOptions = callArgs[2];
|
||||||
|
const linksToFollow = callArgs[5];
|
||||||
expect(findListOptions.elementsPerPage).toEqual(paginationOptions.pageSize);
|
expect(findListOptions.elementsPerPage).toEqual(paginationOptions.pageSize);
|
||||||
expect(findListOptions.currentPage).toEqual(paginationOptions.currentPage);
|
expect(findListOptions.currentPage).toEqual(paginationOptions.currentPage);
|
||||||
|
expect(linksToFollow.linksToFollow[0].name).toEqual('thumbnail');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the publication is on the left side of the relationship', () => {
|
describe('when the publication is on the left side of the relationship', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
|
import { Component, EventEmitter, Inject, Input, OnDestroy, OnInit, Output } from '@angular/core';
|
||||||
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { LinkService } from '../../../../core/cache/builders/link.service';
|
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||||
import { ObjectUpdatesService } from '../../../../core/data/object-updates/object-updates.service';
|
import { ObjectUpdatesService } from '../../../../core/data/object-updates/object-updates.service';
|
||||||
@@ -29,7 +29,7 @@ import { DsDynamicLookupRelationModalComponent } from '../../../../shared/form/b
|
|||||||
import { RelationshipOptions } from '../../../../shared/form/builder/models/relationship-options.model';
|
import { RelationshipOptions } from '../../../../shared/form/builder/models/relationship-options.model';
|
||||||
import { SelectableListService } from '../../../../shared/object-list/selectable-list/selectable-list.service';
|
import { SelectableListService } from '../../../../shared/object-list/selectable-list/selectable-list.service';
|
||||||
import { SearchResult } from '../../../../shared/search/models/search-result.model';
|
import { SearchResult } from '../../../../shared/search/models/search-result.model';
|
||||||
import { followLink } from '../../../../shared/utils/follow-link-config.model';
|
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model';
|
||||||
import { PaginatedList } from '../../../../core/data/paginated-list.model';
|
import { PaginatedList } from '../../../../core/data/paginated-list.model';
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { Collection } from '../../../../core/shared/collection.model';
|
import { Collection } from '../../../../core/shared/collection.model';
|
||||||
@@ -39,6 +39,8 @@ import { RelationshipTypeDataService } from '../../../../core/data/relationship-
|
|||||||
import { FieldUpdate } from '../../../../core/data/object-updates/field-update.model';
|
import { FieldUpdate } from '../../../../core/data/object-updates/field-update.model';
|
||||||
import { FieldUpdates } from '../../../../core/data/object-updates/field-updates.model';
|
import { FieldUpdates } from '../../../../core/data/object-updates/field-updates.model';
|
||||||
import { FieldChangeType } from '../../../../core/data/object-updates/field-change-type.model';
|
import { FieldChangeType } from '../../../../core/data/object-updates/field-change-type.model';
|
||||||
|
import { APP_CONFIG, AppConfig } from '../../../../../config/app-config.interface';
|
||||||
|
import { itemLinksToFollow } from '../../../../shared/utils/relation-query.utils';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-edit-relationship-list',
|
selector: 'ds-edit-relationship-list',
|
||||||
@@ -138,6 +140,10 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
modalRef: NgbModalRef;
|
modalRef: NgbModalRef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether to ask for the embedded item thumbnail.
|
||||||
|
*/
|
||||||
|
fetchThumbnail: boolean;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected objectUpdatesService: ObjectUpdatesService,
|
protected objectUpdatesService: ObjectUpdatesService,
|
||||||
@@ -147,7 +153,9 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
|
|||||||
protected modalService: NgbModal,
|
protected modalService: NgbModal,
|
||||||
protected paginationService: PaginationService,
|
protected paginationService: PaginationService,
|
||||||
protected selectableListService: SelectableListService,
|
protected selectableListService: SelectableListService,
|
||||||
|
@Inject(APP_CONFIG) protected appConfig: AppConfig
|
||||||
) {
|
) {
|
||||||
|
this.fetchThumbnail = this.appConfig.browseBy.showThumbnails;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -484,6 +492,9 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
|
|||||||
tap(() => this.loading$.next(true))
|
tap(() => this.loading$.next(true))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// this adds thumbnail images when required by configuration
|
||||||
|
let linksToFollow: FollowLinkConfig<Relationship>[] = itemLinksToFollow(this.fetchThumbnail);
|
||||||
|
|
||||||
this.subs.push(
|
this.subs.push(
|
||||||
observableCombineLatest([
|
observableCombineLatest([
|
||||||
currentPagination$,
|
currentPagination$,
|
||||||
@@ -496,12 +507,11 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
|
|||||||
currentItemIsLeftItem ? this.relationshipType.leftwardType : this.relationshipType.rightwardType,
|
currentItemIsLeftItem ? this.relationshipType.leftwardType : this.relationshipType.rightwardType,
|
||||||
{
|
{
|
||||||
elementsPerPage: currentPagination.pageSize,
|
elementsPerPage: currentPagination.pageSize,
|
||||||
currentPage: currentPagination.currentPage,
|
currentPage: currentPagination.currentPage
|
||||||
},
|
},
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
followLink('leftItem'),
|
...linksToFollow
|
||||||
followLink('rightItem'),
|
|
||||||
)),
|
)),
|
||||||
).subscribe((rd: RemoteData<PaginatedList<Relationship>>) => {
|
).subscribe((rd: RemoteData<PaginatedList<Relationship>>) => {
|
||||||
this.relationshipsRd$.next(rd);
|
this.relationshipsRd$.next(rd);
|
||||||
|
@@ -16,9 +16,6 @@ import {
|
|||||||
ItemPageAbstractFieldComponent
|
ItemPageAbstractFieldComponent
|
||||||
} from './simple/field-components/specific-field/abstract/item-page-abstract-field.component';
|
} from './simple/field-components/specific-field/abstract/item-page-abstract-field.component';
|
||||||
import { ItemPageUriFieldComponent } from './simple/field-components/specific-field/uri/item-page-uri-field.component';
|
import { ItemPageUriFieldComponent } from './simple/field-components/specific-field/uri/item-page-uri-field.component';
|
||||||
import {
|
|
||||||
ItemPageTitleFieldComponent
|
|
||||||
} from './simple/field-components/specific-field/title/item-page-title-field.component';
|
|
||||||
import { ItemPageFieldComponent } from './simple/field-components/specific-field/item-page-field.component';
|
import { ItemPageFieldComponent } from './simple/field-components/specific-field/item-page-field.component';
|
||||||
import { CollectionsComponent } from './field-components/collections/collections.component';
|
import { CollectionsComponent } from './field-components/collections/collections.component';
|
||||||
import { FullItemPageComponent } from './full/full-item-page.component';
|
import { FullItemPageComponent } from './full/full-item-page.component';
|
||||||
@@ -68,7 +65,6 @@ const DECLARATIONS = [
|
|||||||
ItemPageDateFieldComponent,
|
ItemPageDateFieldComponent,
|
||||||
ItemPageAbstractFieldComponent,
|
ItemPageAbstractFieldComponent,
|
||||||
ItemPageUriFieldComponent,
|
ItemPageUriFieldComponent,
|
||||||
ItemPageTitleFieldComponent,
|
|
||||||
ItemPageFieldComponent,
|
ItemPageFieldComponent,
|
||||||
CollectionsComponent,
|
CollectionsComponent,
|
||||||
FullFileSectionComponent,
|
FullFileSectionComponent,
|
||||||
|
@@ -10,6 +10,7 @@ import { hasValue, isNotEmpty } from '../../../shared/empty.util';
|
|||||||
* An abstract component for displaying an incremental list of objects
|
* An abstract component for displaying an incremental list of objects
|
||||||
*/
|
*/
|
||||||
export class AbstractIncrementalListComponent<T> implements OnInit, OnDestroy {
|
export class AbstractIncrementalListComponent<T> implements OnInit, OnDestroy {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The amount to increment the list by
|
* The amount to increment the list by
|
||||||
* Define this amount in the child component overriding this component
|
* Define this amount in the child component overriding this component
|
||||||
@@ -21,6 +22,11 @@ export class AbstractIncrementalListComponent<T> implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
objects: T[];
|
objects: T[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Placeholder css class (defined in global-styles)
|
||||||
|
*/
|
||||||
|
placeholderFontClass: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of open subscriptions
|
* A list of open subscriptions
|
||||||
*/
|
*/
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<h2 class="item-page-title-field">
|
<h2 class="item-page-title-field">
|
||||||
<div *ngIf="item.firstMetadataValue('dspace.entity.type') as type">
|
<div *ngIf="item.firstMetadataValue('dspace.entity.type') as type" class="d-inline">
|
||||||
{{ type.toLowerCase() + '.page.titleprefix' | translate }}
|
{{ type.toLowerCase() + '.page.titleprefix' | translate }}
|
||||||
</div>
|
</div>
|
||||||
<ds-metadata-values [mdValues]="item?.allMetadata(fields)"></ds-metadata-values>
|
<span class="dont-break-out">{{ dsoNameService.getName(item) }}</span>
|
||||||
</h2>
|
</h2>
|
||||||
|
@@ -1,34 +1,25 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
|
|
||||||
import { Item } from '../../../../../core/shared/item.model';
|
import { Item } from '../../../../../core/shared/item.model';
|
||||||
import { ItemPageFieldComponent } from '../item-page-field.component';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-item-page-title-field',
|
selector: 'ds-item-page-title-field',
|
||||||
templateUrl: './item-page-title-field.component.html'
|
templateUrl: './item-page-title-field.component.html'
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* This component is used for displaying the title (dc.title) of an item
|
* This component is used for displaying the title (defined by the {@link DSONameService}) of an item
|
||||||
*/
|
*/
|
||||||
export class ItemPageTitleFieldComponent extends ItemPageFieldComponent {
|
export class ItemPageTitleFieldComponent {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The item to display metadata for
|
* The item to display metadata for
|
||||||
*/
|
*/
|
||||||
@Input() item: Item;
|
@Input() item: Item;
|
||||||
|
|
||||||
/**
|
constructor(
|
||||||
* Separator string between multiple values of the metadata fields defined
|
public dsoNameService: DSONameService,
|
||||||
* @type {string}
|
) {
|
||||||
*/
|
}
|
||||||
separator: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fields (schema.element.qualifier) used to render their values.
|
|
||||||
* In this component, we want to display values for metadata 'dc.title'
|
|
||||||
*/
|
|
||||||
fields: string[] = [
|
|
||||||
'dc.title'
|
|
||||||
];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -8,9 +8,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex flex-row">
|
<div class="d-flex flex-row">
|
||||||
<h2 class="item-page-title-field mr-auto">
|
<ds-item-page-title-field [item]="object" class="mr-auto">
|
||||||
{{'publication.page.titleprefix' | translate}}<ds-metadata-values [mdValues]="object?.allMetadata(['dc.title'])"></ds-metadata-values>
|
</ds-item-page-title-field>
|
||||||
</h2>
|
|
||||||
<div class="pl-2 space-children-mr">
|
<div class="pl-2 space-children-mr">
|
||||||
<ds-dso-page-version-button (newVersionEvent)="onCreateNewVersion()" [dso]="object"
|
<ds-dso-page-version-button (newVersionEvent)="onCreateNewVersion()" [dso]="object"
|
||||||
[tooltipMsgCreate]="'item.page.version.create'"
|
[tooltipMsgCreate]="'item.page.version.create'"
|
||||||
@@ -53,7 +52,7 @@
|
|||||||
[label]="'publication.page.publisher'">
|
[label]="'publication.page.publisher'">
|
||||||
</ds-generic-item-page-field>
|
</ds-generic-item-page-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-md-6">
|
<div class="col-xs-12 col-md-7">
|
||||||
<ds-related-items
|
<ds-related-items
|
||||||
[parentItem]="object"
|
[parentItem]="object"
|
||||||
[relationType]="'isProjectOfPublication'"
|
[relationType]="'isProjectOfPublication'"
|
||||||
|
@@ -8,9 +8,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex flex-row">
|
<div class="d-flex flex-row">
|
||||||
<h2 class="item-page-title-field mr-auto">
|
<ds-item-page-title-field [item]="object" class="mr-auto">
|
||||||
<ds-metadata-values [mdValues]="object?.allMetadata(['dc.title'])"></ds-metadata-values>
|
</ds-item-page-title-field>
|
||||||
</h2>
|
|
||||||
<div class="pl-2 space-children-mr">
|
<div class="pl-2 space-children-mr">
|
||||||
<ds-dso-page-version-button (newVersionEvent)="onCreateNewVersion()" [dso]="object"
|
<ds-dso-page-version-button (newVersionEvent)="onCreateNewVersion()" [dso]="object"
|
||||||
[tooltipMsgCreate]="'item.page.version.create'"
|
[tooltipMsgCreate]="'item.page.version.create'"
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import { Component, ElementRef, Inject, Input, PLATFORM_ID } from '@angular/core';
|
||||||
import { Item } from '../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
@@ -7,6 +7,9 @@ import { ViewMode } from '../../../core/shared/view-mode.model';
|
|||||||
import { RelationshipDataService } from '../../../core/data/relationship-data.service';
|
import { RelationshipDataService } from '../../../core/data/relationship-data.service';
|
||||||
import { AbstractIncrementalListComponent } from '../abstract-incremental-list/abstract-incremental-list.component';
|
import { AbstractIncrementalListComponent } from '../abstract-incremental-list/abstract-incremental-list.component';
|
||||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||||
|
import { setPlaceHolderAttributes } from '../../../shared/utils/object-list-utils';
|
||||||
|
import { APP_CONFIG, AppConfig } from '../../../../config/app-config.interface';
|
||||||
|
import { isPlatformBrowser } from '@angular/common';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-related-items',
|
selector: 'ds-related-items',
|
||||||
@@ -18,6 +21,7 @@ import { FindListOptions } from '../../../core/data/find-list-options.model';
|
|||||||
* It expects a parent item and relationship type, as well as a label to display on top
|
* It expects a parent item and relationship type, as well as a label to display on top
|
||||||
*/
|
*/
|
||||||
export class RelatedItemsComponent extends AbstractIncrementalListComponent<Observable<RemoteData<PaginatedList<Item>>>> {
|
export class RelatedItemsComponent extends AbstractIncrementalListComponent<Observable<RemoteData<PaginatedList<Item>>>> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The parent of the list of related items to display
|
* The parent of the list of related items to display
|
||||||
*/
|
*/
|
||||||
@@ -53,8 +57,28 @@ export class RelatedItemsComponent extends AbstractIncrementalListComponent<Obse
|
|||||||
*/
|
*/
|
||||||
viewMode = ViewMode.ListElement;
|
viewMode = ViewMode.ListElement;
|
||||||
|
|
||||||
constructor(public relationshipService: RelationshipDataService) {
|
/**
|
||||||
|
* Determines whether to request embedded thumbnail.
|
||||||
|
*/
|
||||||
|
fetchThumbnail: boolean;
|
||||||
|
|
||||||
|
constructor(public relationshipService: RelationshipDataService,
|
||||||
|
protected elementRef: ElementRef,
|
||||||
|
@Inject(APP_CONFIG) protected appConfig: AppConfig,
|
||||||
|
@Inject(PLATFORM_ID) private platformId: Object
|
||||||
|
) {
|
||||||
super();
|
super();
|
||||||
|
this.fetchThumbnail = this.appConfig.browseBy.showThumbnails;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
if (isPlatformBrowser(this.platformId)) {
|
||||||
|
const width = this.elementRef.nativeElement.offsetWidth;
|
||||||
|
this.placeholderFontClass = setPlaceHolderAttributes(width);
|
||||||
|
} else {
|
||||||
|
this.placeholderFontClass = 'hide-placeholder-text';
|
||||||
|
}
|
||||||
|
super.ngOnInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,6 +86,7 @@ export class RelatedItemsComponent extends AbstractIncrementalListComponent<Obse
|
|||||||
* @param page The page to fetch
|
* @param page The page to fetch
|
||||||
*/
|
*/
|
||||||
getPage(page: number): Observable<RemoteData<PaginatedList<Item>>> {
|
getPage(page: number): Observable<RemoteData<PaginatedList<Item>>> {
|
||||||
return this.relationshipService.getRelatedItemsByLabel(this.parentItem, this.relationType, Object.assign(this.options, { elementsPerPage: this.incrementBy, currentPage: page }));
|
return this.relationshipService.getRelatedItemsByLabel(this.parentItem, this.relationType, Object.assign(this.options,
|
||||||
|
{ elementsPerPage: this.incrementBy, currentPage: page, fetchThumbnail: this.fetchThumbnail }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<ds-metadata-field-wrapper [label]="label">
|
<ds-metadata-field-wrapper [label]="label" [ngClass]="placeholderFontClass">
|
||||||
<ng-container *ngFor="let objectPage of objects; let i = index">
|
<ng-container *ngFor="let objectPage of objects; let i = index">
|
||||||
<ng-container *ngVar="(objectPage | async) as itemsRD">
|
<ng-container *ngVar="(objectPage | async) as itemsRD">
|
||||||
<ds-listable-object-component-loader *ngFor="let item of itemsRD?.payload?.page"
|
<ds-listable-object-component-loader *ngFor="let item of itemsRD?.payload?.page"
|
||||||
|
@@ -0,0 +1,8 @@
|
|||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
ds-listable-object-component-loader {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -10,6 +10,7 @@ import { TranslateModule } from '@ngx-translate/core';
|
|||||||
import { VarDirective } from '../../../shared/utils/var.directive';
|
import { VarDirective } from '../../../shared/utils/var.directive';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
||||||
|
import { APP_CONFIG } from '../../../../config/app-config.interface';
|
||||||
|
|
||||||
const parentItem: Item = Object.assign(new Item(), {
|
const parentItem: Item = Object.assign(new Item(), {
|
||||||
bundles: createSuccessfulRemoteDataObject$(createPaginatedList([])),
|
bundles: createSuccessfulRemoteDataObject$(createPaginatedList([])),
|
||||||
@@ -30,6 +31,18 @@ const mockItems = [mockItem1, mockItem2];
|
|||||||
const relationType = 'isItemOfItem';
|
const relationType = 'isItemOfItem';
|
||||||
let relationshipService: RelationshipDataService;
|
let relationshipService: RelationshipDataService;
|
||||||
|
|
||||||
|
const environmentUseThumbs = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const enviromentNoThumbs = {
|
||||||
|
browseBy: {
|
||||||
|
showThumbnails: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
describe('RelatedItemsComponent', () => {
|
describe('RelatedItemsComponent', () => {
|
||||||
let comp: RelatedItemsComponent;
|
let comp: RelatedItemsComponent;
|
||||||
let fixture: ComponentFixture<RelatedItemsComponent>;
|
let fixture: ComponentFixture<RelatedItemsComponent>;
|
||||||
@@ -45,7 +58,8 @@ describe('RelatedItemsComponent', () => {
|
|||||||
imports: [TranslateModule.forRoot()],
|
imports: [TranslateModule.forRoot()],
|
||||||
declarations: [RelatedItemsComponent, VarDirective],
|
declarations: [RelatedItemsComponent, VarDirective],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: RelationshipDataService, useValue: relationshipService }
|
{ provide: RelationshipDataService, useValue: relationshipService },
|
||||||
|
{ provide: APP_CONFIG, useValue: environmentUseThumbs }
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
}).overrideComponent(RelatedItemsComponent, {
|
}).overrideComponent(RelatedItemsComponent, {
|
||||||
@@ -82,9 +96,11 @@ describe('RelatedItemsComponent', () => {
|
|||||||
it('should call relationship-service\'s getRelatedItemsByLabel with the correct arguments (second page)', () => {
|
it('should call relationship-service\'s getRelatedItemsByLabel with the correct arguments (second page)', () => {
|
||||||
expect(relationshipService.getRelatedItemsByLabel).toHaveBeenCalledWith(parentItem, relationType, Object.assign(comp.options, {
|
expect(relationshipService.getRelatedItemsByLabel).toHaveBeenCalledWith(parentItem, relationType, Object.assign(comp.options, {
|
||||||
elementsPerPage: comp.incrementBy,
|
elementsPerPage: comp.incrementBy,
|
||||||
currentPage: 2
|
currentPage: 2,
|
||||||
|
fetchThumbnail: true
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when decrease is called', () => {
|
describe('when decrease is called', () => {
|
||||||
@@ -100,3 +116,42 @@ describe('RelatedItemsComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
describe('RelatedItemsComponent', () => {
|
||||||
|
let comp: RelatedItemsComponent;
|
||||||
|
let fixture: ComponentFixture<RelatedItemsComponent>;
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
relationshipService = jasmine.createSpyObj('relationshipService',
|
||||||
|
{
|
||||||
|
getRelatedItemsByLabel: createSuccessfulRemoteDataObject$(createPaginatedList(mockItems)),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [TranslateModule.forRoot()],
|
||||||
|
declarations: [RelatedItemsComponent, VarDirective],
|
||||||
|
providers: [
|
||||||
|
{provide: RelationshipDataService, useValue: relationshipService},
|
||||||
|
{provide: APP_CONFIG, useValue: enviromentNoThumbs}
|
||||||
|
],
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).overrideComponent(RelatedItemsComponent, {
|
||||||
|
set: {changeDetection: ChangeDetectionStrategy.Default}
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
fixture = TestBed.createComponent(RelatedItemsComponent);
|
||||||
|
comp = fixture.componentInstance;
|
||||||
|
comp.parentItem = parentItem;
|
||||||
|
comp.relationType = relationType;
|
||||||
|
fixture.detectChanges();
|
||||||
|
}));
|
||||||
|
it('should call relationship-service\'s getRelatedItemsByLabel with the correct arguments (second page)', () => {
|
||||||
|
expect(relationshipService.getRelatedItemsByLabel).toHaveBeenCalledWith(parentItem, relationType, Object.assign(comp.options, {
|
||||||
|
elementsPerPage: comp.incrementBy,
|
||||||
|
currentPage: 2,
|
||||||
|
fetchThumbnail: false
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@@ -6,7 +6,7 @@ import { PageErrorComponent } from './page-error.component';
|
|||||||
* Themed wrapper for PageErrorComponent
|
* Themed wrapper for PageErrorComponent
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-themed-search-page',
|
selector: 'ds-themed-page-error',
|
||||||
styleUrls: [],
|
styleUrls: [],
|
||||||
templateUrl: '../shared/theme-support/themed.component.html',
|
templateUrl: '../shared/theme-support/themed.component.html',
|
||||||
})
|
})
|
||||||
|
@@ -6,7 +6,7 @@ import { PageInternalServerErrorComponent } from './page-internal-server-error.c
|
|||||||
* Themed wrapper for PageInternalServerErrorComponent
|
* Themed wrapper for PageInternalServerErrorComponent
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-themed-search-page',
|
selector: 'ds-themed-page-internal-server-error',
|
||||||
styleUrls: [],
|
styleUrls: [],
|
||||||
templateUrl: '../shared/theme-support/themed.component.html',
|
templateUrl: '../shared/theme-support/themed.component.html',
|
||||||
})
|
})
|
||||||
|
@@ -6,7 +6,7 @@ import { PageNotFoundComponent } from './pagenotfound.component';
|
|||||||
* Themed wrapper for PageNotFoundComponent
|
* Themed wrapper for PageNotFoundComponent
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-themed-search-page',
|
selector: 'ds-themed-pagenotfound',
|
||||||
styleUrls: [],
|
styleUrls: [],
|
||||||
templateUrl: '../shared/theme-support/themed.component.html',
|
templateUrl: '../shared/theme-support/themed.component.html',
|
||||||
})
|
})
|
||||||
|
@@ -132,7 +132,7 @@ describe('BrowseByComponent', () => {
|
|||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
{ provide: MockThemedBrowseEntryListElementComponent },
|
{ provide: MockThemedBrowseEntryListElementComponent },
|
||||||
{ provide: ThemeService, useValue: themeService },
|
{ provide: ThemeService, useValue: themeService },
|
||||||
{provide: RouteService, useValue: routeServiceStub},
|
{ provide: RouteService, useValue: routeServiceStub},
|
||||||
{ provide: SelectableListService, useValue: {} },
|
{ provide: SelectableListService, useValue: {} },
|
||||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(800) },
|
{ provide: HostWindowService, useValue: new HostWindowServiceStub(800) },
|
||||||
],
|
],
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<div>
|
<div *ngIf="!spinner">
|
||||||
<label *ngIf="showMessage && message">{{ message }}</label>
|
<label *ngIf="showMessage && message">{{ message }}</label>
|
||||||
<div class="loader">
|
<div class="loader">
|
||||||
<span class="l-1"></span>
|
<span class="l-1"></span>
|
||||||
@@ -13,3 +13,6 @@
|
|||||||
<span class="l-10"></span>
|
<span class="l-10"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div *ngIf='spinner' class="spinner spinner-border" role="status">
|
||||||
|
<span class="sr-only">{{ message }}</span>
|
||||||
|
</div>
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
display: block;
|
display: block;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13,11 +13,11 @@ span[class*="l-"] {
|
|||||||
background: #000;
|
background: #000;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 12px 2px;
|
margin: 12px 2px;
|
||||||
|
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
-webkit-border-radius: 100%;
|
-webkit-border-radius: 100%;
|
||||||
-moz-border-radius: 100%;
|
-moz-border-radius: 100%;
|
||||||
|
|
||||||
-webkit-animation: loader 2s infinite;
|
-webkit-animation: loader 2s infinite;
|
||||||
-webkit-animation-timing-function: cubic-bezier(0.030, 0.615, 0.995, 0.415);
|
-webkit-animation-timing-function: cubic-bezier(0.030, 0.615, 0.995, 0.415);
|
||||||
-webkit-animation-fill-mode: both;
|
-webkit-animation-fill-mode: both;
|
||||||
@@ -71,3 +71,7 @@ span.l-10 {-webkit-animation-delay: 0s;animation-delay: 0s;-ms-animation-delay:
|
|||||||
50% {-ms-transform: translateX(30px); opacity: 0;}
|
50% {-ms-transform: translateX(30px); opacity: 0;}
|
||||||
100% {opacity: 0;}
|
100% {opacity: 0;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.spinner {
|
||||||
|
color: var(--bs-gray-600);
|
||||||
|
}
|
||||||
|
@@ -15,6 +15,11 @@ export class LoadingComponent implements OnDestroy, OnInit {
|
|||||||
@Input() message: string;
|
@Input() message: string;
|
||||||
@Input() showMessage = true;
|
@Input() showMessage = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a more compact spinner animation instead of the default one
|
||||||
|
*/
|
||||||
|
@Input() spinner = false;
|
||||||
|
|
||||||
private subscription: Subscription;
|
private subscription: Subscription;
|
||||||
|
|
||||||
constructor(private translate: TranslateService) {
|
constructor(private translate: TranslateService) {
|
||||||
|
@@ -15,8 +15,9 @@ export class ThemedLoadingComponent extends ThemedComponent<LoadingComponent> {
|
|||||||
|
|
||||||
@Input() message: string;
|
@Input() message: string;
|
||||||
@Input() showMessage = true;
|
@Input() showMessage = true;
|
||||||
|
@Input() spinner = false;
|
||||||
|
|
||||||
protected inAndOutputNames: (keyof LoadingComponent & keyof this)[] = ['message', 'showMessage'];
|
protected inAndOutputNames: (keyof LoadingComponent & keyof this)[] = ['message', 'showMessage', 'spinner'];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected resolver: ComponentFactoryResolver,
|
protected resolver: ComponentFactoryResolver,
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<ds-object-list [config]="config"
|
<ds-object-list [ngClass]="placeholderFontClass" [config]="config"
|
||||||
[sortConfig]="sortConfig"
|
[sortConfig]="sortConfig"
|
||||||
[objects]="objects"
|
[objects]="objects"
|
||||||
[hasBorder]="hasBorder"
|
[hasBorder]="hasBorder"
|
||||||
|
@@ -0,0 +1,5 @@
|
|||||||
|
:host {
|
||||||
|
display:block;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -48,5 +48,9 @@ describe('ObjectCollectionComponent', () => {
|
|||||||
expect(fixture.debugElement.query(By.css('ds-object-list'))).toBeDefined();
|
expect(fixture.debugElement.query(By.css('ds-object-list'))).toBeDefined();
|
||||||
expect(fixture.debugElement.query(By.css('ds-object-grid'))).toBeNull();
|
expect(fixture.debugElement.query(By.css('ds-object-grid'))).toBeNull();
|
||||||
});
|
});
|
||||||
|
it('should set fallback placeholder font size during test', () => {
|
||||||
|
objectCollectionComponent.currentMode$ = observableOf(ViewMode.ListElement);
|
||||||
|
expect(fixture.debugElement.query(By.css('thumb-font-3'))).toBeDefined();
|
||||||
|
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,11 @@
|
|||||||
import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
import {
|
||||||
|
ChangeDetectorRef,
|
||||||
|
Component, ElementRef,
|
||||||
|
EventEmitter, Inject,
|
||||||
|
Input,
|
||||||
|
OnInit,
|
||||||
|
Output, PLATFORM_ID,
|
||||||
|
} from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
@@ -14,6 +21,8 @@ import { ViewMode } from '../../core/shared/view-mode.model';
|
|||||||
import { CollectionElementLinkType } from './collection-element-link.type';
|
import { CollectionElementLinkType } from './collection-element-link.type';
|
||||||
import { PaginatedList } from '../../core/data/paginated-list.model';
|
import { PaginatedList } from '../../core/data/paginated-list.model';
|
||||||
import { Context } from '../../core/shared/context.model';
|
import { Context } from '../../core/shared/context.model';
|
||||||
|
import { setPlaceHolderAttributes } from '../utils/object-list-utils';
|
||||||
|
import { isPlatformBrowser } from '@angular/common';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component that can render a list of listable objects in different view modes
|
* Component that can render a list of listable objects in different view modes
|
||||||
@@ -147,14 +156,13 @@ export class ObjectCollectionComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
viewModeEnum = ViewMode;
|
viewModeEnum = ViewMode;
|
||||||
|
|
||||||
ngOnInit(): void {
|
/**
|
||||||
this.currentMode$ = this.route
|
* Placeholder class (defined in global-styles)
|
||||||
.queryParams
|
*/
|
||||||
.pipe(
|
placeholderFontClass: string;
|
||||||
map((params) => isEmpty(params?.view) ? ViewMode.ListElement : params.view),
|
|
||||||
distinctUntilChanged()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param cdRef
|
* @param cdRef
|
||||||
@@ -163,11 +171,30 @@ export class ObjectCollectionComponent implements OnInit {
|
|||||||
* Route is a singleton service provided by Angular.
|
* Route is a singleton service provided by Angular.
|
||||||
* @param router
|
* @param router
|
||||||
* Router is a singleton service provided by Angular.
|
* Router is a singleton service provided by Angular.
|
||||||
|
* @param elementRef
|
||||||
|
* Used only to read DOM for the element width
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private cdRef: ChangeDetectorRef,
|
private cdRef: ChangeDetectorRef,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private router: Router) {
|
private router: Router,
|
||||||
|
private elementRef: ElementRef,
|
||||||
|
@Inject(PLATFORM_ID) private platformId: Object) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.currentMode$ = this.route
|
||||||
|
.queryParams
|
||||||
|
.pipe(
|
||||||
|
map((params) => isEmpty(params?.view) ? ViewMode.ListElement : params.view),
|
||||||
|
distinctUntilChanged()
|
||||||
|
);
|
||||||
|
if (isPlatformBrowser(this.platformId)) {
|
||||||
|
const width = this.elementRef.nativeElement.offsetWidth;
|
||||||
|
this.placeholderFontClass = setPlaceHolderAttributes(width);
|
||||||
|
} else {
|
||||||
|
this.placeholderFontClass = 'hide-placeholder-text';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -3,10 +3,8 @@
|
|||||||
<ds-mydspace-item-status [status]="status"></ds-mydspace-item-status>
|
<ds-mydspace-item-status [status]="status"></ds-mydspace-item-status>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<div *ngIf="item">
|
<div *ngIf="item">
|
||||||
<h2 class="item-page-title-field">
|
<ds-item-page-title-field [item]="item">
|
||||||
<ds-metadata-values *ngIf="item.hasMetadata('dc.title')" [mdValues]="item?.allMetadata('dc.title')"></ds-metadata-values>
|
</ds-item-page-title-field>
|
||||||
<span class="text-muted" *ngIf="!item.hasMetadata('dc.title')">{{('mydspace.results.no-title' | translate)}}</span>
|
|
||||||
</h2>
|
|
||||||
<div class="row mb-1">
|
<div class="row mb-1">
|
||||||
<div class="col-xs-12 col-md-4">
|
<div class="col-xs-12 col-md-4">
|
||||||
<ds-metadata-field-wrapper [hideIfNoTextContent]="false">
|
<ds-metadata-field-wrapper [hideIfNoTextContent]="false">
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
<ds-access-status-badge [item]="dso"></ds-access-status-badge>
|
<ds-access-status-badge [item]="dso"></ds-access-status-badge>
|
||||||
<ds-truncatable [id]="dso.id">
|
<ds-truncatable [id]="dso.id">
|
||||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||||
<h4 class="card-title" [innerHTML]="firstMetadataValue('dc.title')"></h4>
|
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
|
||||||
</ds-truncatable-part>
|
</ds-truncatable-part>
|
||||||
<ds-truncatable-part [id]="dso.id" [minLines]="1" *ngIf="dso.hasMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*'])">
|
<ds-truncatable-part [id]="dso.id" [minLines]="1" *ngIf="dso.hasMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*'])">
|
||||||
<p class="item-authors card-text text-muted">
|
<p class="item-authors card-text text-muted">
|
||||||
|
@@ -1,11 +1,16 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { focusShadow } from '../../../../animations/focus';
|
import { focusShadow } from '../../../../animations/focus';
|
||||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||||
import { listableObjectComponent } from '../../../../object-collection/shared/listable-object/listable-object.decorator';
|
import {
|
||||||
|
listableObjectComponent
|
||||||
|
} from '../../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
import { SearchResultGridElementComponent } from '../../search-result-grid-element.component';
|
import { SearchResultGridElementComponent } from '../../search-result-grid-element.component';
|
||||||
import { Item } from '../../../../../core/shared/item.model';
|
import { Item } from '../../../../../core/shared/item.model';
|
||||||
import { ItemSearchResult } from '../../../../object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../../object-collection/shared/item-search-result.model';
|
||||||
import { getItemPageRoute } from '../../../../../item-page/item-page-routing-paths';
|
import { getItemPageRoute } from '../../../../../item-page/item-page-routing-paths';
|
||||||
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
|
import { TruncatableService } from '../../../../truncatable/truncatable.service';
|
||||||
|
import { BitstreamDataService } from '../../../../../core/data/bitstream-data.service';
|
||||||
|
|
||||||
@listableObjectComponent('PublicationSearchResult', ViewMode.GridElement)
|
@listableObjectComponent('PublicationSearchResult', ViewMode.GridElement)
|
||||||
@listableObjectComponent(ItemSearchResult, ViewMode.GridElement)
|
@listableObjectComponent(ItemSearchResult, ViewMode.GridElement)
|
||||||
@@ -24,8 +29,19 @@ export class ItemSearchResultGridElementComponent extends SearchResultGridElemen
|
|||||||
*/
|
*/
|
||||||
itemPageRoute: string;
|
itemPageRoute: string;
|
||||||
|
|
||||||
|
dsoTitle: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
protected truncatableService: TruncatableService,
|
||||||
|
protected bitstreamDataService: BitstreamDataService,
|
||||||
|
private dsoNameService: DSONameService,
|
||||||
|
) {
|
||||||
|
super(truncatableService, bitstreamDataService);
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
this.itemPageRoute = getItemPageRoute(this.dso);
|
this.itemPageRoute = getItemPageRoute(this.dso);
|
||||||
|
this.dsoTitle = this.dsoNameService.getName(this.dso);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,6 +17,8 @@ import { ClaimedApprovedTaskSearchResult } from '../../../../object-collection/s
|
|||||||
import { ClaimedApprovedSearchResultListElementComponent } from './claimed-approved-search-result-list-element.component';
|
import { ClaimedApprovedSearchResultListElementComponent } from './claimed-approved-search-result-list-element.component';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../mocks/dso-name.service.mock';
|
||||||
|
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||||
|
import { environment } from '../../../../../../environments/environment';
|
||||||
|
|
||||||
let component: ClaimedApprovedSearchResultListElementComponent;
|
let component: ClaimedApprovedSearchResultListElementComponent;
|
||||||
let fixture: ComponentFixture<ClaimedApprovedSearchResultListElementComponent>;
|
let fixture: ComponentFixture<ClaimedApprovedSearchResultListElementComponent>;
|
||||||
@@ -67,7 +69,8 @@ describe('ClaimedApprovedSearchResultListElementComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: TruncatableService, useValue: {} },
|
{ provide: TruncatableService, useValue: {} },
|
||||||
{ provide: LinkService, useValue: linkService },
|
{ provide: LinkService, useValue: linkService },
|
||||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||||
|
{ provide: APP_CONFIG, useValue: environment }
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
}).overrideComponent(ClaimedApprovedSearchResultListElementComponent, {
|
}).overrideComponent(ClaimedApprovedSearchResultListElementComponent, {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||||
import { ClaimedApprovedTaskSearchResult } from '../../../../object-collection/shared/claimed-approved-task-search-result.model';
|
import { ClaimedApprovedTaskSearchResult } from '../../../../object-collection/shared/claimed-approved-task-search-result.model';
|
||||||
import { listableObjectComponent } from '../../../../object-collection/shared/listable-object/listable-object.decorator';
|
import { listableObjectComponent } from '../../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
@@ -13,6 +13,7 @@ import { SearchResultListElementComponent } from '../../../search-result-list-el
|
|||||||
import { ClaimedTaskSearchResult } from '../../../../object-collection/shared/claimed-task-search-result.model';
|
import { ClaimedTaskSearchResult } from '../../../../object-collection/shared/claimed-task-search-result.model';
|
||||||
import { ClaimedTask } from '../../../../../core/tasks/models/claimed-task-object.model';
|
import { ClaimedTask } from '../../../../../core/tasks/models/claimed-task-object.model';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
|
import { APP_CONFIG, AppConfig } from '../../../../../../config/app-config.interface';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders claimed task approved object for the search result in the list view.
|
* This component renders claimed task approved object for the search result in the list view.
|
||||||
@@ -43,9 +44,10 @@ export class ClaimedApprovedSearchResultListElementComponent extends SearchResul
|
|||||||
public constructor(
|
public constructor(
|
||||||
protected linkService: LinkService,
|
protected linkService: LinkService,
|
||||||
protected truncatableService: TruncatableService,
|
protected truncatableService: TruncatableService,
|
||||||
protected dsoNameService: DSONameService
|
protected dsoNameService: DSONameService,
|
||||||
|
@Inject(APP_CONFIG) protected appConfig: AppConfig
|
||||||
) {
|
) {
|
||||||
super(truncatableService, dsoNameService);
|
super(truncatableService, dsoNameService, appConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -17,6 +17,8 @@ import { LinkService } from '../../../../../core/cache/builders/link.service';
|
|||||||
import { MyDspaceItemStatusType } from '../../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
import { MyDspaceItemStatusType } from '../../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../../mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../../mocks/dso-name.service.mock';
|
||||||
|
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||||
|
import { environment } from '../../../../../../environments/environment';
|
||||||
|
|
||||||
let component: ClaimedDeclinedSearchResultListElementComponent;
|
let component: ClaimedDeclinedSearchResultListElementComponent;
|
||||||
let fixture: ComponentFixture<ClaimedDeclinedSearchResultListElementComponent>;
|
let fixture: ComponentFixture<ClaimedDeclinedSearchResultListElementComponent>;
|
||||||
@@ -67,7 +69,8 @@ describe('ClaimedDeclinedSearchResultListElementComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: TruncatableService, useValue: {} },
|
{ provide: TruncatableService, useValue: {} },
|
||||||
{ provide: LinkService, useValue: linkService },
|
{ provide: LinkService, useValue: linkService },
|
||||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||||
|
{ provide: APP_CONFIG, useValue: environment }
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
}).overrideComponent(ClaimedDeclinedSearchResultListElementComponent, {
|
}).overrideComponent(ClaimedDeclinedSearchResultListElementComponent, {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
|
|
||||||
import { listableObjectComponent } from '../../../../object-collection/shared/listable-object/listable-object.decorator';
|
import { listableObjectComponent } from '../../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
import { ClaimedDeclinedTaskSearchResult } from '../../../../object-collection/shared/claimed-declined-task-search-result.model';
|
import { ClaimedDeclinedTaskSearchResult } from '../../../../object-collection/shared/claimed-declined-task-search-result.model';
|
||||||
@@ -14,6 +14,7 @@ import { SearchResultListElementComponent } from '../../../search-result-list-el
|
|||||||
import { ClaimedTaskSearchResult } from '../../../../object-collection/shared/claimed-task-search-result.model';
|
import { ClaimedTaskSearchResult } from '../../../../object-collection/shared/claimed-task-search-result.model';
|
||||||
import { ClaimedTask } from '../../../../../core/tasks/models/claimed-task-object.model';
|
import { ClaimedTask } from '../../../../../core/tasks/models/claimed-task-object.model';
|
||||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||||
|
import { APP_CONFIG, AppConfig } from '../../../../../../config/app-config.interface';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders claimed task declined object for the search result in the list view.
|
* This component renders claimed task declined object for the search result in the list view.
|
||||||
@@ -44,9 +45,10 @@ export class ClaimedDeclinedSearchResultListElementComponent extends SearchResul
|
|||||||
public constructor(
|
public constructor(
|
||||||
protected linkService: LinkService,
|
protected linkService: LinkService,
|
||||||
protected truncatableService: TruncatableService,
|
protected truncatableService: TruncatableService,
|
||||||
protected dsoNameService: DSONameService
|
protected dsoNameService: DSONameService,
|
||||||
|
@Inject(APP_CONFIG) protected appConfig: AppConfig
|
||||||
) {
|
) {
|
||||||
super(truncatableService, dsoNameService);
|
super(truncatableService, dsoNameService, appConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -18,6 +18,8 @@ import { getMockLinkService } from '../../../mocks/link-service.mock';
|
|||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||||
|
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||||
|
import { environment } from '../../../../../environments/environment';
|
||||||
|
|
||||||
let component: ClaimedSearchResultListElementComponent;
|
let component: ClaimedSearchResultListElementComponent;
|
||||||
let fixture: ComponentFixture<ClaimedSearchResultListElementComponent>;
|
let fixture: ComponentFixture<ClaimedSearchResultListElementComponent>;
|
||||||
@@ -68,7 +70,8 @@ describe('ClaimedSearchResultListElementComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: TruncatableService, useValue: {} },
|
{ provide: TruncatableService, useValue: {} },
|
||||||
{ provide: LinkService, useValue: linkService },
|
{ provide: LinkService, useValue: linkService },
|
||||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||||
|
{ provide: APP_CONFIG, useValue: environment }
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
}).overrideComponent(ClaimedSearchResultListElementComponent, {
|
}).overrideComponent(ClaimedSearchResultListElementComponent, {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
|
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
@@ -13,6 +13,7 @@ import { followLink } from '../../../utils/follow-link-config.model';
|
|||||||
import { SearchResultListElementComponent } from '../../search-result-list-element/search-result-list-element.component';
|
import { SearchResultListElementComponent } from '../../search-result-list-element/search-result-list-element.component';
|
||||||
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
|
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
|
||||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||||
|
import { APP_CONFIG, AppConfig } from '../../../../../config/app-config.interface';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-claimed-search-result-list-element',
|
selector: 'ds-claimed-search-result-list-element',
|
||||||
@@ -40,9 +41,10 @@ export class ClaimedSearchResultListElementComponent extends SearchResultListEle
|
|||||||
public constructor(
|
public constructor(
|
||||||
protected linkService: LinkService,
|
protected linkService: LinkService,
|
||||||
protected truncatableService: TruncatableService,
|
protected truncatableService: TruncatableService,
|
||||||
protected dsoNameService: DSONameService
|
protected dsoNameService: DSONameService,
|
||||||
|
@Inject(APP_CONFIG) protected appConfig: AppConfig
|
||||||
) {
|
) {
|
||||||
super(truncatableService, dsoNameService);
|
super(truncatableService, dsoNameService, appConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user