forked from DSpace/dspace-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request DSpace#2061 from CrisGuzmanS/collection-in-workflo…
…w-tasks Collection in workflow tasks
- Loading branch information
Showing
10 changed files
with
122 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...p/shared/object-collection/shared/mydspace-item-collection/item-collection.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
Empty file.
67 changes: 67 additions & 0 deletions
67
...app/shared/object-collection/shared/mydspace-item-collection/item-collection.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
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', { | ||
isOptional: true | ||
}, | ||
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; | ||
} | ||
})); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters