77472: Fix unclickable titles in search lists

This commit is contained in:
lotte
2021-03-16 16:46:58 +01:00
parent 66463cfc04
commit b833407dd1
44 changed files with 190 additions and 58 deletions

View File

@@ -11,6 +11,8 @@ import { Collection } from '../../../../../core/shared/collection.model';
import { By } from '@angular/platform-browser'; 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 { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
describe('CollectionAdminSearchResultListElementComponent', () => { describe('CollectionAdminSearchResultListElementComponent', () => {
let component: CollectionAdminSearchResultListElementComponent; let component: CollectionAdminSearchResultListElementComponent;
@@ -33,7 +35,8 @@ describe('CollectionAdminSearchResultListElementComponent', () => {
RouterTestingModule.withRoutes([]) RouterTestingModule.withRoutes([])
], ],
declarations: [CollectionAdminSearchResultListElementComponent], declarations: [CollectionAdminSearchResultListElementComponent],
providers: [{ provide: TruncatableService, useValue: {} }], providers: [{ provide: TruncatableService, useValue: {} },
{ provide: DSONameService, useClass: DSONameServiceMock }],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}) })
.compileComponents(); .compileComponents();

View File

@@ -11,6 +11,8 @@ import { CommunityAdminSearchResultListElementComponent } from './community-admi
import { CommunitySearchResult } from '../../../../../shared/object-collection/shared/community-search-result.model'; import { CommunitySearchResult } from '../../../../../shared/object-collection/shared/community-search-result.model';
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 { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
describe('CommunityAdminSearchResultListElementComponent', () => { describe('CommunityAdminSearchResultListElementComponent', () => {
let component: CommunityAdminSearchResultListElementComponent; let component: CommunityAdminSearchResultListElementComponent;
@@ -33,7 +35,8 @@ describe('CommunityAdminSearchResultListElementComponent', () => {
RouterTestingModule.withRoutes([]) RouterTestingModule.withRoutes([])
], ],
declarations: [CommunityAdminSearchResultListElementComponent], declarations: [CommunityAdminSearchResultListElementComponent],
providers: [{ provide: TruncatableService, useValue: {} }], providers: [{ provide: TruncatableService, useValue: {} },
{ provide: DSONameService, useClass: DSONameServiceMock }],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}) })
.compileComponents(); .compileComponents();

View File

@@ -8,6 +8,8 @@ import { RouterTestingModule } from '@angular/router/testing';
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model'; import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
import { ItemAdminSearchResultListElementComponent } from './item-admin-search-result-list-element.component'; import { ItemAdminSearchResultListElementComponent } from './item-admin-search-result-list-element.component';
import { Item } from '../../../../../core/shared/item.model'; import { Item } from '../../../../../core/shared/item.model';
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
describe('ItemAdminSearchResultListElementComponent', () => { describe('ItemAdminSearchResultListElementComponent', () => {
let component: ItemAdminSearchResultListElementComponent; let component: ItemAdminSearchResultListElementComponent;
@@ -30,7 +32,8 @@ describe('ItemAdminSearchResultListElementComponent', () => {
RouterTestingModule.withRoutes([]) RouterTestingModule.withRoutes([])
], ],
declarations: [ItemAdminSearchResultListElementComponent], declarations: [ItemAdminSearchResultListElementComponent],
providers: [{ provide: TruncatableService, useValue: {} }], providers: [{ provide: TruncatableService, useValue: {} },
{ provide: DSONameService, useClass: DSONameServiceMock }],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}) })
.compileComponents(); .compileComponents();

View File

@@ -16,6 +16,8 @@ import { Item } from '../../../../../core/shared/item.model';
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 { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-data.utils'; import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-data.utils';
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 { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
describe('WorkflowItemAdminWorkflowListElementComponent', () => { describe('WorkflowItemAdminWorkflowListElementComponent', () => {
let component: WorkflowItemSearchResultAdminWorkflowListElementComponent; let component: WorkflowItemSearchResultAdminWorkflowListElementComponent;
@@ -49,6 +51,7 @@ describe('WorkflowItemAdminWorkflowListElementComponent', () => {
providers: [ providers: [
{ provide: TruncatableService, useValue: mockTruncatableService }, { provide: TruncatableService, useValue: mockTruncatableService },
{ provide: LinkService, useValue: linkService }, { provide: LinkService, useValue: linkService },
{ provide: DSONameService, useClass: DSONameServiceMock }
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}) })

View File

@@ -12,6 +12,7 @@ import { Item } from '../../../../../core/shared/item.model';
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 { 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';
@listableObjectComponent(WorkflowItemSearchResult, ViewMode.ListElement, Context.AdminWorkflowSearch) @listableObjectComponent(WorkflowItemSearchResult, ViewMode.ListElement, Context.AdminWorkflowSearch)
@Component({ @Component({
@@ -29,8 +30,11 @@ export class WorkflowItemSearchResultAdminWorkflowListElementComponent extends S
*/ */
public item$: Observable<Item>; public item$: Observable<Item>;
constructor(private linkService: LinkService, protected truncatableService: TruncatableService) { constructor(private linkService: LinkService,
super(truncatableService); protected truncatableService: TruncatableService,
protected dsoNameService: DSONameService
) {
super(truncatableService, dsoNameService);
} }
/** /**

View File

@@ -45,7 +45,7 @@ describe(`DSONameService`, () => {
} }
}); });
service = new DSONameService(); service = new DSONameService({ instant: (a) => a } as any);
}); });
describe(`getName`, () => { describe(`getName`, () => {

View File

@@ -1,6 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { hasValue } from '../../shared/empty.util'; import { hasValue } from '../../shared/empty.util';
import { DSpaceObject } from '../shared/dspace-object.model'; import { DSpaceObject } from '../shared/dspace-object.model';
import { TranslateService } from '@ngx-translate/core';
/** /**
* Returns a name for a {@link DSpaceObject} based * Returns a name for a {@link DSpaceObject} based
@@ -11,6 +12,10 @@ import { DSpaceObject } from '../shared/dspace-object.model';
}) })
export class DSONameService { export class DSONameService {
constructor(private translateService: TranslateService) {
}
/** /**
* Functions to generate the specific names. * Functions to generate the specific names.
* *
@@ -29,7 +34,7 @@ export class DSONameService {
}, },
Default: (dso: DSpaceObject): string => { Default: (dso: DSpaceObject): string => {
// If object doesn't have dc.title metadata use name property // If object doesn't have dc.title metadata use name property
return dso.firstMetadataValue('dc.title') || dso.name; return dso.firstMetadataValue('dc.title') || dso.name || this.translateService.instant('dso.name.untitled');
} }
}; };

View File

@@ -7,6 +7,8 @@ import { JournalIssueSearchResultListElementComponent } from './journal-issue-se
import { Item } from '../../../../../core/shared/item.model'; import { Item } from '../../../../../core/shared/item.model';
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe'; 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 { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
let journalIssueListElementComponent: JournalIssueSearchResultListElementComponent; let journalIssueListElementComponent: JournalIssueSearchResultListElementComponent;
let fixture: ComponentFixture<JournalIssueSearchResultListElementComponent>; let fixture: ComponentFixture<JournalIssueSearchResultListElementComponent>;
@@ -60,7 +62,8 @@ describe('JournalIssueSearchResultListElementComponent', () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [JournalIssueSearchResultListElementComponent, TruncatePipe], declarations: [JournalIssueSearchResultListElementComponent, TruncatePipe],
providers: [ providers: [
{ provide: TruncatableService, useValue: {} } { provide: TruncatableService, useValue: {} },
{ provide: DSONameService, useClass: DSONameServiceMock }
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]

View File

@@ -7,6 +7,8 @@ import { Item } from '../../../../../core/shared/item.model';
import { JournalVolumeSearchResultListElementComponent } from './journal-volume-search-result-list-element.component'; import { JournalVolumeSearchResultListElementComponent } from './journal-volume-search-result-list-element.component';
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe'; 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 { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
let journalVolumeListElementComponent: JournalVolumeSearchResultListElementComponent; let journalVolumeListElementComponent: JournalVolumeSearchResultListElementComponent;
let fixture: ComponentFixture<JournalVolumeSearchResultListElementComponent>; let fixture: ComponentFixture<JournalVolumeSearchResultListElementComponent>;
@@ -59,7 +61,8 @@ describe('JournalVolumeSearchResultListElementComponent', () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [JournalVolumeSearchResultListElementComponent, TruncatePipe], declarations: [JournalVolumeSearchResultListElementComponent, TruncatePipe],
providers: [ providers: [
{ provide: TruncatableService, useValue: {} } { provide: TruncatableService, useValue: {} },
{ provide: DSONameService, useClass: DSONameServiceMock },
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]

View File

@@ -7,6 +7,8 @@ import { Item } from '../../../../../core/shared/item.model';
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe'; import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service'; import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
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 { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
let journalListElementComponent: JournalSearchResultListElementComponent; let journalListElementComponent: JournalSearchResultListElementComponent;
let fixture: ComponentFixture<JournalSearchResultListElementComponent>; let fixture: ComponentFixture<JournalSearchResultListElementComponent>;
@@ -55,7 +57,8 @@ describe('JournalSearchResultListElementComponent', () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [JournalSearchResultListElementComponent, TruncatePipe], declarations: [JournalSearchResultListElementComponent, TruncatePipe],
providers: [ providers: [
{ provide: TruncatableService, useValue: {} } { provide: TruncatableService, useValue: {} },
{ provide: DSONameService, useClass: DSONameServiceMock },
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]

View File

@@ -7,6 +7,8 @@ import { Item } from '../../../../../core/shared/item.model';
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe'; import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service'; import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
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 { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
let orgUnitListElementComponent: OrgUnitSearchResultListElementComponent; let orgUnitListElementComponent: OrgUnitSearchResultListElementComponent;
let fixture: ComponentFixture<OrgUnitSearchResultListElementComponent>; let fixture: ComponentFixture<OrgUnitSearchResultListElementComponent>;
@@ -53,7 +55,8 @@ describe('OrgUnitSearchResultListElementComponent', () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ OrgUnitSearchResultListElementComponent , TruncatePipe], declarations: [ OrgUnitSearchResultListElementComponent , TruncatePipe],
providers: [ providers: [
{ provide: TruncatableService, useValue: {} } { provide: TruncatableService, useValue: {} },
{ provide: DSONameService, useClass: DSONameServiceMock }
], ],
schemas: [ NO_ERRORS_SCHEMA ] schemas: [ NO_ERRORS_SCHEMA ]

View File

@@ -7,6 +7,8 @@ import { PersonSearchResultListElementComponent } from './person-search-result-l
import { Item } from '../../../../../core/shared/item.model'; import { Item } from '../../../../../core/shared/item.model';
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe'; 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 { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
let personListElementComponent: PersonSearchResultListElementComponent; let personListElementComponent: PersonSearchResultListElementComponent;
let fixture: ComponentFixture<PersonSearchResultListElementComponent>; let fixture: ComponentFixture<PersonSearchResultListElementComponent>;
@@ -53,7 +55,8 @@ describe('PersonSearchResultListElementComponent', () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [PersonSearchResultListElementComponent, TruncatePipe], declarations: [PersonSearchResultListElementComponent, TruncatePipe],
providers: [ providers: [
{ provide: TruncatableService, useValue: {} } { provide: TruncatableService, useValue: {} },
{ provide: DSONameService, useClass: DSONameServiceMock }
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]

View File

@@ -6,6 +6,8 @@ import { ProjectSearchResultListElementComponent } from './project-search-result
import { Item } from '../../../../../core/shared/item.model'; import { Item } from '../../../../../core/shared/item.model';
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe'; 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 { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
let projectListElementComponent: ProjectSearchResultListElementComponent; let projectListElementComponent: ProjectSearchResultListElementComponent;
let fixture: ComponentFixture<ProjectSearchResultListElementComponent>; let fixture: ComponentFixture<ProjectSearchResultListElementComponent>;
@@ -53,7 +55,8 @@ describe('ProjectSearchResultListElementComponent', () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ProjectSearchResultListElementComponent, TruncatePipe], declarations: [ProjectSearchResultListElementComponent, TruncatePipe],
providers: [ providers: [
{ provide: TruncatableService, useValue: {} } { provide: TruncatableService, useValue: {} },
{ provide: DSONameService, useClass: DSONameServiceMock }
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]

View File

@@ -9,6 +9,7 @@ import { isNotEmpty } from '../../../../../shared/empty.util';
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service'; import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
import { LinkService } from '../../../../../core/cache/builders/link.service'; import { LinkService } from '../../../../../core/cache/builders/link.service';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
@listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.SideBarSearchModal) @listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.SideBarSearchModal)
@listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.SideBarSearchModalCurrent) @listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.SideBarSearchModalCurrent)
@@ -23,8 +24,10 @@ import { TranslateService } from '@ngx-translate/core';
export class PersonSidebarSearchListElementComponent extends SidebarSearchListElementComponent<ItemSearchResult, Item> { export class PersonSidebarSearchListElementComponent extends SidebarSearchListElementComponent<ItemSearchResult, Item> {
constructor(protected truncatableService: TruncatableService, constructor(protected truncatableService: TruncatableService,
protected linkService: LinkService, protected linkService: LinkService,
protected translateService: TranslateService) { protected translateService: TranslateService,
super(truncatableService, linkService); protected dsoNameService: DSONameService
) {
super(truncatableService, linkService, dsoNameService);
} }
/** /**

View File

@@ -27,6 +27,8 @@ 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 { 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 { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
let personListElementComponent: OrgUnitSearchResultListSubmissionElementComponent; let personListElementComponent: OrgUnitSearchResultListSubmissionElementComponent;
let fixture: ComponentFixture<OrgUnitSearchResultListSubmissionElementComponent>; let fixture: ComponentFixture<OrgUnitSearchResultListSubmissionElementComponent>;
@@ -115,6 +117,7 @@ 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 }
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]

View File

@@ -19,6 +19,8 @@ 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 { NameVariantModalComponent } from '../../name-variant-modal/name-variant-modal.component'; import { NameVariantModalComponent } from '../../name-variant-modal/name-variant-modal.component';
import { LinkService } from '../../../../../core/cache/builders/link.service';
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.EntitySearchModal) @listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.EntitySearchModal)
@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.EntitySearchModalWithNameVariants) @listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.EntitySearchModalWithNameVariants)
@@ -44,8 +46,10 @@ export class OrgUnitSearchResultListSubmissionElementComponent extends SearchRes
private modalService: NgbModal, private modalService: NgbModal,
private itemDataService: ItemDataService, private itemDataService: ItemDataService,
private bitstreamDataService: BitstreamDataService, private bitstreamDataService: BitstreamDataService,
private selectableListService: SelectableListService) { private selectableListService: SelectableListService,
super(truncatableService); protected dsoNameService: DSONameService
) {
super(truncatableService, dsoNameService);
} }
ngOnInit() { ngOnInit() {

View File

@@ -19,6 +19,8 @@ import { NameVariantModalComponent } from '../../name-variant-modal/name-variant
import { MetadataValue } from '../../../../../core/shared/metadata.models'; 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 { LinkService } from '../../../../../core/cache/builders/link.service';
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
@listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.EntitySearchModalWithNameVariants) @listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.EntitySearchModalWithNameVariants)
@Component({ @Component({
@@ -42,8 +44,10 @@ export class PersonSearchResultListSubmissionElementComponent extends SearchResu
private modalService: NgbModal, private modalService: NgbModal,
private itemDataService: ItemDataService, private itemDataService: ItemDataService,
private bitstreamDataService: BitstreamDataService, private bitstreamDataService: BitstreamDataService,
private selectableListService: SelectableListService) { private selectableListService: SelectableListService,
super(truncatableService); protected dsoNameService: DSONameService
) {
super(truncatableService, dsoNameService);
} }
ngOnInit() { ngOnInit() {

View File

@@ -0,0 +1,9 @@
import { DSpaceObject } from '../../core/shared/dspace-object.model';
export const UNDEFINED_NAME = 'Undefined';
export class DSONameServiceMock {
public getName(dso: DSpaceObject) {
return UNDEFINED_NAME;
}
}

View File

@@ -15,6 +15,8 @@ import { VarDirective } from '../../../utils/var.directive';
import { LinkService } from '../../../../core/cache/builders/link.service'; import { LinkService } from '../../../../core/cache/builders/link.service';
import { getMockLinkService } from '../../../mocks/link-service.mock'; 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 { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
let component: PoolSearchResultDetailElementComponent; let component: PoolSearchResultDetailElementComponent;
let fixture: ComponentFixture<PoolSearchResultDetailElementComponent>; let fixture: ComponentFixture<PoolSearchResultDetailElementComponent>;
@@ -67,7 +69,8 @@ describe('PoolSearchResultDetailElementComponent', () => {
providers: [ providers: [
{ provide: 'objectElementProvider', useValue: (mockResultObject) }, { provide: 'objectElementProvider', useValue: (mockResultObject) },
{ provide: 'indexElementProvider', useValue: (compIndex) }, { provide: 'indexElementProvider', useValue: (compIndex) },
{ provide: LinkService, useValue: linkService } { provide: LinkService, useValue: linkService },
{ provide: DSONameService, useClass: DSONameServiceMock },
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).overrideComponent(PoolSearchResultDetailElementComponent, { }).overrideComponent(PoolSearchResultDetailElementComponent, {

View File

@@ -12,6 +12,8 @@ import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflow-item-search-result.model'; import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflow-item-search-result.model';
import { getMockLinkService } from '../../../mocks/link-service.mock'; import { getMockLinkService } from '../../../mocks/link-service.mock';
import { LinkService } from '../../../../core/cache/builders/link.service'; import { LinkService } from '../../../../core/cache/builders/link.service';
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
let component: WorkflowItemSearchResultDetailElementComponent; let component: WorkflowItemSearchResultDetailElementComponent;
let fixture: ComponentFixture<WorkflowItemSearchResultDetailElementComponent>; let fixture: ComponentFixture<WorkflowItemSearchResultDetailElementComponent>;
@@ -62,7 +64,8 @@ describe('WorkflowItemSearchResultDetailElementComponent', () => {
providers: [ providers: [
{ provide: 'objectElementProvider', useValue: (mockResultObject) }, { provide: 'objectElementProvider', useValue: (mockResultObject) },
{ provide: 'indexElementProvider', useValue: (compIndex) }, { provide: 'indexElementProvider', useValue: (compIndex) },
{ provide: LinkService, useValue: linkService } { provide: LinkService, useValue: linkService },
{ provide: DSONameService, useClass: DSONameServiceMock },
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).overrideComponent(WorkflowItemSearchResultDetailElementComponent, { }).overrideComponent(WorkflowItemSearchResultDetailElementComponent, {

View File

@@ -12,6 +12,8 @@ import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflow-item-search-result.model'; import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflow-item-search-result.model';
import { getMockLinkService } from '../../../mocks/link-service.mock'; import { getMockLinkService } from '../../../mocks/link-service.mock';
import { LinkService } from '../../../../core/cache/builders/link.service'; import { LinkService } from '../../../../core/cache/builders/link.service';
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
let component: WorkspaceItemSearchResultDetailElementComponent; let component: WorkspaceItemSearchResultDetailElementComponent;
let fixture: ComponentFixture<WorkspaceItemSearchResultDetailElementComponent>; let fixture: ComponentFixture<WorkspaceItemSearchResultDetailElementComponent>;
@@ -62,7 +64,8 @@ describe('WorkspaceItemSearchResultDetailElementComponent', () => {
providers: [ providers: [
{ provide: 'objectElementProvider', useValue: (mockResultObject) }, { provide: 'objectElementProvider', useValue: (mockResultObject) },
{ provide: 'indexElementProvider', useValue: (compIndex) }, { provide: 'indexElementProvider', useValue: (compIndex) },
{ provide: LinkService, useValue: linkService } { provide: LinkService, useValue: linkService },
{ provide: DSONameService, useClass: DSONameServiceMock },
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).overrideComponent(WorkspaceItemSearchResultDetailElementComponent, { }).overrideComponent(WorkspaceItemSearchResultDetailElementComponent, {

View File

@@ -15,6 +15,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 { ClaimedApprovedTaskSearchResult } from '../../../../object-collection/shared/claimed-approved-task-search-result.model'; import { ClaimedApprovedTaskSearchResult } from '../../../../object-collection/shared/claimed-approved-task-search-result.model';
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 { DSONameServiceMock } from '../../../../mocks/dso-name.service.mock';
let component: ClaimedApprovedSearchResultListElementComponent; let component: ClaimedApprovedSearchResultListElementComponent;
let fixture: ComponentFixture<ClaimedApprovedSearchResultListElementComponent>; let fixture: ComponentFixture<ClaimedApprovedSearchResultListElementComponent>;
@@ -64,7 +66,8 @@ describe('ClaimedApprovedSearchResultListElementComponent', () => {
declarations: [ClaimedApprovedSearchResultListElementComponent, VarDirective], declarations: [ClaimedApprovedSearchResultListElementComponent, VarDirective],
providers: [ providers: [
{ provide: TruncatableService, useValue: {} }, { provide: TruncatableService, useValue: {} },
{ provide: LinkService, useValue: linkService } { provide: LinkService, useValue: linkService },
{ provide: DSONameService, useClass: DSONameServiceMock }
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).overrideComponent(ClaimedApprovedSearchResultListElementComponent, { }).overrideComponent(ClaimedApprovedSearchResultListElementComponent, {

View File

@@ -12,6 +12,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 { 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';
/** /**
* 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.
@@ -41,9 +42,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
) { ) {
super(truncatableService); super(truncatableService, dsoNameService);
} }
/** /**

View File

@@ -15,6 +15,8 @@ import { VarDirective } from '../../../../utils/var.directive';
import { TruncatableService } from '../../../../truncatable/truncatable.service'; import { TruncatableService } from '../../../../truncatable/truncatable.service';
import { LinkService } from '../../../../../core/cache/builders/link.service'; 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 { DSONameServiceMock } from '../../../../mocks/dso-name.service.mock';
let component: ClaimedDeclinedSearchResultListElementComponent; let component: ClaimedDeclinedSearchResultListElementComponent;
let fixture: ComponentFixture<ClaimedDeclinedSearchResultListElementComponent>; let fixture: ComponentFixture<ClaimedDeclinedSearchResultListElementComponent>;
@@ -64,7 +66,8 @@ describe('ClaimedDeclinedSearchResultListElementComponent', () => {
declarations: [ClaimedDeclinedSearchResultListElementComponent, VarDirective], declarations: [ClaimedDeclinedSearchResultListElementComponent, VarDirective],
providers: [ providers: [
{ provide: TruncatableService, useValue: {} }, { provide: TruncatableService, useValue: {} },
{ provide: LinkService, useValue: linkService } { provide: LinkService, useValue: linkService },
{ provide: DSONameService, useClass: DSONameServiceMock }
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).overrideComponent(ClaimedDeclinedSearchResultListElementComponent, { }).overrideComponent(ClaimedDeclinedSearchResultListElementComponent, {

View File

@@ -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 { 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';
/** /**
* 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.
@@ -42,9 +43,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
) { ) {
super(truncatableService); super(truncatableService, dsoNameService);
} }
/** /**

View File

@@ -16,6 +16,8 @@ import { VarDirective } from '../../../utils/var.directive';
import { LinkService } from '../../../../core/cache/builders/link.service'; import { LinkService } from '../../../../core/cache/builders/link.service';
import { getMockLinkService } from '../../../mocks/link-service.mock'; 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 { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
let component: ClaimedSearchResultListElementComponent; let component: ClaimedSearchResultListElementComponent;
let fixture: ComponentFixture<ClaimedSearchResultListElementComponent>; let fixture: ComponentFixture<ClaimedSearchResultListElementComponent>;
@@ -65,7 +67,8 @@ describe('ClaimedSearchResultListElementComponent', () => {
declarations: [ClaimedSearchResultListElementComponent, VarDirective], declarations: [ClaimedSearchResultListElementComponent, VarDirective],
providers: [ providers: [
{ provide: TruncatableService, useValue: {} }, { provide: TruncatableService, useValue: {} },
{ provide: LinkService, useValue: linkService } { provide: LinkService, useValue: linkService },
{ provide: DSONameService, useClass: DSONameServiceMock }
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).overrideComponent(ClaimedSearchResultListElementComponent, { }).overrideComponent(ClaimedSearchResultListElementComponent, {

View File

@@ -12,6 +12,7 @@ import { WorkflowItem } from '../../../../core/submission/models/workflowitem.mo
import { followLink } from '../../../utils/follow-link-config.model'; 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';
@Component({ @Component({
selector: 'ds-claimed-search-result-list-element', selector: 'ds-claimed-search-result-list-element',
@@ -38,9 +39,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
) { ) {
super(truncatableService); super(truncatableService, dsoNameService);
} }
/** /**

View File

@@ -10,6 +10,8 @@ import { ItemSearchResult } from '../../../object-collection/shared/item-search-
import { ItemSearchResultListElementSubmissionComponent } from './item-search-result-list-element-submission.component'; import { ItemSearchResultListElementSubmissionComponent } from './item-search-result-list-element-submission.component';
import { TruncatableService } from '../../../truncatable/truncatable.service'; import { TruncatableService } from '../../../truncatable/truncatable.service';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
let component: ItemSearchResultListElementSubmissionComponent; let component: ItemSearchResultListElementSubmissionComponent;
let fixture: ComponentFixture<ItemSearchResultListElementSubmissionComponent>; let fixture: ComponentFixture<ItemSearchResultListElementSubmissionComponent>;
@@ -54,6 +56,7 @@ describe('ItemMyDSpaceResultListElementComponent', () => {
declarations: [ItemSearchResultListElementSubmissionComponent], declarations: [ItemSearchResultListElementSubmissionComponent],
providers: [ providers: [
{ provide: TruncatableService, useValue: {} }, { provide: TruncatableService, useValue: {} },
{ provide: DSONameService, useClass: DSONameServiceMock }
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).overrideComponent(ItemSearchResultListElementSubmissionComponent, { }).overrideComponent(ItemSearchResultListElementSubmissionComponent, {

View File

@@ -16,6 +16,8 @@ import { VarDirective } from '../../../utils/var.directive';
import { LinkService } from '../../../../core/cache/builders/link.service'; import { LinkService } from '../../../../core/cache/builders/link.service';
import { getMockLinkService } from '../../../mocks/link-service.mock'; 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 { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
let component: PoolSearchResultListElementComponent; let component: PoolSearchResultListElementComponent;
let fixture: ComponentFixture<PoolSearchResultListElementComponent>; let fixture: ComponentFixture<PoolSearchResultListElementComponent>;
@@ -65,7 +67,8 @@ describe('PoolSearchResultListElementComponent', () => {
declarations: [PoolSearchResultListElementComponent, VarDirective], declarations: [PoolSearchResultListElementComponent, VarDirective],
providers: [ providers: [
{ provide: TruncatableService, useValue: {} }, { provide: TruncatableService, useValue: {} },
{ provide: LinkService, useValue: linkService } { provide: LinkService, useValue: linkService },
{ provide: DSONameService, useClass: DSONameServiceMock }
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).overrideComponent(PoolSearchResultListElementComponent, { }).overrideComponent(PoolSearchResultListElementComponent, {

View File

@@ -13,6 +13,7 @@ import { SearchResultListElementComponent } from '../../search-result-list-eleme
import { TruncatableService } from '../../../truncatable/truncatable.service'; import { TruncatableService } from '../../../truncatable/truncatable.service';
import { followLink } from '../../../utils/follow-link-config.model'; import { followLink } from '../../../utils/follow-link-config.model';
import { LinkService } from '../../../../core/cache/builders/link.service'; import { LinkService } from '../../../../core/cache/builders/link.service';
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
/** /**
* This component renders pool task object for the search result in the list view. * This component renders pool task object for the search result in the list view.
@@ -48,9 +49,10 @@ export class PoolSearchResultListElementComponent extends SearchResultListElemen
constructor( constructor(
protected linkService: LinkService, protected linkService: LinkService,
protected truncatableService: TruncatableService protected truncatableService: TruncatableService,
protected dsoNameService: DSONameService
) { ) {
super(truncatableService); super(truncatableService, dsoNameService);
} }
/** /**

View File

@@ -16,6 +16,8 @@ import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
import { TruncatableService } from '../../../truncatable/truncatable.service'; import { TruncatableService } from '../../../truncatable/truncatable.service';
import { WorkflowItemSearchResultListElementComponent } from './workflow-item-search-result-list-element.component'; import { WorkflowItemSearchResultListElementComponent } from './workflow-item-search-result-list-element.component';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
let component: WorkflowItemSearchResultListElementComponent; let component: WorkflowItemSearchResultListElementComponent;
let fixture: ComponentFixture<WorkflowItemSearchResultListElementComponent>; let fixture: ComponentFixture<WorkflowItemSearchResultListElementComponent>;
@@ -67,6 +69,7 @@ describe('WorkflowItemSearchResultListElementComponent', () => {
{ provide: TruncatableService, useValue: {} }, { provide: TruncatableService, useValue: {} },
{ provide: ItemDataService, useValue: {} }, { provide: ItemDataService, useValue: {} },
{ provide: LinkService, useValue: linkService }, { provide: LinkService, useValue: linkService },
{ provide: DSONameService, useClass: DSONameServiceMock }
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).overrideComponent(WorkflowItemSearchResultListElementComponent, { }).overrideComponent(WorkflowItemSearchResultListElementComponent, {

View File

@@ -15,6 +15,7 @@ import { WorkflowItemSearchResult } from '../../../object-collection/shared/work
import { TruncatableService } from '../../../truncatable/truncatable.service'; import { TruncatableService } from '../../../truncatable/truncatable.service';
import { followLink } from '../../../utils/follow-link-config.model'; 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 { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
/** /**
* This component renders workflowitem object for the search result in the list view. * This component renders workflowitem object for the search result in the list view.
@@ -40,9 +41,10 @@ export class WorkflowItemSearchResultListElementComponent extends SearchResultLi
constructor( constructor(
protected truncatableService: TruncatableService, protected truncatableService: TruncatableService,
protected linkService: LinkService protected linkService: LinkService,
protected dsoNameService: DSONameService
) { ) {
super(truncatableService); super(truncatableService, dsoNameService);
} }
/** /**

View File

@@ -16,6 +16,8 @@ import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
import { TruncatableService } from '../../../truncatable/truncatable.service'; import { TruncatableService } from '../../../truncatable/truncatable.service';
import { WorkspaceItemSearchResultListElementComponent } from './workspace-item-search-result-list-element.component'; import { WorkspaceItemSearchResultListElementComponent } from './workspace-item-search-result-list-element.component';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
let component: WorkspaceItemSearchResultListElementComponent; let component: WorkspaceItemSearchResultListElementComponent;
let fixture: ComponentFixture<WorkspaceItemSearchResultListElementComponent>; let fixture: ComponentFixture<WorkspaceItemSearchResultListElementComponent>;
@@ -66,6 +68,7 @@ describe('WorkspaceItemSearchResultListElementComponent', () => {
{ provide: TruncatableService, useValue: {} }, { provide: TruncatableService, useValue: {} },
{ provide: ItemDataService, useValue: {} }, { provide: ItemDataService, useValue: {} },
{ provide: LinkService, useValue: linkService }, { provide: LinkService, useValue: linkService },
{ provide: DSONameService, useClass: DSONameServiceMock }
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).overrideComponent(WorkspaceItemSearchResultListElementComponent, { }).overrideComponent(WorkspaceItemSearchResultListElementComponent, {

View File

@@ -15,6 +15,7 @@ import { WorkspaceItemSearchResult } from '../../../object-collection/shared/wor
import { TruncatableService } from '../../../truncatable/truncatable.service'; import { TruncatableService } from '../../../truncatable/truncatable.service';
import { followLink } from '../../../utils/follow-link-config.model'; 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 { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
/** /**
* This component renders workspaceitem object for the search result in the list view. * This component renders workspaceitem object for the search result in the list view.
@@ -40,9 +41,10 @@ export class WorkspaceItemSearchResultListElementComponent extends SearchResultL
constructor( constructor(
protected truncatableService: TruncatableService, protected truncatableService: TruncatableService,
protected linkService: LinkService protected linkService: LinkService,
protected dsoNameService: DSONameService
) { ) {
super(truncatableService); super(truncatableService, dsoNameService);
} }
/** /**

View File

@@ -1,4 +1,4 @@
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge> <ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/collections/' + dso.id]" class="lead" [innerHTML]="firstMetadataValue('dc.title')"></a> <a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/collections/' + dso.id]" class="lead" [innerHTML]="dsoTitle"></a>
<span *ngIf="linkType == linkTypes.None" class="lead" [innerHTML]="firstMetadataValue('dc.title')"></span> <span *ngIf="linkType == linkTypes.None" class="lead" [innerHTML]="dsoTitle"></span>
<div *ngIf="dso.shortDescription" class="text-muted abstract-text" [innerHTML]="firstMetadataValue('dc.description.abstract')"></div> <div *ngIf="dso.shortDescription" class="text-muted abstract-text" [innerHTML]="firstMetadataValue('dc.description.abstract')"></div>

View File

@@ -7,6 +7,8 @@ import { TruncatePipe } from '../../../utils/truncate.pipe';
import { Collection } from '../../../../core/shared/collection.model'; import { Collection } from '../../../../core/shared/collection.model';
import { TruncatableService } from '../../../truncatable/truncatable.service'; import { TruncatableService } from '../../../truncatable/truncatable.service';
import { CollectionSearchResult } from '../../../object-collection/shared/collection-search-result.model'; import { CollectionSearchResult } from '../../../object-collection/shared/collection-search-result.model';
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
let collectionSearchResultListElementComponent: CollectionSearchResultListElementComponent; let collectionSearchResultListElementComponent: CollectionSearchResultListElementComponent;
let fixture: ComponentFixture<CollectionSearchResultListElementComponent>; let fixture: ComponentFixture<CollectionSearchResultListElementComponent>;
@@ -47,6 +49,7 @@ describe('CollectionSearchResultListElementComponent', () => {
declarations: [CollectionSearchResultListElementComponent, TruncatePipe], declarations: [CollectionSearchResultListElementComponent, TruncatePipe],
providers: [ providers: [
{ provide: TruncatableService, useValue: truncatableServiceStub }, { provide: TruncatableService, useValue: truncatableServiceStub },
{ provide: DSONameService, useClass: DSONameServiceMock }
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).overrideComponent(CollectionSearchResultListElementComponent, { }).overrideComponent(CollectionSearchResultListElementComponent, {

View File

@@ -1,4 +1,4 @@
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge> <ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/communities/' + dso.id]" class="lead" [innerHTML]="firstMetadataValue('dc.title')"></a> <a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/communities/' + dso.id]" class="lead" [innerHTML]="dsoTitle"></a>
<span *ngIf="linkType == linkTypes.None" class="lead" [innerHTML]="firstMetadataValue('dc.title')"></span> <span *ngIf="linkType == linkTypes.None" class="lead" [innerHTML]="dsoTitle"></span>
<div *ngIf="dso.shortDescription" class="text-muted abstract-text" [innerHTML]="firstMetadataValue('dc.description.abstract')"></div> <div *ngIf="dso.shortDescription" class="text-muted abstract-text" [innerHTML]="firstMetadataValue('dc.description.abstract')"></div>

View File

@@ -7,6 +7,8 @@ import { TruncatePipe } from '../../../utils/truncate.pipe';
import { Community } from '../../../../core/shared/community.model'; import { Community } from '../../../../core/shared/community.model';
import { TruncatableService } from '../../../truncatable/truncatable.service'; import { TruncatableService } from '../../../truncatable/truncatable.service';
import { CommunitySearchResult } from '../../../object-collection/shared/community-search-result.model'; import { CommunitySearchResult } from '../../../object-collection/shared/community-search-result.model';
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
let communitySearchResultListElementComponent: CommunitySearchResultListElementComponent; let communitySearchResultListElementComponent: CommunitySearchResultListElementComponent;
let fixture: ComponentFixture<CommunitySearchResultListElementComponent>; let fixture: ComponentFixture<CommunitySearchResultListElementComponent>;
@@ -47,6 +49,7 @@ describe('CommunitySearchResultListElementComponent', () => {
declarations: [CommunitySearchResultListElementComponent, TruncatePipe], declarations: [CommunitySearchResultListElementComponent, TruncatePipe],
providers: [ providers: [
{ provide: TruncatableService, useValue: truncatableServiceStub }, { provide: TruncatableService, useValue: truncatableServiceStub },
{ provide: DSONameService, useClass: DSONameServiceMock }
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]

View File

@@ -2,10 +2,10 @@
<ds-truncatable [id]="dso.id" *ngIf="object !== undefined && object !== null"> <ds-truncatable [id]="dso.id" *ngIf="object !== undefined && object !== null">
<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" [routerLink]="[itemPageRoute]" class="lead item-list-title"
[innerHTML]="firstMetadataValue('dc.title')"></a> [innerHTML]="dsoTitle"></a>
<span *ngIf="linkType == linkTypes.None" class="lead" <span *ngIf="linkType == linkTypes.None" class="lead item-list-title"
[innerHTML]="firstMetadataValue('dc.title')"></span> [innerHTML]="dsoTitle"></span>
<span class="text-muted"> <span class="text-muted">
<ds-truncatable-part [id]="dso.id" [minLines]="1"> <ds-truncatable-part [id]="dso.id" [minLines]="1">
<ng-container *ngIf="dso.firstMetadataValue('dc.publisher') || dso.firstMetadataValue('dc.date.issued')"> <ng-container *ngIf="dso.firstMetadataValue('dc.publisher') || dso.firstMetadataValue('dc.date.issued')">

View File

@@ -7,6 +7,8 @@ import { Item } from '../../../../../../core/shared/item.model';
import { TruncatePipe } from '../../../../../utils/truncate.pipe'; import { TruncatePipe } from '../../../../../utils/truncate.pipe';
import { TruncatableService } from '../../../../../truncatable/truncatable.service'; import { TruncatableService } from '../../../../../truncatable/truncatable.service';
import { ItemSearchResult } from '../../../../../object-collection/shared/item-search-result.model'; import { ItemSearchResult } from '../../../../../object-collection/shared/item-search-result.model';
import { DSONameService } from '../../../../../../core/breadcrumbs/dso-name.service';
import { DSONameServiceMock, UNDEFINED_NAME } from '../../../../../mocks/dso-name.service.mock';
let publicationListElementComponent: ItemSearchResultListElementComponent; let publicationListElementComponent: ItemSearchResultListElementComponent;
let fixture: ComponentFixture<ItemSearchResultListElementComponent>; let fixture: ComponentFixture<ItemSearchResultListElementComponent>;
@@ -53,23 +55,18 @@ const mockItemWithoutMetadata: ItemSearchResult = Object.assign(new ItemSearchRe
indexableObject: indexableObject:
Object.assign(new Item(), { Object.assign(new Item(), {
bundles: observableOf({}), bundles: observableOf({}),
metadata: { metadata: {}
'dc.title': [
{
language: 'en_US',
value: 'This is just another title'
}
]
}
}) })
}); });
describe('ItemListElementComponent', () => { describe('ItemListElementComponent', () => {
beforeEach(waitForAsync(() => { beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ItemSearchResultListElementComponent, TruncatePipe], declarations: [ItemSearchResultListElementComponent, TruncatePipe],
providers: [ providers: [
{ provide: TruncatableService, useValue: {} } { provide: TruncatableService, useValue: {} },
{ provide: DSONameService, useClass: DSONameServiceMock }
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
@@ -179,4 +176,16 @@ describe('ItemListElementComponent', () => {
expect(abstractField).toBeNull(); expect(abstractField).toBeNull();
}); });
}); });
describe('When the item has no title', () => {
beforeEach(() => {
publicationListElementComponent.object = mockItemWithoutMetadata;
fixture.detectChanges();
});
it('should show the fallback untitled translation', () => {
const titleField = fixture.debugElement.query(By.css('.item-list-title'));
expect(titleField.nativeElement.textContent.trim()).toEqual(UNDEFINED_NAME);
});
});
}); });

View File

@@ -7,6 +7,7 @@ import { hasValue } from '../../empty.util';
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
import { TruncatableService } from '../../truncatable/truncatable.service'; import { TruncatableService } from '../../truncatable/truncatable.service';
import { Metadata } from '../../../core/shared/metadata.utils'; import { Metadata } from '../../../core/shared/metadata.utils';
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
@Component({ @Component({
selector: 'ds-search-result-list-element', selector: 'ds-search-result-list-element',
@@ -17,8 +18,9 @@ export class SearchResultListElementComponent<T extends SearchResult<K>, K exten
* The DSpaceObject of the search result * The DSpaceObject of the search result
*/ */
dso: K; dso: K;
dsoTitle: string;
public constructor(protected truncatableService: TruncatableService) { public constructor(protected truncatableService: TruncatableService, protected dsoNameService: DSONameService) {
super(); super();
} }
@@ -28,6 +30,7 @@ export class SearchResultListElementComponent<T extends SearchResult<K>, K exten
ngOnInit(): void { ngOnInit(): void {
if (hasValue(this.object)) { if (hasValue(this.object)) {
this.dso = this.object.indexableObject; this.dso = this.object.indexableObject;
this.dsoTitle = this.dsoNameService.getName(this.dso);
} }
} }

View File

@@ -10,6 +10,8 @@ import { LinkService } from '../../../core/cache/builders/link.service';
import { createSuccessfulRemoteDataObject$ } from '../../remote-data.utils'; import { createSuccessfulRemoteDataObject$ } from '../../remote-data.utils';
import { HALResource } from '../../../core/shared/hal-resource.model'; import { HALResource } from '../../../core/shared/hal-resource.model';
import { ChildHALResource } from '../../../core/shared/child-hal-resource.model'; import { ChildHALResource } from '../../../core/shared/child-hal-resource.model';
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
import { DSONameServiceMock } from '../../mocks/dso-name.service.mock';
export function createSidebarSearchListElementTests( export function createSidebarSearchListElementTests(
componentClass: any, componentClass: any,
@@ -38,6 +40,7 @@ export function createSidebarSearchListElementTests(
providers: [ providers: [
{ provide: TruncatableService, useValue: {} }, { provide: TruncatableService, useValue: {} },
{ provide: LinkService, useValue: linkService }, { provide: LinkService, useValue: linkService },
{ provide: DSONameService, useClass: DSONameServiceMock },
...extraProviders ...extraProviders
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]

View File

@@ -12,6 +12,7 @@ import { followLink } from '../../utils/follow-link-config.model';
import { RemoteData } from '../../../core/data/remote-data'; import { RemoteData } from '../../../core/data/remote-data';
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
import { Context } from '../../../core/shared/context.model'; import { Context } from '../../../core/shared/context.model';
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
@Component({ @Component({
selector: 'ds-sidebar-search-list-element', selector: 'ds-sidebar-search-list-element',
@@ -39,8 +40,10 @@ export class SidebarSearchListElementComponent<T extends SearchResult<K>, K exte
description: string; description: string;
public constructor(protected truncatableService: TruncatableService, public constructor(protected truncatableService: TruncatableService,
protected linkService: LinkService) { protected linkService: LinkService,
super(truncatableService); protected dsoNameService: DSONameService
) {
super(truncatableService, dsoNameService);
} }
/** /**

View File

@@ -1098,6 +1098,10 @@
"dso.name.untitled": "Untitled",
"dso-selector.create.collection.head": "New collection", "dso-selector.create.collection.head": "New collection",
"dso-selector.create.collection.sub-level": "Create a new collection in", "dso-selector.create.collection.sub-level": "Create a new collection in",