diff --git a/src/app/my-dspace-page/my-dspace-search.module.ts b/src/app/my-dspace-page/my-dspace-search.module.ts index 1ce39991b3..6e450e8df1 100644 --- a/src/app/my-dspace-page/my-dspace-search.module.ts +++ b/src/app/my-dspace-page/my-dspace-search.module.ts @@ -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, diff --git a/src/app/shared/object-collection/shared/mydspace-item-collection/item-collection.component.html b/src/app/shared/object-collection/shared/mydspace-item-collection/item-collection.component.html new file mode 100644 index 0000000000..e17ba92a05 --- /dev/null +++ b/src/app/shared/object-collection/shared/mydspace-item-collection/item-collection.component.html @@ -0,0 +1,7 @@ +
+ {{'collection.listelement.badge' | translate}}: + + {{(collection$ | async)?.name}} + + +
\ No newline at end of file diff --git a/src/app/shared/object-collection/shared/mydspace-item-collection/item-collection.component.scss b/src/app/shared/object-collection/shared/mydspace-item-collection/item-collection.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/shared/object-collection/shared/mydspace-item-collection/item-collection.component.ts b/src/app/shared/object-collection/shared/mydspace-item-collection/item-collection.component.ts new file mode 100644 index 0000000000..8f857540d4 --- /dev/null +++ b/src/app/shared/object-collection/shared/mydspace-item-collection/item-collection.component.ts @@ -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; + + 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>).pipe( + getFirstCompletedRemoteData(), + mergeMap((rd: RemoteData) => { + if (rd.hasSucceeded && isNotEmpty(rd.payload)) { + return (rd.payload.collection as Observable>).pipe( + getFirstCompletedRemoteData(), + map((rds: RemoteData) => { + if (rds.hasSucceeded && isNotEmpty(rds.payload)) { + return rds.payload; + } else { + return null; + } + }) + ); + } else { + return EMPTY; + } + })); + } +} diff --git a/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.html b/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.html index 0f7ae433fa..db38f98b04 100644 --- a/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.html +++ b/src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.html @@ -1,3 +1,3 @@
- {{'submission.workflow.tasks.generic.submitter' | translate}} : {{(submitter$ | async)?.name}} + {{'submission.workflow.tasks.generic.submitter' | translate}}: {{(submitter$ | async)?.name}}
diff --git a/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component.html b/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component.html index d2db0ba209..94426136b5 100644 --- a/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component.html +++ b/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component.html @@ -15,34 +15,36 @@

- - - ( - + + ( + ) - - {{'mydspace.results.no-authors' | translate}} - - - ; + {{'mydspace.results.no-authors' + | translate}} + + + ; + + + - - - -
+ - + \ No newline at end of file diff --git a/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component.ts b/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component.ts index 6b40678ded..39f83bc371 100644 --- a/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component.ts +++ b/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component.ts @@ -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 */ diff --git a/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/themed-item-list-preview.component.html b/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/themed-item-list-preview.component.html deleted file mode 100644 index a5e4138a5f..0000000000 --- a/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/themed-item-list-preview.component.html +++ /dev/null @@ -1,16 +0,0 @@ -
-
-
-
- - {{"collection.listelement.badge" | translate}}: - -   - - {{collection.metadata["dc.title"][0]["value"]}} - -
-
-
- -
\ No newline at end of file diff --git a/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/themed-item-list-preview.component.ts b/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/themed-item-list-preview.component.ts index 54371a8ac8..ea5a38e3cb 100644 --- a/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/themed-item-list-preview.component.ts +++ b/src/app/shared/object-list/my-dspace-result-list-element/item-list-preview/themed-item-list-preview.component.ts @@ -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 { - 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 { - this.collection = collection?.payload; - }); } protected getComponentName(): string {