collection is displayed below the submitter

This commit is contained in:
cris
2023-02-04 21:28:49 +00:00
parent 17841ed049
commit ac7b5f841e
9 changed files with 102 additions and 61 deletions

View File

@@ -18,6 +18,7 @@ import { ClaimedApprovedSearchResultListElementComponent } from '../shared/objec
import { ClaimedDeclinedSearchResultListElementComponent } from '../shared/object-list/my-dspace-result-list-element/claimed-search-result/claimed-declined-search-result/claimed-declined-search-result-list-element.component';
import { ResearchEntitiesModule } from '../entity-groups/research-entities/research-entities.module';
import { ItemSubmitterComponent } from '../shared/object-collection/shared/mydspace-item-submitter/item-submitter.component';
import { ItemCollectionComponent } from '../shared/object-collection/shared/mydspace-item-collection/item-collection.component';
import { ItemDetailPreviewComponent } from '../shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview.component';
import { ItemDetailPreviewFieldComponent } from '../shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component';
import { ItemListPreviewComponent } from '../shared/object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component';
@@ -44,6 +45,7 @@ const ENTRY_COMPONENTS = [
const DECLARATIONS = [
...ENTRY_COMPONENTS,
ItemSubmitterComponent,
ItemCollectionComponent,
ItemDetailPreviewComponent,
ItemDetailPreviewFieldComponent,
ItemListPreviewComponent,

View File

@@ -0,0 +1,7 @@
<div class="mt-2 mb-2" *ngIf="(collection$ | async)">
<span class="text-muted">{{'collection.listelement.badge' | translate}}:
<a [routerLink]="['/collections', (collection$ | async)?.id]">
{{(collection$ | async)?.name}}
</a>
</span>
</div>

View File

@@ -0,0 +1,65 @@
import { Component, Input, OnInit } from '@angular/core';
import { EMPTY, Observable } from 'rxjs';
import { map, mergeMap } from 'rxjs/operators';
import { RemoteData } from '../../../../core/data/remote-data';
import { isNotEmpty } from '../../../empty.util';
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
import { Collection } from '../../../../core/shared/collection.model';
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
import { LinkService } from '../../../../core/cache/builders/link.service';
import { followLink } from '../../../utils/follow-link-config.model';
/**
* This component represents a badge with collection information.
*/
@Component({
selector: 'ds-item-collection',
styleUrls: ['./item-collection.component.scss'],
templateUrl: './item-collection.component.html'
})
export class ItemCollectionComponent implements OnInit {
/**
* The target object
*/
@Input() object: any;
/**
* The collection object
*/
collection$: Observable<Collection>;
public constructor(protected linkService: LinkService) {
}
/**
* Initialize collection object
*/
ngOnInit() {
this.linkService.resolveLinks(this.object, followLink('workflowitem', {},
followLink('collection',{})
));
this.collection$ = (this.object.workflowitem as Observable<RemoteData<WorkflowItem>>).pipe(
getFirstCompletedRemoteData(),
mergeMap((rd: RemoteData<WorkflowItem>) => {
if (rd.hasSucceeded && isNotEmpty(rd.payload)) {
return (rd.payload.collection as Observable<RemoteData<Collection>>).pipe(
getFirstCompletedRemoteData(),
map((rds: RemoteData<Collection>) => {
if (rds.hasSucceeded && isNotEmpty(rds.payload)) {
return rds.payload;
} else {
return null;
}
})
);
} else {
return EMPTY;
}
}));
}
}

View File

@@ -1,3 +1,3 @@
<div class="mt-2 mb-2" *ngIf="(submitter$ | async)">
<span class="text-muted">{{'submission.workflow.tasks.generic.submitter' | translate}} : <span class="badge badge-info">{{(submitter$ | async)?.name}}</span></span>
<span class="text-muted">{{'submission.workflow.tasks.generic.submitter' | translate}}: <span class="badge badge-info">{{(submitter$ | async)?.name}}</span></span>
</div>

View File

@@ -15,34 +15,36 @@
<ds-truncatable [id]="item.id">
<h3 [innerHTML]="dsoTitle" [ngClass]="{'lead': true,'text-muted': !item.firstMetadataValue('dc.title')}"></h3>
<div>
<span class="text-muted">
<ds-truncatable-part [id]="item.id" [minLines]="1">
(<span *ngIf="item.hasMetadata('dc.publisher')" class="item-list-publisher"
[innerHTML]="item.firstMetadataValue('dc.publisher') + ', '"></span>
<span class="item-list-date"
<span class="text-muted">
<ds-truncatable-part [id]="item.id" [minLines]="1">
(<span *ngIf="item.hasMetadata('dc.publisher')" class="item-list-publisher"
[innerHTML]="item.firstMetadataValue('dc.publisher') + ', '"></span>
<span class="item-list-date"
[innerHTML]="item.firstMetadataValue('dc.date.issued') || ('mydspace.results.no-date' | translate)"></span>)
<span *ngIf="item.hasMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']);"
<span *ngIf="item.hasMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']);"
class="item-list-authors">
<span
*ngIf="item.allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length === 0">{{'mydspace.results.no-authors' | translate}}</span>
<span
*ngFor="let author of item.allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']); let last=last;">
<span [innerHTML]="author"><span [innerHTML]="author"></span></span>
<span *ngIf="!last">; </span>
<span
*ngIf="item.allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length === 0">{{'mydspace.results.no-authors'
| translate}}</span>
<span
*ngFor="let author of item.allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']); let last=last;">
<span [innerHTML]="author"><span [innerHTML]="author"></span></span>
<span *ngIf="!last">; </span>
</span>
</span>
</ds-truncatable-part>
</span>
</ds-truncatable-part>
</span>
<ds-truncatable-part [id]="item.id" [minLines]="1" class="item-list-abstract">
<span [ngClass]="{'text-muted': !item.firstMetadataValue('dc.description.abstract')}"
<span [ngClass]="{'text-muted': !item.firstMetadataValue('dc.description.abstract')}"
[innerHTML]="(item.firstMetadataValue('dc.description.abstract')) || ('mydspace.results.no-abstract' | translate)"></span>
</ds-truncatable-part>
</div>
</ds-truncatable>
<ds-item-submitter *ngIf="showSubmitter" [object]="object.indexableObject"></ds-item-submitter>
<ds-item-collection [object]="object.indexableObject"></ds-item-collection>
</div>
</div>
</div>
</div>

View File

@@ -8,6 +8,7 @@ import {
import { SearchResult } from '../../../search/models/search-result.model';
import { APP_CONFIG, AppConfig } from '../../../../../config/app-config.interface';
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
import { WorkflowItem } from 'src/app/core/submission/models/workflowitem.model';
/**
* This component show metadata for the given item object in the list view.
@@ -40,6 +41,11 @@ export class ItemListPreviewComponent implements OnInit {
*/
@Input() showSubmitter = false;
/**
* Represents the workflow of the item
*/
@Input() workflowItem: WorkflowItem;
/**
* Display thumbnails if required by configuration
*/

View File

@@ -1,16 +0,0 @@
<div>
<div class="row" *ngIf="collection">
<div class="col-12">
<div class="col-12">
<i>
<small>{{"collection.listelement.badge" | translate}}:</small>
</i>
&nbsp;
<a [href]="uiBaseUrl+'/collections/'+collection.uuid">
{{collection.metadata["dc.title"][0]["value"]}}
</a>
</div>
</div>
</div>
<ng-template #vcr></ng-template>
</div>

View File

@@ -6,8 +6,6 @@ import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspa
import { SearchResult } from '../../../search/models/search-result.model';
import { WorkflowItem } from 'src/app/core/submission/models/workflowitem.model';
import { ThemeService } from 'src/app/shared/theme-support/theme.service';
import { CollectionDataService } from 'src/app/core/data/collection-data.service';
import { environment } from '../../../../../../src/environments/environment';
/**
* Themed wrapper for ItemListPreviewComponent
@@ -15,10 +13,10 @@ import { environment } from '../../../../../../src/environments/environment';
@Component({
selector: 'ds-themed-item-list-preview',
styleUrls: [],
templateUrl: 'themed-item-list-preview.component.html'
templateUrl: '../../../theme-support/themed.component.html'
})
export class ThemedItemListPreviewComponent extends ThemedComponent<ItemListPreviewComponent> {
protected inAndOutputNames: (keyof ItemListPreviewComponent & keyof this)[] = ['item', 'object', 'status', 'showSubmitter'];
protected inAndOutputNames: (keyof ItemListPreviewComponent & keyof this)[] = ['item', 'object', 'status', 'showSubmitter', 'workflowItem'];
@Input() item: Item;
@@ -30,39 +28,16 @@ export class ThemedItemListPreviewComponent extends ThemedComponent<ItemListPrev
@Input() workflowItem: WorkflowItem;
collection: any = null;
uiBaseUrl: string = environment.ui.baseUrl;
constructor(
protected resolver: ComponentFactoryResolver,
protected cdr: ChangeDetectorRef,
protected themeService: ThemeService,
protected collectionDataService: CollectionDataService
) {
super(resolver, cdr, themeService);
}
ngOnInit() {
super.ngOnInit();
this.getCollectionName();
}
protected getCollectionName(): void {
if (!this.item) {
return;
}
const collectionId = this.workflowItem?.sections.collection;
if (!collectionId) {
return;
}
this.collectionDataService.findByHref(`${environment.rest.baseUrl}/api/core/collections/${collectionId}`).subscribe(collection => {
this.collection = collection?.payload;
});
}
protected getComponentName(): string {