Merge pull request #2129 from alexandrevryghem/retrieve-name-with-dsonameservice-main

Use the DSONameService to display DSpaceObjects names
This commit is contained in:
Tim Donohue
2023-05-22 15:55:47 -05:00
committed by GitHub
180 changed files with 685 additions and 359 deletions

View File

@@ -8,7 +8,7 @@
</ds-themed-thumbnail>
</span>
<div class="card-body">
<h4 class="card-title">{{object.name}}</h4>
<h4 class="card-title">{{ dsoNameService.getName(object) }}</h4>
<p *ngIf="object.shortDescription" class="card-text">{{object.shortDescription}}</p>
<div *ngIf="linkType != linkTypes.None" class="text-center">
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/collections/', object.id]" class="lead btn btn-primary viewButton">{{ 'search.results.view-result' | translate}}</a>

View File

@@ -6,6 +6,7 @@ import { listableObjectComponent } from '../../object-collection/shared/listable
import { hasNoValue, hasValue } from '../../empty.util';
import { followLink } from '../../utils/follow-link-config.model';
import { LinkService } from '../../../core/cache/builders/link.service';
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
/**
* Component representing a grid element for collection
@@ -21,8 +22,11 @@ export class CollectionGridElementComponent extends AbstractListableElementCompo
> {
private _object: Collection;
constructor(private linkService: LinkService) {
super();
constructor(
public dsoNameService: DSONameService,
private linkService: LinkService,
) {
super(dsoNameService);
}
// @ts-ignore

View File

@@ -8,7 +8,7 @@
</ds-themed-thumbnail>
</span>
<div class="card-body">
<h4 class="card-title">{{object.name}}</h4>
<h4 class="card-title">{{ dsoNameService.getName(object) }}</h4>
<p *ngIf="object.shortDescription" class="card-text">{{object.shortDescription}}</p>
<div *ngIf="linkType != linkTypes.None" class="text-center">
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/communities/', object.id]" class="lead btn btn-primary viewButton">{{ 'search.results.view-result' | translate}}</a>

View File

@@ -6,6 +6,7 @@ import { listableObjectComponent } from '../../object-collection/shared/listable
import { followLink } from '../../utils/follow-link-config.model';
import { LinkService } from '../../../core/cache/builders/link.service';
import { hasNoValue, hasValue } from '../../empty.util';
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
/**
* Component representing a grid element for a community
@@ -20,8 +21,11 @@ import { hasNoValue, hasValue } from '../../empty.util';
export class CommunityGridElementComponent extends AbstractListableElementComponent<Community> {
private _object: Community;
constructor( private linkService: LinkService) {
super();
constructor(
public dsoNameService: DSONameService,
private linkService: LinkService,
) {
super(dsoNameService);
}
// @ts-ignore

View File

@@ -10,6 +10,8 @@ import { Item } from '../../../../../core/shared/item.model';
import { createSuccessfulRemoteDataObject$ } from '../../../../remote-data.utils';
import { buildPaginatedList } from '../../../../../core/data/paginated-list.model';
import { PageInfo } from '../../../../../core/shared/page-info.model';
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
import { DSONameServiceMock } from '../../../../mocks/dso-name.service.mock';
const mockItem = Object.assign(new Item(), {
bundles: createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), [])),
@@ -54,6 +56,7 @@ describe('ItemGridElementComponent', () => {
imports: [NoopAnimationsModule],
declarations: [ItemGridElementComponent, TruncatePipe],
providers: [
{ provide: DSONameService, useValue: new DSONameServiceMock() },
{ provide: TruncatableService, useValue: truncatableServiceStub },
],
schemas: [NO_ERRORS_SCHEMA]

View File

@@ -9,7 +9,7 @@
</span>
<div class="card-body">
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context"></ds-themed-badges>
<h4 class="card-title">{{dso.name}}</h4>
<h4 class="card-title">{{ dsoNameService.getName(dso) }}</h4>
<p *ngIf="dso.shortDescription" class="card-text">{{dso.shortDescription}}</p>
<div *ngIf="linkType != linkTypes.None" class="text-center">
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/collections/', dso.id]" class="lead btn btn-primary viewButton">{{ 'search.results.view-result' | translate}}</a>

View File

@@ -9,6 +9,7 @@ import { followLink } from '../../../utils/follow-link-config.model';
import { LinkService } from '../../../../core/cache/builders/link.service';
import { TruncatableService } from '../../../truncatable/truncatable.service';
import { BitstreamDataService } from '../../../../core/data/bitstream-data.service';
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
@Component({
selector: 'ds-collection-search-result-grid-element',
@@ -23,11 +24,12 @@ export class CollectionSearchResultGridElementComponent extends SearchResultGrid
private _dso: Collection;
constructor(
public dsoNameService: DSONameService,
private linkService: LinkService,
protected truncatableService: TruncatableService,
protected bitstreamDataService: BitstreamDataService
) {
super(truncatableService, bitstreamDataService);
super(dsoNameService, truncatableService, bitstreamDataService);
}
// @ts-ignore

View File

@@ -9,7 +9,7 @@
</span>
<div class="card-body">
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context"></ds-themed-badges>
<h4 class="card-title">{{dso.name}}</h4>
<h4 class="card-title">{{ dsoNameService.getName(dso) }}</h4>
<p *ngIf="dso.shortDescription" class="card-text">{{dso.shortDescription}}</p>
<div *ngIf="linkType != linkTypes.None" class="text-center">
<a [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/communities/', dso.id]" class="lead btn btn-primary viewButton">{{ 'search.results.view-result' | translate}}</a>

View File

@@ -9,6 +9,7 @@ import { TruncatableService } from '../../../truncatable/truncatable.service';
import { BitstreamDataService } from '../../../../core/data/bitstream-data.service';
import { hasNoValue, hasValue } from '../../../empty.util';
import { followLink } from '../../../utils/follow-link-config.model';
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
@Component({
selector: 'ds-community-search-result-grid-element',
@@ -26,11 +27,12 @@ export class CommunitySearchResultGridElementComponent extends SearchResultGridE
private _dso: Community;
constructor(
public dsoNameService: DSONameService,
private linkService: LinkService,
protected truncatableService: TruncatableService,
protected bitstreamDataService: BitstreamDataService
) {
super(truncatableService, bitstreamDataService);
super(dsoNameService, truncatableService, bitstreamDataService);
}
// @ts-ignore

View File

@@ -32,11 +32,11 @@ export class ItemSearchResultGridElementComponent extends SearchResultGridElemen
dsoTitle: string;
constructor(
public dsoNameService: DSONameService,
protected truncatableService: TruncatableService,
protected bitstreamDataService: BitstreamDataService,
private dsoNameService: DSONameService,
) {
super(truncatableService, bitstreamDataService);
super(dsoNameService, truncatableService, bitstreamDataService);
}
ngOnInit(): void {

View File

@@ -8,6 +8,7 @@ import { Metadata } from '../../../core/shared/metadata.utils';
import { hasValue } from '../../empty.util';
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
import { TruncatableService } from '../../truncatable/truncatable.service';
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
@Component({
selector: 'ds-search-result-grid-element',
@@ -25,10 +26,11 @@ export class SearchResultGridElementComponent<T extends SearchResult<K>, K exten
isCollapsed$: Observable<boolean>;
public constructor(
public dsoNameService: DSONameService,
protected truncatableService: TruncatableService,
protected bitstreamDataService: BitstreamDataService
) {
super();
super(dsoNameService);
}
/**